Skip to main content

Note 04: Fundamental Stochastic Processes & Simulation

Module 1: Foundations & Exploratory Analysis

Learning Objectives

  • Derive closed-form means, variances, and theoretical ACF/PACF signatures for MA(1), causal AR(1), and random walk with drift processes.
  • Explain why stationary simulation requires burn-in or stationary initialization (arima.sim()).
  • Verify theoretical second-moment formulas empirically against simulated sample paths.

1. Moving Average Process of Order 1: MA(1)

Let \(\{\varepsilon_t\} \sim \text{WN}(0, \sigma^2)\). A centered MA(1) process is defined by:

\[ X_t = \varepsilon_t + \theta \varepsilon_{t-1}, \qquad \theta \in \mathbb{R}. \]

Because \(X_t\) is a finite linear combination of white noise terms, it is weakly stationary for every real value of \(\theta\). Direct computation gives:

\[ \mathbb{E}[X_t] = 0, \qquad \gamma_0 = \operatorname{Var}(X_t) = \sigma^2(1 + \theta^2), \]

and for lags \(k \ge 1\):

\[ \gamma_1 = \operatorname{Cov}(\varepsilon_t + \theta\varepsilon_{t-1},\; \varepsilon_{t+1} + \theta\varepsilon_t) = \theta\sigma^2, \qquad \gamma_k = 0 \quad (k \ge 2). \]

Dividing by \(\gamma_0\) produces the hallmark MA(1) autocorrelation structure:

\[ \rho_1 = \frac{\theta}{1 + \theta^2}, \qquad \rho_k = 0 \quad \text{for } |k| \ge 2. \]

Two properties stand out. First, the ACF cuts off sharply after lag 1, whereas the PACF tails off geometrically with alternating signs when \(\theta > 0\). Second, since \((1 - |\theta|)^2 \ge 0\) implies \(|\theta|/(1 + \theta^2) \le 1/2\), no MA(1) process can ever have \(|\rho_1| > 0.5\).

2. Causal Autoregressive Process of Order 1: AR(1)

A centered AR(1) process satisfies the stochastic recursion:

\[ X_t = \phi X_{t-1} + \varepsilon_t, \qquad |\phi| < 1. \]

When \(|\phi| < 1\), recursive substitution yields the mean-square convergent causal MA(\(\infty\)) representation:

\[ X_t = \sum_{j=0}^{\infty} \phi^j \varepsilon_{t-j}, \]

expressing \(X_t\) solely in terms of current and past innovations. Taking expectations and variances directly yields:

\[ \mathbb{E}[X_t] = 0, \qquad \gamma_0 = \operatorname{Var}(X_t) = \sigma^2 \sum_{j=0}^{\infty} \phi^{2j} = \frac{\sigma^2}{1 - \phi^2}. \]

Multiplying \(X_t = \phi X_{t-1} + \varepsilon_t\) by \(X_{t-k}\) (\(k \ge 1\)) and taking expectations gives \(\gamma_k = \phi \gamma_{k-1}\) because \(\mathbb{E}[\varepsilon_t X_{t-k}] = 0\). Solving this recurrence produces:

\[ \gamma_k = \phi^{|k|} \frac{\sigma^2}{1 - \phi^2}, \qquad \rho_k = \phi^{|k|}. \]

Thus, an AR(1) exhibits exponential (geometric) decay in the ACF (monotone when \(\phi > 0\), alternating sign when \(\phi < 0\)) and a sharp cutoff in the PACF after lag 1: \(\phi_{11} = \phi\) and \(\phi_{kk} = 0\) for all \(k \ge 2\).

When simulating a stationary AR(1), initializing \(X_0 = 0\) without discarding initial steps creates a transient startup period where \(\operatorname{Var}(X_t) < \sigma^2/(1-\phi^2)\). Using stats::arima.sim() handles burn-in automatically so the returned series is drawn from the stationary distribution.

