时间序列异常值求解器

问题描述 投票:0回答:0

所以,我想制作具有异常值效应的 ARIMA。然后我已经完成了异常值的检测。但是,当我想对其建模时,我的输出出现错误

#Input data
dt<-read_excel("Docs/Kurs EUR  .xlsx", 
               sheet = "KJ KB", range = "C1:C752")
dt
dt<-data.frame(dt)

#Make data is a time series data
tsKJ<-ts(dt$`Kurs Jual`)

#Produce Return data from time series data
RtKJ<-diff(log(tsKJ))

#Modelling ARIMA using Return Data
acf(RtKJ, main="ACF Return Kurs Jual")
pacf(RtKJ, main="PACF Return Kurs Jual")
armakj1<-Arima(RtKJ, order=c(1,0,1), method="ML")
summary(armakj1)
Series: RtKJ 
ARIMA(1,0,1) with non-zero mean 

Coefficients:
         ar1      ma1   mean
      0.8610  -0.7760  1e-04
s.e.  0.0761   0.0948  3e-04

sigma^2 = 2.759e-05:  log likelihood = 2874.05
AIC=-5740.11   AICc=-5740.05   BIC=-5721.63

Training set error measures:
                       ME        RMSE         MAE MPE MAPE      MASE
Training set 5.310198e-06 0.005241987 0.003742169 NaN  Inf 0.7384854
                   ACF1
Training set 0.03451706

coeftest(armakj1)
z test of coefficients:

             Estimate  Std. Error z value  Pr(>|z|)    
ar1        8.6101e-01  7.6143e-02 11.3078 < 2.2e-16 ***
ma1       -7.7604e-01  9.4776e-02 -8.1881 2.653e-16 ***
intercept  8.8872e-05  3.0949e-04  0.2872     0.774    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

#Outlier Detection
mkjo<-tso(RtKJ,
                cval = 4,
                types = c("AO","IO", "LS", "TC"))
mkjo
Series: RtKJ 
Regression with ARIMA(0,0,1) errors 

Coefficients:
         ma1    TC46    AO53    TC55     IO65     AO74
      0.1624  0.0159  0.0265  0.0244  -0.0276  -0.0197
s.e.  0.0387  0.0038  0.0048  0.0038   0.0049   0.0048

sigma^2 = 2.351e-05:  log likelihood = 2935.55
AIC=-5857.11   AICc=-5856.96   BIC=-5824.77

Outliers:
  type ind time  coefhat  tstat
1   TC  46   47  0.01592  4.165
2   AO  53   54  0.02647  5.493
3   TC  55   56  0.02445  6.398
4   IO  65   66 -0.02757 -5.639
5   AO  74   75 -0.01967 -4.126

#Modelling from Outlier Detection
m2.o<-arimax(x=RtKJ, 
                order=c(1,0,1), 
                xreg=data.frame(AO1=1*(seq(RtKJ)==53),
                                AO2=1*(seq(RtKJ)==74),
                                io=c(65), method="ML"))
Error in svd(na.omit(xreg)) : a dimension is zero
In addition: Warning message:
In storage.mode(xreg) <- "double" : NAs introduced by coercion

那么,根据我的输出,我应该如何处理语法或数据?是什么让我的语法出错?

我期待关于我制作的模型摘要的输出。

r statistics time-series outliers
© www.soinside.com 2019 - 2024. All rights reserved.