Am 22.07.2022 um 18:20 schrieb Riccardo (Jack) Lucchetti:
On Fri, 22 Jul 2022, Sven Schreiber wrote:
> (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.
I believe this is basically
one part of the point I'm trying to make.
The standard error, however are not.
And this strikes me as the standard result when you run IV explicitly in
two stages, that you would need to adjust the second stage in that respect.
Here's in hansl form what I have in mind:
<hansl-add-to-Jacks-script>
# just weight everything
series w_factor = sqrt(wt / mean(wt))
loop foreach i const y x z1 z2
series $i_w = w_factor * $i
endloop
list Xw = const_w x_w
list Zw = const_w z1_w z2_w
tsls y_w Xw ; Zw --no-tests
</hansl-add-to-Jacks-script>
The coefficients agree exactly with those from your function.
Now, I haven't cross-checked the standard errors there with Stata or
anything. I tend to think they should be right, but I'm not certain.
Maybe you could have another look.
thanks
sven