Unit 23 Strategy + Notation

We normally have: \[X_1, X_2, ..., X_{t_0}\] Our goal is to forecast a future value, say \(X_{t_{0+4}}\)

Typicall \(t_0 = n\) ie it is the last value of the realization. However, sometimes to evaluate our forecast, we compare it to the last few values of the realization.

23.1 Notation

\(\widehat{X_{t_0}}(\ell)\) is the forecast of \(X_{t_{0+\ell}}\) given data up to time \(t_0\)

  • \(t_0\) is called the forecast origin

  • \(\ell\) is called the lead time, the number of steps ahead which we want to forecast

23.2 some math

\[X_t - \phi_1 X_{t-1} = (1-\phi_1) \mu + a_t\]

  • assume we know \(\phi_1\)

  • we don-t know X11, we dont know mu, and we dont know a12

Iterative forecasting

We assume a in the future is 0, then we have

ar1forcastgen <- function(phi, mu) {
    fun <- function(xprev, l = 1) {
        if (l == 1) 
            return(phi * xprev + mu * (1 - phi)) else return(phi * fun(xprev, l - 1) + mu * (1 - phi))
    }
    fun
}
ex74 <- ar1forcastgen(phi = 0.8, mu = 24.17)
times <- c(1, 2, 3, 4, 5)
lapply(times, ex74, xprev = 22.93) %>% as.data.frame
##   X23.178 X23.3764 X23.53512 X23.662096 X23.7636768
## 1  23.178  23.3764  23.53512    23.6621    23.76368
ex74(22.93, l = 2)
## [1] 23.3764