Stochastic and deterministic trends in fable

Hi,

I have simulated data as follows:

#===============================
# In base R

# simulate trend-stationary or deterministic trend process

set.seed(47523)

sigma <- 3.0

nburn <- 100
nobs <- 400

e <- rnorm(n = 500, mean = 0, sd = sigma)

trend <- c(1:(nburn+nobs))

# constant + deterministic trend + white noise
tS <- as.ts(1.0 + 0.4*trend + e)
tS
plot.ts(tS[(nburn+1):(nburn+nobs)])

Based on fpp3 10.4 Stochastic and deterministic trends | Forecasting: Principles and Practice (3rd ed) I have modelled the data as

#===============================
library(fable)

fit_deterministic <- tS |>
  as_tsibble() |>
  tail(400) |>
  model(deterministic = ARIMA(value ~ 1 + trend() + pdq(d = 0)))
  report(fit_deterministic)
  
  
fit_stochastic <- tS |>
  as_tsibble() |>
  tail(400) |>
  model(stochastic = ARIMA(value ~ pdq(d = 1)))
  report(fit_stochastic)  

with results

Series: value 
Model: LM w/ ARIMA(0,0,2) errors 

Coefficients:
          ma1      ma2  trend()  intercept
      -0.0947  -0.1506   0.4017    40.5459
s.e.   0.0499   0.0522   0.0009     0.2142

sigma^2 estimated as 8.053:  log likelihood=-982.81
AIC=1975.62   AICc=1975.77   BIC=1995.58

Series: value 
Model: ARIMA(3,1,0) w/ drift 

Coefficients:
          ar1      ar2      ar3  constant
      -0.7765  -0.5859  -0.2664    1.0492
s.e.   0.0482   0.0545   0.0482    0.1640

sigma^2 estimated as 10.78:  log likelihood=-1038.92
AIC=2087.84   AICc=2087.99   BIC=2107.78

tS is a deterministic trend stationary process, thus the first model should be appropriate and the second model not, correct? How to interpret i.e. what do the results and coefficients mean, from both models?

If I change the seed e.g. set.seed(97523) the tS series (from a distance) looks very similar - if I re-estimate, I get very different results. Why?

In fable:

[1] What is the correct way to model and generate multistep OOS forecasts including prediction intervals for the tS process?

(a) Why can I not just model the tS process with automatic ARIMA or ETS?

(b) Another way could be to detrend, i.e. remove the trend with lm, and then estimate and generate multistep OOS forecasts for the residuals with ARIMA or ETS, and then add the forecast trend back. How in fable including prediction intervals?

[2] If I add a pure RW term to tS, what is the appropriate way to model the tSxt process?

xt <- arima.sim(n = 500, n.start = 100, list(order=c(0,1,0)))
xt  
  
tSxt <- tail(tS,400) + tail(xt,400)
tSxt

plot.ts(tSxt[1:(nburn+nobs)])

thanks,
Amarjit

Hi,

I think I can answer some of my previous questions.

Based on the following: hypothesis testing - Difference between series with drift and series with trend - Cross Validated (stackexchange.com), I have simulated a rwd + deterministic trend model. My question is how do I correctly model the process and generate forecasts in levels with PI's in fable? I have made an attempt but it is not correct, the parameters are not similar. And on reading Rob J Hyndman – The ARIMAX model muddle it's not straightforward - I don't know how to estimate similar parameters.

set.seed(63914)

n  <- 600
eps <- rnorm(n)

# rwd + deterministic trend
# -------------------------
drift <- 0.3
trend <- seq_len(n)
x2    <- rep(0, n)
for(i in seq.int(2, n)){
  x2[i] <- drift + 0.001*trend[i] + x2[i-1] + eps[i]
}
plot(ts(x2))

#===============================
library(fpp3)

x2.ts <- as.ts(x2[101:600])
x2.ts

x2_tS <- as_tsibble(x2.ts)
x2_tS

x2_tS |>
  autoplot(value) +
  labs(y = "value",
       title = "rwd + deterministic trend")

# rwd + deterministic trend
# -------------------------
fit_rwd_deterministic <- x2_tS |>
  model(rwd_deterministic = ARIMA(value ~ 1 + trend() +
                                pdq(d = 0), method = c("CSS-ML")))
report(fit_rwd_deterministic)

x2_tS |>
  autoplot(value) +
  autolayer(fit_rwd_deterministic |> forecast(h = 10),
            colour = "#D55E00", alpha = 0.65, level = c(80,95)) +
  labs(y = "value",
       title = "Forecasts from rwd + deterministic trend model")

fit_rwd_deterministic |> 
  forecast(h = 10) |> 
  hilo()

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.