【问题标题】:Errors in tsoutliers: non-finite value supplied by optimtsoutliers 中的错误:optim 提供的非有限值
【发布时间】:2015-04-14 19:08:35
【问题描述】:

我的目标是从一些时间序列中去除异常值,然后预测调整后的序列。所有这些都应该使用 tsoutliers 包中的 tso() 函数自动发生。但是,我收到的错误似乎与自动异常值检测产生的 xreg 有关。有人可以解释错误并建议在使用 tso() 函数时如何避免它们。在这两个示例中,一个数据点似乎会导致错误。

library(tsoutliers)
a <- 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 by optim
x <- tso(y = ts(b[1:14])) #success 
print(x)

【问题讨论】:

    标签: r


    【解决方案1】:

    似然函数的值在 ARIMA(0,0,0) 模型中变为非有限的。由于无法区分 AO、LS 和 TC,因此最后一次观察中的异常值可能很难处理。在这种情况下,似乎添加临时更改 TC 会引起一些麻烦。我建议您只包括加性异常值和电平转换(AO、LS)。

    x <- tso(y = ts(b[1:15]), type=c("AO","LS"))
    # ARIMA(0,0,0) with zero mean     
    # Coefficients:
    #          LS1    AO15
    #       0.0015  0.0154
    # s.e.  0.0003  0.0005
    # sigma^2 estimated as 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
    

    第一次观察中的水平偏移似乎不可靠,因此您可能会坚持使用加法异常值。

    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 as 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
    

    请注意,在最后一个案例中选择的模型与包含除最后一个 tso(y = ts(b[1:14])) 之外的所有观察值的系列相同。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-24
      • 2022-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-14
      相关资源
      最近更新 更多