Chapter 3 Topic 01

Heteroskedasticity and autocorrelation in systems of equations.

3.1 Motivation

Analyse the effect of heteroskdeasticty in systems of equations on SOLS estimator.

3.2 Probelm

Simulate a bivariate heteroskedasticity model for T=2000 observations

Byt+Axt=ututN(0,Vt=StSt)St=C+Dwt

with,

B=[1001],A=[0.4000.5],C=[100.52],D=[0.500.20.2],

and with,

x1,tiidU[0,10],x2,tiidN(0,9),w1,tiidU[0,1],

3.3 Analysis

Simulation of the data (without contemporaneous relationships in y)

t <- 2000

beta1  <- 0 # 0.6
alpha1 <- 0.4
beta2  <- 0 # 0.2
alpha2 <- -0.5

c11 <- 1.0
c21 <- 0.5
c22 <- 2.0

d11  <- 0.5
d21  <- 0.2
d22  <- 0.2

b <-  matrix(c(1, -beta2,
               -beta1, 1), nrow=2, byrow=T)
a <- matrix(c(-alpha1, 0,
              0, -alpha2), nrow=2, byrow=T)
c <-  matrix(c(c11,  0,
               c21, c22), nrow=2, byrow=T)
d <-  matrix(c(d11,  0,
               d21,  d22), nrow=2, byrow=T)
# Exogenous variables
x <- cbind(10*runif(t), 3*rnorm(t))
w <- runif(t)

# Disturbances
zeros <- array(0, c(t,2))
u <- zeros
for (i in seq(t)) {
  l     <- c + d * w[i]
  u[i,] <- rnorm(2) %*% t(l)
}

# Simulate the reduced form
y <- zeros
for (i in seq(t)) {
  y[i,] <- -x[i,] %*% a %*% solve(b) + u[i,] %*% solve(b)
}

Estimation of A using OLS (without contemporaneous relationships in y)

# OLS fitting
lm.res <- lm(y ~ x - 1)

# compare estimates
t(lm.res$coefficients)
##               x1           x2
## [1,] 0.387367424 -0.005222276
## [2,] 0.004203001 -0.513489887
b.a <- solve(b) %*% -a
b.a
##      [,1] [,2]
## [1,]  0.4  0.0
## [2,]  0.0 -0.5

Estimation of V (without contemporaneous relationships in y)

Sig.u <- 1/nrow(lm.res$residuals) * t(lm.res$residuals) %*% lm.res$residuals
Sig.u
##           [,1]      [,2]
## [1,] 1.5950007 0.8120818
## [2,] 0.8120818 4.7884989
# reconstruct (average) Sig
l <- c + d * 0.5
V <- l %*% t(l)
V
##        [,1] [,2]
## [1,] 1.5625 0.75
## [2,] 0.7500 4.77

Simulation of the data (with contemporaneous relationships in y)

t <- 2000

beta1  <- 0.6
alpha1 <- 0.4
beta2  <- 0.2
alpha2 <- -0.5

c11 <- 1.0
c21 <- 0.5
c22 <- 2.0

d11  <- 0.5
d21  <- 0.2
d22  <- 0.2

b <-  matrix(c(1, -beta2,
               -beta1, 1), nrow=2, byrow=T)
a <- matrix(c(-alpha1, 0,
              0, -alpha2), nrow=2, byrow=T)
c <-  matrix(c(c11,  0,
               c21, c22), nrow=2, byrow=T)
d <-  matrix(c(d11,  0,
               d21,  d22), nrow=2, byrow=T)
# Exogenous variables
x <- cbind(10*runif(t), 3*rnorm(t))
w <- runif(t)

# Disturbances
zeros <- array(0, c(t,2))
u <- zeros
for (i in seq(t)) {
  l     <- c + d * w[i]
  u[i,] <- rnorm(2) %*% t(l)
}

# Simulate the reduced form
y <- zeros
for (i in seq(t)) {
  y[i,] <- -x[i,] %*% a %*% solve(b) + u[i,] %*% solve(b)
}

Estimation of the parameters using OLS (with contemporaneous relationships in y)

# OLS fitting
lm.res <- lm(y ~ x - 1)

# compare estimates
t(lm.res$coefficients)
##              x1         x2
## [1,] 0.45697825 -0.3482923
## [2,] 0.08860531 -0.5814871
b.a <- solve(b) %*% -a
b.a
##           [,1]       [,2]
## [1,] 0.4545455 -0.1136364
## [2,] 0.2727273 -0.5681818

Estimation of V (with contemporaneous relationships in y)

Sig.u <- 1/nrow(lm.res$residuals) * t(lm.res$residuals) %*% lm.res$residuals
Sig.u
##          [,1]     [,2]
## [1,] 5.194421 4.996690
## [2,] 4.996690 6.429859
# reconstruct (average) Sig
l <- c + d * 0.5
V <- l %*% t(l)
V
##        [,1] [,2]
## [1,] 1.5625 0.75
## [2,] 0.7500 4.77

Cholesky decomposition of V

S <- chol(Sig.u)
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