Statalist


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

AW: st: How to implement Wald estimator (for IV that is a ratio of coefficients)?


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: How to implement Wald estimator (for IV that is a ratio of coefficients)?
Date   Sun, 11 Oct 2009 22:41:26 +0200

<> 

-local-s are what you would guess from their very name: local. I.e., they are local to your Stata session, or to a do-file you execute. If you do this line-by-line, they die at the end of the line. So you have to use -global-s or execute the whole thing.

-local-s also do not take data type assignments such as "double". You can say 


*************
local double a 1
*************

but then you have created a -local- with name "double" that contains the string "a 1": Not at all what you wanted. Type "ma di" to see all -macro-s at any time...

As you would guess, there is an article by Nick on the subject, but the SJ archive does not answer my calls today. I always get " Query failed: Incorrect information in file: './statajournal/main.frm'"...


HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag von Misha Spisok
Gesendet: Sonntag, 11. Oktober 2009 22:36
An: [email protected]
Betreff: Re: st: How to implement Wald estimator (for IV that is a ratio of coefficients)?

Thank you, Professor Nichols--this answers a question I didn't ask but
was at the back of my mind.  The formula I noted neglected any
possible covariance--is this the problem that arises in the context of
using two separate estimations on a single dataset?

I have two follow-up questions, one statistics-related and one Stata-related.

1. If I follow the -suest- in your example with the following:

. nlcom [r1_mean]_b[nearc4]/[r2_mean]_b[nearc4]

Does this give me the "correct" standard error?  If so, is the
difference (0.00001913) due to rounding?  I attempted to use doubles
in the code you provided, e.g., local double b1=_b[nearc4], but then I
can't even find a workaround to the problem in my second question.
When I get to

. di `b1'/`b2'*sqrt((`s2'/`b2')^2+(`s1'/`b1')^2-2*`c'/`b1'/`b2')

I get the error,

1572375310669762 invalid name

2. When I "do" (i.e., highlight a line of the do-file and hit the "do
selected lines" button) each line of code from a do-file editor, then
when I get to

di `b1'/`b2'

I get the error

invalid syntax

I (obviously to you probably, but not to me) don't have this problem
if I either (i) do the entire do-file at once or (ii) enter contents
interactively, line-by-line.  I do, however, have a similar problem,
as mentioned in my first question, if I change the local assignment to
a "local double" assignment.

I apologize for any imprecision or incorrect use in my terminology
about locals, doubles, etc.

Thank you again for your time and attention.

Best,

Misha


On Sun, Oct 11, 2009 at 6:22 AM, Austin Nichols <[email protected]> wrote:
> Misha--
> If both equations are estimated in the same data (i.e. you are not
> using a two-sample IV procedure), you should use -ivreg- or
> -ivregress- or -ivreg2- (on SSC) instead.  The approximate standard
> error formula for the two separate estimations on one dataset is not a
> good substitute for the one given by an IV estimator:
>
> use http://pped.org/card.dta
> reg lwage exper nearc4, nohe r
> loc b1=_b[nearc4]
> loc s1=_se[nearc4]
> reg educ exper nearc4, nohe r
> loc b2=_b[nearc4]
> loc s2=_se[nearc4]
> ivreg lwage exper (educ=nearc4), nohe r
> di `b1'/`b2'
> di `b1'/`b2'*sqrt((`s2'/`b2')^2+(`s1'/`b1')^2)
>
> qui reg lwage exper nearc4
> est sto r1
> qui reg educ exper nearc4, nohe
> est sto r2
> suest r1 r2
> mat v=e(V)
> matrix cov=v["r1_mean:nearc4","r2_mean:nearc4"]
> loc c=cov[1,1]
> di `b1'/`b2'*sqrt((`s2'/`b2')^2+(`s1'/`b1')^2-2*`c'/`b1'/`b2')
>
>
> On Sat, Oct 10, 2009 at 3:44 PM, Misha Spisok <[email protected]> wrote:
>> Stas,
>>
>> Many thanks (большое спасибо), not just for solving this problem but
>> introducing me to another command in Stata.
>>
>> Misha
>>
>> On Fri, Oct 9, 2009 at 9:39 PM, Stas Kolenikov <[email protected]> wrote:
>>> See if you can get your standard error via -nlcom- after -reg3-. I
>>> would guess that's the most appropriate estimation method, and -nlcom-
>>> is certainly the most appropriate method to deal with the
>>> delta-method, Stata way.
>>>
>>> On Fri, Oct 9, 2009 at 8:21 PM, Misha Spisok <[email protected]> wrote:
>>>> Hello, Statalist!
>>>>
>>>> In short, does -ivregress- (or -reg3-) include what I think is called
>>>> the Wald estimator?  If so, how can I implement it for a problem like
>>>> the one below?  I've searched for a command for the Wald estimator,
>>>> but can only find references to Wald _tests_.
>>>>
>>>> I am considering a model similar to Ashenfelter and Greenstone (2004)
>>>> with two reduced-form equations, the estimates of which are used to
>>>> find an instrumental variable estimator in a third equation, the one
>>>> of primary interest.
>>>>
>>>> My question is, how can I do this in Stata in one fell swoop?
>>>>
>>>> The two equations are
>>>>
>>>> F = lambda_F*VMT + PI_F*1(65mph limit in force) + epsilon
>>>> H = lambda_H*VMT + PI_H*1(65mph limit in force) + epsilon'
>>>>
>>>> where 1(.) is an indicator variable which I'll call "65mph" below.
>>>>
>>>> The equation of interest is
>>>>
>>>> H = beta*VMT + theta*F + nu
>>>>
>>>> The parameter of interest is theta.  From the estimate of the reduced
>>>> form equations the IV for theta, theta_IV, is
>>>>
>>>> theta_IV = (PI_H)/(PI_F)
>>>>
>>>> Given estimates of PI_H and PI_F (as presented in the paper), one can
>>>> form the corresponding theta_IV.  It seems that the authors use a
>>>> formula for the standard error of theta_IV like the following:
>>>>
>>>> se_theta = theta_IV*sqrt((se_PI_H/PI_H)^2 + (se_PI_F/PI_F)^2)
>>>>
>>>> I tried doing this in the following ways, but the results are not the
>>>> same.  I wouldn't expect them to be, but I can't find a reference for
>>>> Wald estimator in Stata, so I thought I'd try it.
>>>>
>>>> Method 1:
>>>> . reg F VMT 65mph
>>>> . reg H VMT 65mph
>>>> Calculate theta_IV from coefficients on 65mph in the above equations.
>>>>
>>>> Method 2:
>>>> . ivregress 2sls H VMT (F 65mph)
>>>> Hope that theta_IV would be the coefficient on F.
>>>>
>>>> Method 3:
>>>> . reg3 (F VMT 65mph) (H VMT F)
>>>> Hope that theta_IV would be the coefficient on F in the equation for H.
>>>>
>>>> What is the correct way to get this ratio of coefficients (theta_IV =
>>>> (PI_H)/(PI_F)) and its standard error all at once in Stata?
>>>>
>>>> Thanks,
>>>>
>>>> Misha
>
> *
> *   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/
>

*
*   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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index