On Fri, 22 Jul 2022, Sven Schreiber wrote:
But in generic terms of weighted IV estimation, I'm not convinced
that
this is so complicated. For example, Stata's doc for ivregress just
laconically says, (paraphrased) "if you have weights just squeeze in
this D matrix and you'll be fine".
(See here:
https://www.stata.com/manuals13/rivregress.pdf, p.12 -
specifically, "X_1'X_1, X'X, X'y, y'y, Z'Z, Z'X, and Z'y
are replaced
with [always a D in the middle]", where D is a diagonal matrix with
normalized weights.)
So isn't this the same as multiplying everything (X_1, X_2, Y, y; in
Stata's notation) with the square roots of the normalized weights and
then doing standard IV? Just like WLS amounts to multiplying everything
with the root of the weight and then running OLS.
Yes, R2 has to be treated specially, but the rest?
Since you mentioned Stata, I thought I'd try a little numerical experiment
on my earlier conjecture, and, surprisingly enough, it appears that I was
right: if you run 2-step estimation substituing wls for ols, the
coefficient estimates are exactly spot-on. The standard error, however are
not. Here's my example script:
<hansl>
set verbose off
function void wtsls(series wt, series depvar, list reg, list inst)
scalar k = nelem(reg)
list exo = reg && inst
list endo = x - exo
list U = null
series resc_w = wt/mean(wt)
loop foreach i endo
wls wt $i inst --quiet
u_$i = $uhat
U += u_$i
endloop
wls resc_w depvar reg U --quiet --robust
b = $coeff[1:k]
v = $vcv[1:k, 1:k]
cs = b ~ sqrt(diag(v))
pn = varnames(reg)
modprint cs pn
end function
nulldata 128
y = normal()
x = normal()
z1 = normal()
z2 = normal()
wt = exp(normal())
list X = const x
list Z = const z1 z2
/*
tsls y X ; Z
foreign language=stata --send-data
ivreg y (x=z1 z2)
end foreign
*/
wtsls(wt, y, X, Z)
foreign language=stata --send-data
ivreg y (x=z1 z2) [pweight=wt]
end foreign
</hansl>
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------