如果你的数据是data.frame就会产生这样的错误
错误于rep(NA, length(x) - length(reg)) : 'times'参数不对
#######
example:
x=sample(seq(1:100),100,replace=T)
setar(x, m=2, d=2,steps=2,thDelay=1)
Non linear autoregressive model
SETAR model ( 2 regimes)
Coefficients:
Low regime:
phiL.1 phiL.2 const L
-0.164985 1.479546 31.203849
High regime:
phiH.1 phiH.2 const H
-0.05299776 0.41172242 24.76056691
Threshold:
-Variable: Z(t) = + (0) X(t)+ (1)X(t-1)
-Value: 32
Proportion of points in low regime: 35.42% High regime: 64.58%
Warning message:
Possible unit root in the low regime. Roots are: 0.8798 0.7683
##########data.frame
y=as.data.frame(x)
class(y) #[1] "data.frame"
setar(y, m=2, d=2,steps=2,thDelay=1)
错误于rep(NA, length(x) - length(reg)) : 'times'参数不对