r - Errors in tsoutliers: non-finite value supplied by optim -
my objective remove outliers time series, forecast adjusted series. should happen automatically using tso() function in tsoutliers package. however, receiving errors appear related xreg produced automatic outlier detection. can please explain errors , advise how avoid them when using tso() function. in both examples 1 data point appears cause error.
library(tsoutliers) <- c(0.0006803534,0.0008086988,0.0010701362,0.0028385699,0.0009526675,0.0011191115,0.0008059368,0.0008332677, 0.0012494373, 0.0005474622, 0.0012861884, 0.0013055677, 0.0026272806, 0.0009219052, 0.0012265391, 0.0011404776, 0.0012051921, 0.0011466459, 0.0009422736, 0.0011882251, 0.0016061762, 0.0017002298, 0.0010543345, 0.0014305019, 0.0009765448, 0.0016551414, 0.0015071106, 0.0009334908, 0.0011783813, 0.0025809926, 0.0024930899, 0.0021169154, 0.0014262570, 0.0017019384, 0.0014512346, 0.0012913704, 0.0020135812, 0.0025037096, 0.0030477309, 0.0014514058, 0.0016321700, 0.0008587965, 0.0014433053, 0.0009057649, 0.0007649348, 0.0010708278, 0.0022047009, 0.0019205611, 0.0007907089, 0.0013871365, 0.0008116141, 0.0013734145, 0.0012905443, 0.0008450942, 0.0011113448, 0.0020288530, 0.0016559151, 0.0010888568, 0.0010158067, 0.0010757180, 0.0022200539) x <- tso(y = ts(a[1:61])) #no suitable arima model found x <- tso(y = ts(a[1:60])) #success print(x) b <- c(0.0010396288, 0.0010933381, 0.0008588906, 0.0009726299, 0.0012475050, 0.0014702853, 0.0016084776, 0.0014296589, 0.0022134069, 0.0012096325, 0.0016529216, 0.0016144349, 0.0021092875, 0.0024984858, 0.0168729766) x <- tso(y = ts(b[1:15])) #non-finite value supplied optim x <- tso(y = ts(b[1:14])) #success print(x)
the value of likelihood function turns non-finite in arima(0,0,0) model. outliers in last observations can tricky deal since ao, ls , tc cannot distinguished. in case, seems adding temporary changes, tc, cause trouble. recommend including additive outliers , level shifts (ao, ls).
x <- tso(y = ts(b[1:15]), type=c("ao","ls")) # arima(0,0,0) 0 mean # coefficients: # ls1 ao15 # 0.0015 0.0154 # s.e. 0.0003 0.0005 # sigma^2 estimated 2.097e-07: log likelihood=94.05 # aic=-182.09 aicc=-179.91 bic=-179.97 # outliers: # type ind time coefhat tstat # 1 ls 1 1 0.001501 5.254 # 2 ao 15 15 0.015372 28.478
a level shift in first observations not seem reliable, may stick additive outliers.
x <- tso(y = ts(b[1:15]), type="ao") # arima(1,1,0) # coefficients: # ar1 ao15 # -0.4659 0.0146 # s.e. 0.2295 0.0005 # sigma^2 estimated 1.348e-07: log likelihood=90.75 # aic=-175.5 aicc=-173.1 bic=-173.58 # # outliers: # type ind time coefhat tstat # 1 ao 15 15 0.01456 31.11
notice chosen model in last case same series containing observations except last one, tso(y = ts(b[1:14]))
.
Comments
Post a Comment