dm.test(e1, e2, alternative=c("two.sided","less","greater"),
h=1, power=2)
"two.sided"
(default), "greater"
or "less"
. You can specify just the initial letter.e1
and e2
."htest"
containing the following components:alternative="less"
, the alternative hypothesis is that method 2 is less accurate than method 1. For alternative="greater"
, the alternative hypothesis is that method 2 is more accurate than method 1. For alternative="two.sided"
, the alternative hypothesis is that method 1 and method 2 have different levels of accuracy.# Test on in-sample one-step forecasts
f1 <- ets(WWWusage)
f2 <- auto.arima(WWWusage)
accuracy(f1)
accuracy(f2)
dm.test(residuals(f1),residuals(f2),h=1)
# Test on out-of-sample one-step forecasts
f1 <- ets(WWWusage[1:80])
f2 <- auto.arima(WWWusage[1:80])
f1.out <- ets(WWWusage[81:100],model=f1)
f2.out <- Arima(WWWusage[81:100],model=f2)
accuracy(f1.out)
accuracy(f2.out)
dm.test(residuals(f1.out),residuals(f2.out),h=1)
Run the code above in your browser using DataLab