3. Random Walk with Drift

Setting \(\phi = 1\) and adding a constant drift \(\delta \in \mathbb{R}\) gives the random walk with drift:

\[ X_t = \delta + X_{t-1} + \varepsilon_t. \]

Starting from a fixed initial value \(X_0\), unfolding the recursion produces \(X_t = X_0 + \delta t + \sum_{j=1}^t \varepsilon_j\). Its mean and variance are:

\[ \mathbb{E}[X_t] = X_0 + \delta t, \qquad \operatorname{Var}(X_t) = t \sigma^2. \]

Both moments depend explicitly on \(t\): even when \(\delta = 0\) (a pure random walk), the variance grows linearly without bound, so every random walk is non-stationary. Yet its first difference, \(\nabla X_t = X_t - X_{t-1} = \delta + \varepsilon_t\), is stationary white noise with constant mean \(\delta\) and constant variance \(\sigma^2\).

4. Simulation and Empirical Verification

We simulate \(n = 400\) observations from an MA(1) (\(\theta = 0.7\)), a causal AR(1) (\(\phi = 0.75\), simulated with arima.sim()), and a random walk with drift (\(\delta = 0.15\)), all with \(\sigma^2 = 1\).

set.seed(493)
n <- 400
theta <- 0.70
phi <- 0.75
delta <- 0.15

ma1_x <- as.numeric(arima.sim(model = list(ma = theta), n = n))
ar1_x <- as.numeric(arima.sim(model = list(ar = phi), n = n))
rw_x  <- cumsum(delta + rnorm(n))

sim_df <- tsibble(
  t = 1:n,
  MA1 = ma1_x,
  AR1 = ar1_x,
  RW_Drift = rw_x,
  index = t
)

acf_ma <- sim_df |> ACF(MA1, lag_max = 3) |> pull(acf)
acf_ar <- sim_df |> ACF(AR1, lag_max = 3) |> pull(acf)

tibble(
  Metric = c("Variance", "Lag-1 ACF", "Lag-2 ACF", "Lag-3 ACF"),
  `MA(1) Theory` = c(1 + theta^2, theta / (1 + theta^2), 0, 0),
  `MA(1) Sample` = c(var(ma1_x), acf_ma),
  `AR(1) Theory` = c(1 / (1 - phi^2), phi, phi^2, phi^3),
  `AR(1) Sample` = c(var(ar1_x), acf_ar)
) |> fmt_tbl(digits = 3, caption = "Theoretical vs. simulated moments for MA(1) (theta = 0.70) and AR(1) (phi = 0.75).")
Theoretical vs. simulated moments for MA(1) (theta = 0.70) and AR(1) (phi = 0.75).
Metric MA(1) Theory MA(1) Sample AR(1) Theory AR(1) Sample
Variance 1.49 1.413 2.286 2.116
Lag-1 ACF 0.47 0.451 0.750 0.720
Lag-2 ACF 0.00 -0.047 0.562 0.597
Lag-3 ACF 0.00 -0.050 0.422 0.472
p_ma <- sim_df |> autoplot(MA1, colour = ts_pal["teal"]) +
  labs(
    title = TeX(r"(MA(1): $\theta = 0.7$)", bold = TRUE),
    subtitle = "Short memory, constant variance",
    x = TeX(r"($t$)", bold = TRUE),
    y = TeX(r"($X_t$)", bold = TRUE)
  )
p_ar <- sim_df |> autoplot(AR1, colour = ts_pal["navy"]) +
  labs(
    title = TeX(r"(AR(1): $\phi = 0.75$)", bold = TRUE),
    subtitle = "Persistent, mean-reverting",
    x = TeX(r"($t$)", bold = TRUE),
    y = NULL
  )
p_rw <- sim_df |> autoplot(RW_Drift, colour = ts_pal["crimson"]) +
  labs(
    title = TeX(r"(RW + Drift: $\delta = 0.15$)", bold = TRUE),
    subtitle = "Non-stationary mean & variance",
    x = TeX(r"($t$)", bold = TRUE),
    y = NULL
  )

