function star() m=4,ar(1),ar(3)
tsDyn_0.7-40.zip
(1.32 MB)
library(tsDyn)
####data sqr
sqr <- read.table("sqr.txt", header = TRUE);
x <-sqr$sqr
mod1.star <- star(x, m=4,d=1,thDelay=0,noRegimes=3,sig=0.1,control=list(maxit=3000))
[1] "original"
V1/0 V1/-1 V1/-2 V1/-3
[1,] 2.14 1.33 1.31 1.14
[2,] 1.70 2.14 1.33 1.31
[1] "ar(1),ar(3)"
V1/0 V1/-1 V1/-3
[1,] 2.14 1.33 1.14
[2,] 1.70 2.14 1.31
Testing linearity... p-Value = 1.665672e-05
The series is nonlinear. Incremental building procedure:
Building a 2 regime STAR.
Performing grid search for starting values...
Starting values fixed: gamma = 10 , th = 12.48815 ; SSE = 192.9971
Optimization algorithm converged
Optimized values fixed for regime 2 : gamma = 9.978157 , th = 12.46917
Testing for addition of regime 3.
Estimating gradient matrix...
Done. Computing the test statistic...
Done. Regime 3 is NOT accepted (p-Value = 0.4722626 ).
Finished building a MRSTAR with 2 regimes
> mod1.star
Non linear autoregressive model
Multiple regime STAR model
Regime 1 :
Linear parameters: 0.2333271, 1.5366889, -0.5899859, 0.0212266
Regime 2 :
Linear parameters: 12.4843681, -0.5445538, 0.2590598, -0.4629664
Non-linear parameters:
9.9781565, 12.4691698
#####
####data svpdx
svpdx <- read.table("quartc.txt", header = TRUE);
xx <- svpdx$qcpi
mod2.star <- star(xx, m=4,d=1,thDelay=0,noRegimes=3,sig=0.1,control=list(maxit=3000))
[1] "original"
V1/0 V1/-1 V1/-2 V1/-3
[1,] 7.53 15.40 24.73 27.63
[2,] 4.03 7.53 15.40 24.73
[1] "ar(1),ar(3)"
V1/0 V1/-1 V1/-3
[1,] 7.53 15.40 27.63
[2,] 4.03 7.53 24.73
Testing linearity... p-Value = 0.0003500272
The series is nonlinear. Incremental building procedure:
Building a 2 regime STAR.
Performing grid search for starting values...
Starting values fixed: gamma = 19 , th = 8.22092 ; SSE = 112.7901
Optimization algorithm converged
Optimized values fixed for regime 2 : gamma = 18.99999 , th = 8.246298
Testing for addition of regime 3.
Estimating gradient matrix...
Done. Computing the test statistic...
Done. Regime 3 is needed (p-Value = 0.04979377 ).
Adding regime 3 .
Fixing good starting values for regime 3 ...
Reordering regimes...
Estimating parameters of regime 3 ...
Optimized values fixed for regime 3 : gamma = 39.99453 , th = 8.309892
*** Convergence problem. Code: 10
Optimized linear values:
0.3213105 1.298376 -0.3471048 -0.04305855
-27711956 2790671 946151.6 -269514.3
27711962 -2790672 -946151 269513.9
Ok.
Testing for addition of regime 4 .
Estimating gradient matrix...
Computing the test statistic...
Regime 4 is needed (p-Value = 0.03521662 ).
Finished building a MRSTAR with 3 regimes
> mod2.star
Non linear autoregressive model
Multiple regime STAR model
Regime 1 :
Linear parameters: 0.3213105, 1.2983759, -0.3471048, -0.0430585
Regime 2 :
Linear parameters: -27711956.1639132, 2790671.1486042, 946151.575765, -269514.305401
Non-linear parameters:
19.0446151, 8.3207742
Regime 3 :
Linear parameters: 27711962.1600718, -2790671.5917488, -946151.0472262, 269513.9229495
Non-linear parameters:
39.9945317, 8.3098917


雷达卡
京公网安备 11010802022788号







