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),[y1iy2iymi]=[x1i000x2i0000xmi]+[β1β2βm]+[u1iu2iumi],

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)xi(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=ut1P+vtvt=N(0,Vt)Vt=StStSt=C+Dwtx1tU[x1l,x1u]x1tN(μx1,σ2x1)

4.2.3 Simulation

# number of observations
t <- 2000

# parameters
b1 <- 0.6 
b2 <- 0.2 

a1 <- 0.4
a2 <- -0.5 

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

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

p11 <- 0.8 
p12 <- 0.1
p21 <- -0.2 
p22 <- 0.6

b  <-  matrix(c(1, -b2,
                -b1, 1), nrow=2, byrow=T)
a  <- matrix(c(-a1, 0,
               0, -a2), 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
v <- zeros
for (i in 2:t) {
  l      <- c + d * w[i]  
  v[i,]  <- rnorm(2) %*% t(l)
  u[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]  
}

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

4.2.4 Plots

par(mfrow=c(1,2))

ts.plot(y[,1])
ts.plot(y[,2])

4.2.5 Reduced form parameters

# parameteres of the reduced form
ab <- -a %*% solve(b)
ab
##            [,1]        [,2]
## [1,]  0.4545455  0.09090909
## [2,] -0.3409091 -0.56818182

4.3 Least-Squares Estimator

Use the model in matrix notation across observations i.

# dimensions
m <- ncol(y);m
## [1] 2
t <- nrow(y);t
## [1] 2000
k <- ncol(x);k
## [1] 2
# stack regressands and regressors
Y <- as.vector(y) # stack y over observations
length(Y)
## [1] 4000
X <- diag(m) %x% x # stack x over observations
dim(X)
## [1] 4000    4
# estimation
lm.res <- lm(Y ~ X - 1)
lm.res$coefficients
##          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
u <- matrix(lm.res$residuals, ncol = m)
dim(u)
## [1] 2000    2
Sig.u <- 1/t * t(u) %*% u
Sig.u
##           [,1]     [,2]
## [1,] 10.861852 7.894577
## [2,]  7.894577 9.537205
# comoare with reduced form parameters for simmulation
# ???

4.4 Sample Distribution of Least-Squares Estimator

Use the model in matrix notation across observations i.