(p_ma | p_ar | p_rw) +
  plot_layout(guides = "collect") +
  plot_annotation(
    title = TeX(r"(Simulated Realizations of Three Fundamental Processes ($n = 400$))", bold = TRUE),
    theme = theme_ts()
  ) &
  theme(legend.position = "bottom")
Figure 1: Simulated realizations (n = 400) of MA(1) with theta = 0.70, causal AR(1) with phi = 0.75, and random walk with drift delta = 0.15.
a1 <- sim_df |> ACF(MA1, lag_max = 15) |> autoplot() +
  labs(title = TeX(r"(MA(1): $\theta = 0.7$)", bold = TRUE), x = NULL, y = TeX(r"(ACF ($\hat{\rho}_k$))", bold = TRUE))
a2 <- sim_df |> ACF(AR1, lag_max = 15) |> autoplot() +
  labs(title = TeX(r"(AR(1): $\phi = 0.75$)", bold = TRUE), x = NULL, y = NULL)
a3 <- sim_df |> ACF(RW_Drift, lag_max = 15) |> autoplot() +
  labs(title = TeX(r"(RW + Drift: $\delta = 0.15$)", bold = TRUE), x = NULL, y = NULL)

b1 <- sim_df |> PACF(MA1, lag_max = 15) |> autoplot() +
  labs(x = "Lag", y = TeX(r"(PACF ($\hat{\phi}_{kk}$))", bold = TRUE))
b2 <- sim_df |> PACF(AR1, lag_max = 15) |> autoplot() +
  labs(x = "Lag", y = NULL)
b3 <- sim_df |> PACF(RW_Drift, lag_max = 15) |> autoplot() +
  labs(x = "Lag", y = NULL)

((a1 | a2 | a3) / (b1 | b2 | b3)) +
  plot_layout(guides = "collect") +
  plot_annotation(
    title = "Sample ACF and PACF Duality Across Simulated Processes",
    subtitle = "MA(1) cuts off in ACF; AR(1) cuts off in PACF; random walk decays slowly",
    theme = theme_ts()
  ) &
  theme(legend.position = "bottom")
Figure 2: Sample ACF (top) and PACF (bottom) for simulated MA(1), AR(1), and random walk with drift.

Notice the exact duality between MA(1) and AR(1): the MA(1) cuts off in the ACF after lag 1 and tails off in the PACF, whereas the AR(1) tails off in the ACF and cuts off in the PACF after lag 1. Meanwhile, the random walk exhibits slow linear ACF decay and a near-unit lag-1 PACF spike.

Practice Exercises

Exercise 1: Oscillatory Negative AR(1)

Simulate \(n = 400\) observations from a causal AR(1) with \(\phi = -0.75\) and \(\sigma^2 = 1\) (set.seed(204)). Compare sample autocorrelations at lags 1 to 4 against \(\rho_k = (-0.75)^k\) and inspect the ACF and PACF plots.

Solution

A negative \(\phi\) causes the series to oscillate rapidly around zero: the ACF alternates in sign while decaying geometrically, and the PACF displays a single negative spike near \(-0.75\) at lag 1.

set.seed(204)
ar_neg <- tsibble(
  t = 1:400,
  x = as.numeric(arima.sim(model = list(ar = -0.75), n = 400)),
  index = t
)

