> library(tsDyn)
> A <- read.table("data.txt",col.names=c("date","t","price1","price2","price3","price4","price5","price6","price7","price8","price9","price10","price11"))
> mod.lstar <- lstar(A$price4,m=1,control=list(maxit=3000))
Using maximum autoregressive order for low regime: mL = 1
Using maximum autoregressive order for high regime: mH = 1
Using default threshold variable: thDelay=0
Performing grid search for starting values...
Starting values fixed: gamma = 3.538462 , th = 9.236948 ; SSE = 21060.39
Optimization algorithm converged
Optimized values fixed for regime 2 : gamma = 37.7138 , th = 12.17005 ; SSE = 20357.32
> summary(mod.lstar)
Non linear autoregressive model
LSTAR model
Coefficients:
Low regime:
const1 phi1.1
0.2974328 0.3633679
High regime:
const2 phi2.1
37.751052 -2.509213
Smoothing parameter: gamma = 37.71
Threshold
Variable: Z(t) = + (1) X(t)
Value: 12.17
Residuals:
Min 1Q Median 3Q Max
-21.36528 -3.90579 -0.26034 4.02009 22.78858
Fit:
residuals variance = 40.55, AIC = 1871, MAPE = 120.7%
Coefficient(s):
Estimate Std. Error t value Pr(>|z|)
const1 0.29743282 0.29347916 1.0135 0.3108
phi1.1 0.36336788 0.04858111 7.4796 7.461e-14 ***
const2 37.75105188 6.41464076 5.8851 3.977e-09 ***
phi2.1 -2.50921301 0.39707585 -6.3192 2.629e-10 ***
gamma 37.71380290 NA NA NA
th 12.17005093 0.00097296 12508.2756 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Non-linearity test of full-order LSTAR model against full-order AR model
F = 11.015 ; p-value = 0.00097013
Threshold
Variable: Z(t) = + (1) X(t)
Warning messages:
1: In vcov.lstar(object) : Hessian negative-semi definite
2: In sqrt(diag(vc)) : NaNs produced
此次运行结果是重启了R,再运行的代码。
之前对lstar.R进行过修改,并运行过,但我把它放在另一个包了。
为什么会出现这个警告信息呢?怎么修改呢?(在其他电脑上运行,没有这个警告信息,可能是修改的文件影响了结果?)
附件列表