tsoutliers: Detection of Outliers in Time Series

時系列データにおける外れ値の検出

> library(tsoutliers)

バージョン: 0.6


関数名 概略
JarqueBera.test Jarque-Bera Test for Normality
bde9915 Data Set: Working Paper 'bde9915'
calendar.effects Calendar Effects
coefs2poly Product of the Polynomials in an ARIMA Model
hicp Data Set: Harmonised Indices of Consumer Prices
ipi Data Set: Industrial Production Indices
locate.outliers Stage I of the Procedure: Locate Outliers (Baseline Function)
locate.outliers.oloop Stage I of the Procedure: Locate Outliers (Loop Around Functions)
outliers Define Outliers in a Data Frame
outliers.effects Create the Pattern of Different Types of Outliers
outliers.regressors Regressor Variables for the Detection of Outliers
outliers.tstatistics Test Statistics for the Significance of Outliers
plot.tsoutliers Display Outlier Effects Detected by 'tsoutliers'
remove.outliers Stage II of the Procedure: Remove Outliers
tso Automatic Procedure for Detection of Outliers
tsouliers-package Automatic Detection of Outliers in Time Series

hicp

> hicp %>% class()
Error in eval(expr, envir, enclos): object 'hicp' not found

tso

> data("hicp")
> tso(y = log(hicp[[1]]))
Series: log(hicp[[1]]) 
ARIMA(1,1,0)(1,0,0)[12]                    

Coefficients:
         ar1    sar1    TC19    TC133   LS215    AO220
      0.1773  0.8499  0.0062  -0.0047  0.0063  -0.0034
s.e.  0.0606  0.0314  0.0013   0.0013  0.0015   0.0010

sigma^2 estimated as 0.000003887:  log likelihood=1378.18
AIC=-2742.36   AICc=-2741.96   BIC=-2716.75

Outliers:
  type ind    time   coefhat  tstat
1   TC  19 1991:07  0.006203  4.747
2   TC 133 2001:01 -0.004726 -3.607
3   LS 215 2007:11  0.006323  4.204
4   AO 220 2008:04 -0.003441 -3.618
> tso(y = Nile, types = c("AO", "LS", "TC"),
+     tsmethod = "stsm",
+     args.tsmodel = list(model = "local-level"))
Call:
stsmFit(x = <S4 object of class structure("stsm", package = "stsm")>, stsm.method = "maxlik.td.optim", 
    xreg = structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1), .Dim = c(100L, 1L), .Dimnames = list(NULL, 
        "LS29")), method = "L-BFGS-B", KF.version = "KFKSDS", KF.args = structure(list(
        P0cov = TRUE), .Names = "P0cov"), gr = "numerical")

Parameter estimates:
               LS29   var1  var2
Estimate    -247.78  16136     0
Std. error    11.71   1163   NaN

Log-likelihood: -633.0286 
Convergence: 0 
Number of iterations: 46 46 
Variance-covariance matrix: optimHessian 

Outliers:
  type ind time coefhat  tstat
1   LS  29 1899  -247.8 -21.16