Assignment Chef icon Assignment Chef
All English tutorials

Programming lesson

Mastering Econometrics II: Time Series Moments, AR(1) Forecasting, and Monte Carlo Bias in MATLAB

Learn how to derive variance and autocovariances for differenced random walk plus noise models, forecast AR(1) wages with discounting, and simulate AR(1) bias in MATLAB. Perfect for Spring 2025 econometrics homework help.

econometrics II homework 8 spring 2025 random walk plus noise model variance of differenced process autocovariance order 1 and 2 AR(1) expected wage forecast discounted sum of future income MATLAB AR(1) estimation t-test white noise income growth AR(2) model comparison Monte Carlo bias AR(1) Nickell bias dynamic panel time series econometrics tutorial econometrics homework help MATLAB code for econometrics stationarity and differencing geometric series discounting

Understanding the Random Walk Plus Noise Model

In econometrics, many economic time series—like log wages—exhibit both permanent and transitory shocks. A classic representation is the random walk plus noise model, where y_t = y_{t-1} + u_t with u_t white noise (σ_u²), and observed w_t = y_t + e_t with e_t white noise (σ_e²). Because w_t is non-stationary, econometricians often work with first differences Δw_t = w_t - w_{t-1}.

Deriving Moments of Δw_t

First, note that Δw_t = u_t + e_t - e_{t-1}. Since u_t and e_t are independent white noise, we compute:

  • Variance: Var(Δw_t) = σ_u² + 2σ_e²
  • Autocovariance of order 1: Cov(Δw_t, Δw_{t-1}) = -σ_e²
  • Autocovariance of order 2: Cov(Δw_t, Δw_{t-2}) = 0

These moments are crucial for method-of-moments estimation, a technique often used in econometrics homework and real-world applications like analyzing stock returns or AI-driven trading algorithms.

Forecasting with an AR(1) Process

Consider an AR(1) wage process: y_t = μ + β y_{t-1} + e_t, with e_t white noise (σ_e²) and β < 1. Given y_0 = 100, we want expected wages at any future period t.

Expected Wages in Period t

Iterating backwards, E[y_t | y_0] = μ(1 + β + β² + ... + β^{t-1}) + β^t y_0. Using the geometric series formula:

E[y_t | y_0] = μ (1 - β^t)/(1 - β) + β^t y_0

This is a standard result in econometrics for forecasting income dynamics or even cryptocurrency price trends.

Discounted Expected Value of All Future Income

With discount rate δ = 0.9, the discounted sum S = Σ_{t=1}^∞ δ^t E[y_t | y_0]. Substituting the expectation:

S = Σ_{t=1}^∞ δ^t [μ (1 - β^t)/(1 - β) + β^t y_0]

Split into two geometric series:

  • Mean term: μ/(1-β) Σ δ^t - μ/(1-β) Σ (δβ)^t = μ/(1-β) * [δ/(1-δ) - δβ/(1-δβ)]
  • Stochastic term: y_0 Σ (δβ)^t = y_0 * δβ/(1-δβ)

Thus, S = μ/(1-β) * [δ/(1-δ) - δβ/(1-δβ)] + y_0 * δβ/(1-δβ). This formula is used in asset pricing and student loan valuation models.

MATLAB Implementation: AR(1) and AR(2) Estimation on U.S. Income Data

Using real per capita U.S. income data (available from FRED), we estimate an AR(1) model for income growth:

% Load data (example: income_growth is a column vector)
data = income_growth;
T = length(data);
Y = data(2:end);
X = [ones(T-1,1), data(1:end-1)];
beta = (X'*X)\ (X'*Y);
residuals = Y - X*beta;
var_beta = var(residuals) * inv(X'*X);
t_stat = beta(2) / sqrt(var_beta(2,2));
% t-test: H0: beta=0 (white noise)
p_value = 2*(1-tcdf(abs(t_stat), T-2));
disp(['t-stat: ', num2str(t_stat), ', p-value: ', num2str(p_value)]);

If the t-statistic is significant (e.g., |t| > 2), we reject the null that income growth is white noise. This is a common econometrics homework exercise.

AR(2) Model and Model Comparison

Estimate an AR(2) model and test whether the second lag coefficient is zero:

X2 = [ones(T-2,1), data(2:end-1), data(1:end-2)];
Y2 = data(3:end);
beta2 = (X2'*X2)\ (X2'*Y2);
residuals2 = Y2 - X2*beta2;
var_beta2 = var(residuals2) * inv(X2'*X2);
t_stat2 = beta2(3) / sqrt(var_beta2(3,3));
% H0: AR(2) coefficient = 0 (AR(1) is sufficient)
p_value2 = 2*(1-tcdf(abs(t_stat2), T-3));

If the p-value is high, we cannot reject AR(1) in favor of AR(2). This mirrors model selection in AI time series forecasting.

Monte Carlo Simulation: Bias in AR(1) Estimates

Simulate an AR(1) process y_t = a y_{t-1} + e_t with e_t ~ N(0,1), T=40, and true a = 0.5, 0.9, 0.99. For each, run 1000 simulations and estimate a_hat via OLS:

a_values = [0.5, 0.9, 0.99];
T = 40;
reps = 1000;
bias = zeros(length(a_values),1);
for i = 1:length(a_values)
    a_true = a_values(i);
    a_hats = zeros(reps,1);
    for r = 1:reps
        y = zeros(T,1);
        y(1) = randn;
        for t = 2:T
            y(t) = a_true * y(t-1) + randn;
        end
        Y = y(2:end);
        X = y(1:end-1);
        a_hats(r) = (X'*X)\ (X'*Y);
    end
    bias(i) = mean(a_hats) - a_true;
end
disp(['Bias for a=0.5: ', num2str(bias(1))]);
disp(['Bias for a=0.9: ', num2str(bias(2))]);
disp(['Bias for a=0.99: ', num2str(bias(3))]);

You will observe that as a increases, the bias becomes more negative. This is the well-known Nickell bias in dynamic panel data models, a hot topic in econometrics of big data.

Practical Tips for Econometrics Homework

  • Always check stationarity before applying standard inference.
  • Use the filter function in MATLAB for efficient simulation.
  • For large Monte Carlo studies, vectorize loops to speed up computation.

This tutorial covers core concepts from Econometrics II homework 8 Spring 2025, providing both theoretical derivations and MATLAB code. Master these skills to excel in your course and apply them to real-world data, from inflation forecasting to algorithmic trading strategies.