还有我也遇到了下面这个问题,程序如下,数据在附件里:
> getwd()
[1] "d:/我的文档"
> library(tsDyn)
> svpdx <- read.table("quartc.txt", header = TRUE);
> x <- svpdx$qcpi
> mod1.star <- star(x, m=3,d=1,thDelay=0,noRegimes=3,sig=0.1,control=list(maxit=3000))
Testing linearity... p-Value = 0.001151816
The series is nonlinear. Incremental building procedure:
Building a 2 regime STAR.
Performing grid search for starting values...
Starting values fixed: gamma = 21 , th = 8.19391 ; SSE = 128.2701
Optimization algorithm converged
Optimized values fixed for regime 2 : gamma = 21.00119 , th = 8.223794
Testing for addition of regime 3.
Estimating gradient matrix...
Done. Computing the test statistic...
Done. Regime 3 is needed (p-Value = 0.01342169 ).
Adding regime 3 .
Fixing good starting values for regime 3 ...
Reordering regimes...
Estimating parameters of regime 3 ...
Optimized values fixed for regime 3 : gamma = 30.76407 , th = 16.5718
Optimization algorithm converged
Optimized linear values:
0.3238569 1.282448 -0.2267579 -0.1405304
-2.391707 1.009585 -1.465678 0.715712
17.98733 -1.548293 1.862583 -1.268843
Ok.
Testing for addition of regime 4 .
Estimating gradient matrix...
Computing the test statistic...
Regime 4 is needed (p-Value = 0.006431805 ).
Finished building a MRSTAR with 3 regimes
警告信息:
In rbind(object$model.specific$phi1, rnorm(3)) :
number of columns of result is not a multiple of vector length (arg 2)
>
52# epoh