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   Mon, 12 Oct 2009 14:11:36 +0200

<> 

" but I don't know any reason at all why local macros should die at the end of a line."


Well, Misha told us that he highlighted " ... a line of the do-file and hit the "do
selected lines" button". That being the case, any -macro- defined in that very line he just executed dies at the end of the line...




HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag von Nick Cox
Gesendet: Montag, 12. Oktober 2009 14:11
An: [email protected]
Betreff: RE: st: How to implement Wald estimator (for IV that is a ratio of coefficients)?

Martin is clearly right to emphasise that local macros are local (to the program, do-file, do-file editor contents or interactive session in which they are defined) but I don't know any reason at all why local macros should die at the end of a line. 

Nick 
[email protected] 

Martin Weiss

-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'"...

Misha Spisok

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.


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