[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: matrix problems

From   Dennis Coates <>
Subject   st: matrix problems
Date   Thu, 07 Feb 2008 10:32:49 -0500

Hi statalisters,

I am trying to program the Chernozhukov-Hansen Wald statistics for robust inference with weak instruments with overidentification. I get estimates, compute variance covariance matrices and the various adjustments, and then compute the Wald statistic. The end results are Wald statistic values I don't believe (values in the hundreds of thousands). I am running Stata 8, Intercooled.

Z is the matrix of excluded instruments
netY is the value of the variable to be explained minus the value of the endogenous explanatory variable multiplied by the value of its hypothesized coefficient
V is the residual from the first stage regression
epsilon is the residual from the second stage regression

Here is the code I use to construct the Wald statistic (equation 13 from Chernozhukov-Hansen 2005):

matrix sev = (1/(rowsof(Z)))*Z'*netY*V'*Z

matrix see = (1/rowsof(Z))*Z'*epsilon*epsilon'*Z
matrix seeinv = inv(see)

matrix delta = seeinv*Z'*stddevgrgsp - seeinv*sev*seeinv*Z'*netY

matrix Ztild = Z*delta

matrix Wklm = netY'*Ztild*syminv(delta'*see*delta)*Ztild'*netY


The value of Wklm turns out very implausible, so I examined the see, and seeinv matrices. Below is what I got.

. matrix list see

symmetric see[3,3]
c1 c2 c3
r1 195.5102
r2 27.943648 3.9938963
r3 -67.939952 -9.71044 23.609187

. matrix list seeinv

symmetric seeinv[3,3]
c1 c2 c3
r1 .00511482
r2 0 0
r3 0 0 0

Obviously, the product of see and seeinv does not produce an identity matrix. Using syminv to create the inverse matrix did not resolve matters.

I will appreciate any guidance.

Dennis Coates

Dennis Coates
Professor of Economics
1000 Hilltop Circle
Baltimore, MD 21250

phone: 410-455-3243

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index