Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: a new robust variance-covariance estimator conditional on covariates


From   Tirthankar Chakravarty <[email protected]>
To   [email protected]
Subject   Re: st: a new robust variance-covariance estimator conditional on covariates
Date   Sun, 30 Oct 2011 07:17:36 -0700

Laszlo,

Based on a very quick look, the standard errors they propose (based on
their (2.8))  are not hard to compute at all - code is below. I have
handled ties arbitrarily, but you can easily change this to your
liking. However, as Tukey, "Far better an approximate answer to the
right question, than the exact answer to the wrong question, which can
always be made precise...."

T

**************************************************************
// Compute and compare the Abadie-Imbens-Zheng
// covariance estimator
sysuse auto, clear
g ones  = 1
g nmiss = !missing(mpg, weight, c.weight#c.weight, foreign)

mata
mata clear

// a function to find the column index of the row minima
real colvector function  minindexmat(real matrix mA) {
	real colvector vReturn
	vReturn = J(rows(mA), 1, .)
	for(i = 1; i<= rows(mA); i++) {
		minindex(mA[i,.], 1, j=., w=.)
		if (!allof(w[,2], 1)) {
			/* uniqueness assumption false; arbitrarily pick one */
			vReturn[i, 1] = j[1, 1]
		}
		else vReturn[i,1] = j
	}
	return(vReturn)
}
// regression
mX = st_data( ., "ones weight c.weight#c.weight foreign", "nmiss")
vY = st_data(., "mpg", "nmiss")
vBeta = lusolve(mX'*mX, mX'*vY)

// standard variance-covariance matrix
vEps = vY - mX*vBeta
dSigmaSqHat = colsum(vEps:^2)/(rows(mX) - cols(mX))
vSE = diagonal(sqrt(dSigmaSqHat*cholinv((mX'*mX))))
vT = vBeta:/vSE  // t-statistics

// White's variance-covariance matrix
vSE2 = diagonal(sqrt(cholinv((mX'*mX))*mX'*
	diag((vEps):^2)*mX*cholinv((mX'*mX))))
vT2 = vBeta:/ vSE2  // t-statistics

// Abadie-Imbens-Zheng variance-covariance matrix
mA = J(rows(mX), 1, 1)#mX'
mB = vec(mX')#J(1, rows(mX), 1)
mC = ((mA - mB):^2)'*I(rows(mX))#J(cols(mX), 1, 1)
_editvalue(mC, 0, .)
vL = minindexmat(mC)

vEpsL = vEps[vL, 1]
mEpsL = vEpsL#J(1, cols(mX), 1)
mXL = mX[vL, .]
mXEpsL = mXL:*mEpsL
mEps = vEps#J(1, cols(mX), 1)
mXEps = mX:*mEps
mDXEps = mXEps - mXEpsL
vSE3 = diagonal(sqrt(0.5*cholinv(mX'*mX)*
	(mDXEps'*mDXEps)*cholinv(mX'*mX)))
vT3 = vBeta:/vSE3  // t-statistics

(vT, vT2, vT3)  // standard, White, AIZ
end
**************************************************************

2011/10/30 László Sándor <[email protected]>:
> Hi,
>
> I would like to get back to using the Abadie-Imbens-Zheng estimator.
> (I did not do a great job with the exposition two days ago.) I would
> be happy with an implementation under Stata 12 on unix (or any
> previous version).
>
> Though David Card advised Guido to relabel the paper "Lower Your
> Standard Errors by 10%!", the paper does make a convincing point that
> a sample does not need to be treated as having random covariates in
> many cases, e.g. when we have the full population (where "errors" or
> noise can come from an imaginary superpopulation, but the covariates,
> like which are the states of the US or the proportion of male in the
> population, are arguably given) or when the subsample is not a random
> subsample of the population anyway ("convenience samples"). These
> arguments are more more common in the program evaluation literature,
> where people often discuss the different estimands of population
> treatment effects or only on the treated etc.
> http://www.nber.org/papers/w17442
>
> So irrespective of the claims of many "modern" graduate econometrics
> textbooks, in some cases the usual Huber-White sandwich/robust
> standard errors are excessively conservative (the immediate response
> to White [1980] did see the point, like Chow [1984].). Abadie, Imbens
> and Zheng suggest an improvement.
>
> I wonder what is a good approach to implement a new VCE in Stata and
> how it is possible to use it across multiple commands. Or I need to
> hack one ado file at a time, and use those?
>
> Any thoughts on this will be greatly appreciated.
>
> Thanks,
>
> Laszlo
>
>
> László Sándor
> PhD candidate in Economics
> Harvard University
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
Tirthankar Chakravarty
[email protected]
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index