For an innovative outlier, the equations I got from a paper by Tsay, are these:
$$y_t = f(t) +z(t)\\ f(t) = w_0 \frac{\theta(B)}{\phi(B)}\epsilon_t^d\\ \epsilon_t^d = \begin{cases} 1 & t = d \\ 0 & t \neq d \end{cases} $$
and, $ \frac{\theta(B)}{\phi(B)}$ are polynomials in a backshift operator, representing an arma model for a time series $z(t)$, while $y_t$ is a new time series with the innovation taken into account.
I am trying to figure out how to work this into a regressor for different values of $ \frac{\theta(B)}{\phi(B)}$.
For example, I tried to work out this simple case, but it is a ton of work.
if $ \frac{\theta(B)}{\phi(B)} = \frac{1}{1-\phi_1B - \phi_2B^2}$:
$$ y_t = \frac{w_0 \epsilon_t ^ d}{1 - \phi_1B - \phi_2B ^ 2} + z_t\\ (1 - \phi_1 B - \phi_2 B ^ 2) y_t = w_0 \epsilon_t ^ d + (1-\phi_1 B - \phi_2 B ^ 2) z_t $$ case 1:
$$t < d \rightarrow y_d = z_d $$
case 2:
$$ t = d : \\ y_d - \phi_1 y_{d - 1} - \phi_2 y_{d - 2} = w_0 \epsilon_d^d + (1-\phi_1 B - \phi_2 B ^ 2) z_t \rightarrow \\ \rightarrow y_d - \phi_1 z_{d - 1} - \phi_2 z_{d - 2} = w_0 + (1-\phi_1 B - \phi_2 B ^ 2) z_t \rightarrow \\ \rightarrow y_d = w_0 + z_d $$
case 3:
$$ t = d + 1\\ y_{d + 1} - \phi_1 y_{d} - \phi_2 y_{d - 1} = w_0 + (1-\phi_1 B - \phi_2 B ^ 2) z_{d + 1} \rightarrow \\ \rightarrow y_{d+1} - \phi_1 (w_0 + z_d) - \phi_2 z_{d - 1} = (1-\phi_1 B - \phi_2 B ^ 2) z_{d + 1} \rightarrow \\ \rightarrow y_{d+1} = \phi_1 w_0 + z_{d+1} $$
case 4:
$$ t = d + 2\\ y_{d + 2} - \phi_1 y_{d+1} - \phi_2 y_{d} = w_0 + (1-\phi_1 B - \phi_2 B ^ 2) z_{d + 2} \rightarrow \\ \rightarrow y_{d + 2} - \phi_1 (\phi_1 w_0 + z_{d+1}) - \phi_2 (w_0 + z_d) = (1-\phi_1 B - \phi_2 B ^ 2) z_{d + 2} \rightarrow \\ \rightarrow y_{d+2} = \phi_1 ^2 w_0 + \phi_2 w_0 + z_{d+2} $$
case 5:
$$t = d + 3 \rightarrow y_{d+3} = \phi_1 ^ 3 w_0 + 2 \phi_1 \phi_2 w_0 + z_{d+3}$$
case 6:
$$t = d + 4 \rightarrow y_{d+4} = \phi_1 ^ 4 w_0 + 3 \phi_1^2 \phi_2 w_0 + \phi_2 ^2 w_0 + z_{d+3}$$
My question is... is there some formula, where given any arma model $\theta(B)$ and $\phi(B)$, I can create a regressor with the terms solved above?
For example, in the above case I would have a regressor with $0$'s until $t = d$, and then the above terms :
$\left[0, 0, \ldots, 0, 1, \phi_1, \phi_1 ^2 + \phi_2, \phi_1 ^ 3 + 2 \phi_1 \phi_2, \phi_1 ^ 4 + 3 \phi_1^2 \phi_2 + \phi_2 ^2, \right]$
The idea here is that using this regressor, and knowledge of the ARMA terms, I could find $w_0$ with a linear regression.
Or, is there no real formula, and I just have to write something recursive in R?