Chapter 4 Topic 02
4.1 Statistical Model
Statistical model for each observations i (using the same k regressors across m equations),
yi(m×1)=¯Xi(m×mk)β(mk×1)+ei(m×1),[y1iy2i⋮ymi]=[x′1i0⋯00x′2i⋯0⋮⋮⋱000⋯x′mi]+[β1β2⋮βm]+[u1iu2i⋮umi],
with,
- yji and eji are scalars for j=1,...,m.
- xji are (k×1) matrix for j=1,...,m.
- β are (k×1) matrix for j=1,...,m.
Using the same k regressors across m equations this could be simplified to,
yi(m×1)=(Im(m×m)⊗x′i(1×k))(m×mk)β(mk×1)+ei(m×1).
Statistical model in matrix notation across observations i (using the same k regressors across m equations),
Y(n×m)=X(n×k)B(k×m)+E(n×k).
4.2 Simulation
4.2.1 Set up
# clear workspace
rm (list = ls(all=TRUE))
# set seed
set.seed(1234567, kind="Mersenne-Twister")
4.2.2 Data Generating Process
ytB+xtA=utut=ut−1P+vtvt=N(0,Vt)Vt=StS′tSt=C+Dwtx1t∼U[x1l,x1u]x1t∼N(μx1,σ2x1)
4.2.3 Simulation
# number of observations
<- 2000
t
# parameters
<- 0.6
b1 <- 0.2
b2
<- 0.4
a1 <- -0.5
a2
<- 1.0
c11 <- 0.5
c21 <- 2.0
c22
<- 0.5
d11 <- 0.2
d21 <- 0.2
d22
<- 0.8
p11 <- 0.1
p12 <- -0.2
p21 <- 0.6
p22
<- matrix(c(1, -b2,
b -b1, 1), nrow=2, byrow=T)
<- matrix(c(-a1, 0,
a 0, -a2), 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 <- zeros
v for (i in 2:t) {
<- c + d * w[i]
l <- rnorm(2) %*% t(l)
v[i,] 1] <- p11*u[i-1,1] + p12*u[i-1,2] + v[i,1]
u[i,2] <- p21*u[i-1,1] + p22*u[i-1,2] + v[i,2]
u[i,
}
# simulate the reduced form
<- zeros
y for (i in seq(t)) {
<- -x[i,] %*% a %*% solve(b) + u[i,] %*% solve(b)
y[i,] }
4.3 Least-Squares Estimator
Use the model in matrix notation across observations i.
# dimensions
<- ncol(y);m m
## [1] 2
<- nrow(y);t t
## [1] 2000
<- ncol(x);k k
## [1] 2
# stack regressands and regressors
<- as.vector(y) # stack y over observations
Y length(Y)
## [1] 4000
<- diag(m) %x% x # stack x over observations
X dim(X)
## [1] 4000 4
# estimation
<- lm(Y ~ X - 1)
lm.res $coefficients lm.res
## X1 X2 X3 X4
## 0.44495050 -0.37735285 0.07649982 -0.60879807
# comoare with reduced form parameters for simmulation
as.vector(ab)
## [1] 0.45454545 -0.34090909 0.09090909 -0.56818182
# expand residuals again
<- matrix(lm.res$residuals, ncol = m)
u dim(u)
## [1] 2000 2
<- 1/t * t(u) %*% u
Sig.u Sig.u
## [,1] [,2]
## [1,] 10.861852 7.894577
## [2,] 7.894577 9.537205
# comoare with reduced form parameters for simmulation
# ???