Hello,
I am trying to predict a time series with ARIMA. In the first step I tested for heterosocedactiy and performed a BoxCox() transformation. In the next step I want to test if a differentiation is necessary. For this I wanted to test with Box.test(), adf.test() and kpss.test() whether this is necessary. Unfortunately the tests do not work properly with my data, because I am told once that I can accept stationarity and once that I can reject it. You can find the code enclosed. I am not sure what to do, cause when I use diff(bc_ts) adf.test() rejects H0 and kpss.test() accepts H0. Or can I ignore the test and do a differentiation anyway?
Thanks for your help.
# Box-Ljung test (tests the null hypothesis of absence of serial correlation)
Box.test(bc_ts, type="Ljung")
# Box-Ljung test
# data: bc_ts
# X-squared = 55.029, df = 1, p-value = 1.188e-13
# ADF Test (non-stationary) (H0, Data is non-stationary: p-value < 0.05 -> differentiation necessary)
adf.test(bc_ts)
# Augmented Dickey-Fuller Test
# data: bc_ts
# Dickey-Fuller = -6.2552, Lag order = 5, p-value = 0.01
# alternative hypothesis: stationary
# Warnmeldung:
# In adf.test(bc_ts) : p-value smaller than printed p-value
#KPSS Test (stationarity) (H0, Data is stationary: p-value < 0.05 -> differentiation necessary)
kpss.test(bc_ts, null = c("Level", "Trend"), lshort = TRUE)
# KPSS Test for Level Stationarity
# data: bc_ts
# KPSS Level = 1.5496, Truncation lag parameter = 4, p-value = 0.01
# Warnmeldung:
# In kpss.test(bc_ts, null = c("Level", "Trend"), lshort = TRUE) : p-value smaller than printed p-value
kpss.test(diff(bc_ts), null = c("Level", "Trend"), lshort = TRUE)
# KPSS Test for Level Stationarity
# data: diff(bc_ts)
# KPSS Level = 0.039205, Truncation lag parameter = 4, p-value = 0.1
# Warnmeldung:
# In kpss.test(diff(bc_ts), null = c("Level", "Trend"), lshort = TRUE) : p-value greater than printed p-value