Chapter 3 Topic 01
Heteroskedasticity and autocorrelation in systems of equations.
3.2 Probelm
Simulate a bivariate heteroskedasticity model for \(T=2000\) observations
\[\begin{align*} B y_t + A x_t &= u_t \\ u_t &\sim N\left(0, V_t = S_t S_t^{'}\right) \\ S_t &= C + D w_t \end{align*}\]
with,
\[\begin{align*} B &= \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}, \\ A &= \begin{bmatrix} -0.4 & 0 \\ 0 & 0.5 \end{bmatrix}, \\ C &= \begin{bmatrix} 1 & 0 \\ 0.5 & 2 \end{bmatrix}, \\ D &= \begin{bmatrix} 0.5 & 0 \\ 0.2 & 0.2 \end{bmatrix}, \end{align*}\]
and with,
\[\begin{align*} x_{1,t} &\sim iid \,\,\, U\left[0, 10\right], \\ x_{2,t} &\sim iid \,\,\, N\left(0, 9\right), \\ w_{1,t} &\sim iid \,\,\, U\left[0, 1\right], \end{align*}\]
3.3 Analysis
Simulation of the data (without contemporaneous relationships in \(y\))
<- 2000
t
<- 0 # 0.6
beta1 <- 0.4
alpha1 <- 0 # 0.2
beta2 <- -0.5
alpha2
<- 1.0
c11 <- 0.5
c21 <- 2.0
c22
<- 0.5
d11 <- 0.2
d21 <- 0.2
d22
<- matrix(c(1, -beta2,
b -beta1, 1), nrow=2, byrow=T)
<- matrix(c(-alpha1, 0,
a 0, -alpha2), nrow=2, byrow=T)
<- matrix(c(c11, 0,
c nrow=2, byrow=T)
c21, c22), <- matrix(c(d11, 0,
d nrow=2, byrow=T)
d21, d22), # Exogenous variables
<- cbind(10*runif(t), 3*rnorm(t))
x <- runif(t)
w
# Disturbances
<- array(0, c(t,2))
zeros <- zeros
u for (i in seq(t)) {
<- c + d * w[i]
l <- rnorm(2) %*% t(l)
u[i,]
}
# Simulate the reduced form
<- zeros
y for (i in seq(t)) {
<- -x[i,] %*% a %*% solve(b) + u[i,] %*% solve(b)
y[i,] }
Estimation of \(A\) using OLS (without contemporaneous relationships in \(y\))
# OLS fitting
<- lm(y ~ x - 1)
lm.res
# compare estimates
t(lm.res$coefficients)
## x1 x2
## [1,] 0.387367424 -0.005222276
## [2,] 0.004203001 -0.513489887
<- solve(b) %*% -a
b.a b.a
## [,1] [,2]
## [1,] 0.4 0.0
## [2,] 0.0 -0.5
Estimation of \(V\) (without contemporaneous relationships in \(y\))
<- 1/nrow(lm.res$residuals) * t(lm.res$residuals) %*% lm.res$residuals
Sig.u Sig.u
## [,1] [,2]
## [1,] 1.5950007 0.8120818
## [2,] 0.8120818 4.7884989
# reconstruct (average) Sig
<- c + d * 0.5
l <- l %*% t(l)
V V
## [,1] [,2]
## [1,] 1.5625 0.75
## [2,] 0.7500 4.77
Simulation of the data (with contemporaneous relationships in \(y\))
<- 2000
t
<- 0.6
beta1 <- 0.4
alpha1 <- 0.2
beta2 <- -0.5
alpha2
<- 1.0
c11 <- 0.5
c21 <- 2.0
c22
<- 0.5
d11 <- 0.2
d21 <- 0.2
d22
<- matrix(c(1, -beta2,
b -beta1, 1), nrow=2, byrow=T)
<- matrix(c(-alpha1, 0,
a 0, -alpha2), nrow=2, byrow=T)
<- matrix(c(c11, 0,
c nrow=2, byrow=T)
c21, c22), <- matrix(c(d11, 0,
d nrow=2, byrow=T)
d21, d22), # Exogenous variables
<- cbind(10*runif(t), 3*rnorm(t))
x <- runif(t)
w
# Disturbances
<- array(0, c(t,2))
zeros <- zeros
u for (i in seq(t)) {
<- c + d * w[i]
l <- rnorm(2) %*% t(l)
u[i,]
}
# Simulate the reduced form
<- zeros
y for (i in seq(t)) {
<- -x[i,] %*% a %*% solve(b) + u[i,] %*% solve(b)
y[i,] }
Estimation of the parameters using OLS (with contemporaneous relationships in \(y\))
# OLS fitting
<- lm(y ~ x - 1)
lm.res
# compare estimates
t(lm.res$coefficients)
## x1 x2
## [1,] 0.45697825 -0.3482923
## [2,] 0.08860531 -0.5814871
<- solve(b) %*% -a
b.a b.a
## [,1] [,2]
## [1,] 0.4545455 -0.1136364
## [2,] 0.2727273 -0.5681818
Estimation of \(V\) (with contemporaneous relationships in \(y\))
<- 1/nrow(lm.res$residuals) * t(lm.res$residuals) %*% lm.res$residuals
Sig.u Sig.u
## [,1] [,2]
## [1,] 5.194421 4.996690
## [2,] 4.996690 6.429859
# reconstruct (average) Sig
<- c + d * 0.5
l <- l %*% t(l)
V V
## [,1] [,2]
## [1,] 1.5625 0.75
## [2,] 0.7500 4.77
Cholesky decomposition of \(V\)
<- chol(Sig.u)
S S
## [,1] [,2]
## [1,] 2.279127 2.192370
## [2,] 0.000000 1.274116
t(S) %*% S
## [,1] [,2]
## [1,] 5.194421 4.996690
## [2,] 4.996690 6.429859
Sig.u
## [,1] [,2]
## [1,] 5.194421 4.996690
## [2,] 4.996690 6.429859