Solution to Time Series Analysis Problems (with R Implementation)

A time series is stationary if its mean, variance, and autocovariance do not depend on time.

  • Mean: \(E[X_t] = E[2 + 3t + W_t] = 2 + 3t\), which depends on \(t\), so \(X_t\) is not stationary.
  • Variance: \(Var(X_t) = Var(W_t) = 1\), which is constant.
  • Autocovariance: Depends on time since \(X_t\) has a deterministic trend.

Thus, \(X_t\) is not stationary due to the presence of a time-dependent mean.

\(Y_t = (2 + 3t + W_t) - (2 + 3(t-1) + W_{t-1})\)

  • Mean: \(E[Y_t] = 3\) (constant,\(Y_t = 3 + W_t - W_{t-1}\) independent of time).
  • Variance: \(Var(Y_t) = Var(W_t - W_{t-1}) = 2\) (constant).
  • Autocovariance: \(Cov(Y_t, Y_{t-k})\) depends only on lag \(k\), not on \(t\).

Thus, \(Y_t\) is stationary.

\(V_t = \frac{1}{q} \sum_{j=1}^{q} X_{t-j}\)

  • Mean: \(E[V_t] = \frac{1}{q} \sum_{j=1}^{q} E[X_{t-j}]\), which depends on \(t\), so \(V_t\) is not stationary.
  • Variance: \(Var(V_t)\) depends on \(q\) and the variance of \(X_t\).
  • Autocovariance: Can be derived using the properties of moving average processes.

Show that ******************\(| \rho_X(1) | \leq 1/2\)******************** for any ********************\(\theta\)********************.**

  • Autocovariance function: \(\gamma(0) = (1+\theta^2) \sigma^2\) \(\gamma(1) = \theta \sigma^2\)
  • Autocorrelation function (ACF): \(\rho_X(1) = \frac{\gamma(1)}{\gamma(0)} = \frac{\theta \sigma^2}{(1+\theta^2) \sigma^2} = \frac{\theta}{1+\theta^2}\)
  • Maximum occurs when \(\theta = \pm 1\), giving \(\rho_X(1) = \pm \frac{1}{2}\).

1 Question 3: AR(p) Model Transformation

If \(X_t\) is an AR(p) model with intercept \(\phi_0 \neq 0\), let \(Y_t = X_t - \mu\), where \(\mu\) is the mean of \(X_t\). Then \(Y_t\) follows an AR(p) model without an intercept.

\(X_t = \phi_0 + \sum_{i=1}^{p} \phi_i X_{t-i} + W_t\) Taking expectations and subtracting \(\mu\), we get the transformed equation for \(Y_t\) as an AR(p) model without an intercept.


2 Question 4: Simulation of MA(2) Model in R

set.seed(123)
T <- 5000
theta <- c(0.5, 2)
wt <- rnorm(T, mean = 0, sd = 1)
xt <- wt
for (t in 3:T) {
  xt[t] <- wt[t] + theta[1] * wt[t-1] + theta[2] * wt[t-2]
}

# ACF Plot
acf(xt, main="ACF of Simulated MA(2) Process")

# Repeat with smaller sample size
T_small <- 100
xt_small <- xt[1:T_small]
acf(xt_small, main="ACF of Smaller Sample (T=100)")


3 Question 5: VIX Index Analysis in R

# Load required libraries
library(quantmod)
library(tseries)
library(forecast)

# Get VIX data
getSymbols("^VIX", from="2012-01-01", to="2017-02-01", src="yahoo")
#> [1] "VIX"
vix_returns <- monthlyReturn(Cl(VIX))
# (1) Identify AR model
ar_model <- ar(vix_returns)
print(ar_model)
#> 
#> Call:
#> ar(x = vix_returns)
#> 
#> Coefficients:
#>       1        2  
#> -0.4645  -0.2006  
#> 
#> Order selected 2  sigma^2 estimated as  0.05987
# (2) Fit MA model based on ACF plot
acf(vix_returns, main="ACF of VIX Returns")

ma_model <- arima(vix_returns, order=c(0,0,1))
print(ma_model)
#> 
#> Call:
#> arima(x = vix_returns, order = c(0, 0, 1))
#> 
#> Coefficients:
#>           ma1  intercept
#>       -0.5266     0.0216
#> s.e.   0.1145     0.0146
#> 
#> sigma^2 estimated as 0.0554:  log likelihood = 1.52,  aic = 2.96
# (3) Fit AR model based on PACF plot
pacf(vix_returns, main="PACF of VIX Returns")

ar_model <- arima(vix_returns, order=c(1,0,0))
print(ar_model)
#> 
#> Call:
#> arima(x = vix_returns, order = c(1, 0, 0))
#> 
#> Coefficients:
#>           ar1  intercept
#>       -0.3859     0.0195
#> s.e.   0.1175     0.0226
#> 
#> sigma^2 estimated as 0.05917:  log likelihood = -0.4,  aic = 6.8
# (4) Compare AIC values
cat("MA Model AIC:", AIC(ma_model), "\n")
#> MA Model AIC: 2.955273
cat("AR Model AIC:", AIC(ar_model), "\n")
#> AR Model AIC: 6.800648
if (AIC(ma_model) < AIC(ar_model)) {
  cat("MA model is better based on AIC.\n")
} else {
  cat("AR model is better based on AIC.\n")
}
#> MA model is better based on AIC.