程序代写代做代考 C ECON61001 Econometric Methods Ekaterina Kazak Computer Tutorial 5, page 1 of 1 University of Manchester

ECON61001 Econometric Methods Ekaterina Kazak Computer Tutorial 5, page 1 of 1 University of Manchester
The purpose of this session is to introduce you to the autocorrelated error term in linear regression models and GLS.
Serial Correlation
Consider an autorogressive process of order one AR(1) of the form
ut =c+ρut−1 +εt, εt ∼N(0,1) t=1,…,T (1)
a) Write a function which takes 3 input parameters (c, ρ, T ) and simulates an AR(1) process defined in equation (1). Plot the simulated process for c = 0.1,ρ = 0.8 and T = 500 together with a horizontal line of the unconditional mean.
b) Practice in R how to create a matrix of the form ( an autocorrelation matrix for T = 5):  1 0.8 0.82 0.83 0.84
0.83 0.82
0.8  1
yt =1 − 3xt + ut, t = 1, …, T
ut =0.8·ut−1 +εt, εt ∼N(0,1),
 0.8 Ω5 = 0.82 0.83
0.84
c) Simulate a bivariate regression model
1 0.8 0.82 0.8 1 0.8
0.82 0.8 1 0.83 0.82 0.8
where xt ∼ N (5, 1) and T = 500. Compute OLS estimates for the intercept and slope parame- σε2
ters. Consider Example 4.3 and compute the GLS solution using Σ = 1 − 0.82 ΩT .
d) Use the code from c) to conduct a simulation study to examine the distribution of the OLS and GLS estimators for the slope over mc = 1000 simulation draws. Plot the histograms of βˆ1(OLS) and βˆ1(GLS) next to each other. Use the option xlim = c(-3.15, -2.85) when plotting the histograms. Which estimator is more efficient?
Exercises to solve at home
No homework this week. Enjoy the midterm!