tibble(
  Lag = 1:4,
  Theoretical = (-0.75)^(1:4),
  Sample = ar_neg |> ACF(x, lag_max = 4) |> pull(acf)
) |> fmt_tbl(digits = 3, caption = "Theoretical vs. sample ACF for AR(1) with phi = -0.75.")
Theoretical vs. sample ACF for AR(1) with phi = -0.75.
Lag Theoretical Sample
1 -0.750 -0.777
2 0.562 0.564
3 -0.422 -0.367
4 0.316 0.217
p_acf_neg <- ar_neg |> ACF(x, lag_max = 12) |> autoplot() +
  labs(
    title = TeX(r"(Sample ACF ($\phi = -0.75$))", bold = TRUE),
    subtitle = TeX(r"(Alternating geometric decay $\rho_k = (-0.75)^k$)"),
    x = "Lag",
    y = TeX(r"(ACF ($\hat{\rho}_k$))", bold = TRUE)
  )

p_pacf_neg <- ar_neg |> PACF(x, lag_max = 12) |> autoplot() +
  labs(
    title = TeX(r"(Sample PACF ($\phi = -0.75$))", bold = TRUE),
    subtitle = TeX(r"(Sharp lag-1 cutoff $\phi_{11} = -0.75$)"),
    x = "Lag",
    y = TeX(r"(PACF ($\hat{\phi}_{kk}$))", bold = TRUE)
  )

(p_acf_neg | p_pacf_neg) +
  plot_layout(guides = "collect") &
  theme(legend.position = "bottom")
Figure 3: ACF and PACF of a simulated AR(1) process with phi = -0.75.

Exercise 2: Identical ACF for \(\theta\) and \(1/\theta\) (Previewing Invertibility)

Show algebraically that \(\theta = 0.5\) and \(\theta = 2 = 1/0.5\) produce the exact same MA(1) lag-1 autocorrelation \(\rho_1 = 0.4\). Verify by simulating \(n = 600\) observations of each (set.seed(304)) and comparing their sample \(\hat{\rho}_1\) and variances.

Solution

Replacing \(\theta\) with \(1/\theta\) yields \(\frac{1/\theta}{1 + 1/\theta^2} = \frac{\theta}{\theta^2 + 1} = \rho_1(\theta)\). Because the ACF cannot distinguish \(\theta\) from \(1/\theta\), time series estimation imposes invertibility (\(|\theta| < 1\)) to select a unique representation (developed further in Module 3).

set.seed(304)
ma_a <- as.numeric(arima.sim(model = list(ma = 0.5), n = 600))
ma_b <- as.numeric(arima.sim(model = list(ma = 2.0), n = 600))

tibble(
  Parameter = c("theta = 0.5", "theta = 2.0"),
  `Theory rho_1` = c(0.4, 0.4),
  `Sample r_1` = c(cor(ma_a[-1], ma_a[-600]), cor(ma_b[-1], ma_b[-600])),
  `Theory Var` = c(1 + 0.5^2, 1 + 2.0^2),
  `Sample Var` = c(var(ma_a), var(ma_b))
) |> fmt_tbl(digits = 3, caption = "Comparison of MA(1) processes with reciprocal parameters theta = 0.5 and 2.0.")
Comparison of MA(1) processes with reciprocal parameters theta = 0.5 and 2.0.
Parameter Theory rho_1 Sample r_1 Theory Var Sample Var
theta = 0.5 0.4 0.353 1.25 1.287
theta = 2.0 0.4 0.377 5.00 4.772

Key Takeaways

  • MA(1) is always stationary with \(\operatorname{Var}(X_t) = \sigma^2(1 + \theta^2)\), \(|\rho_1| = |\theta|/(1 + \theta^2) \le 0.5\), and an ACF cutoff after lag 1.
  • Causal AR(1) (\(|\phi| < 1\)) has \(\operatorname{Var}(X_t) = \sigma^2/(1 - \phi^2)\), geometrically decaying ACF \(\rho_k = \phi^{|k|}\), and a PACF cutoff after lag 1.
  • A random walk with drift has linear mean growth \(\mathbb{E}[X_t] = X_0 + \delta t\) and linearly growing variance \(t\sigma^2\); first differencing restores stationarity.
  • Always simulate stationary ARMA processes via arima.sim() (or explicit burn-in) and set a fixed random seed for reproducibility.
Back to top