Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: macro `if' in nonlinear least squares


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: macro `if' in nonlinear least squares
Date   Thu, 2 May 2013 17:34:44 +0200

Apperently the local macro `if' was defined previously and contains
something like "if <some condition>" to determine for which
observations these computations are to be performed. To find that out
you should look at where in that code the macro `if' was defined. If
it is not defined, it will be empty and thus do nothing (other than
confuse you).

-- Maarten


On Thu, May 2, 2013 at 5:27 PM, Francesca Colantuoni
<f.colantuoni9@gmail.com> wrote:
> I am programming a nonlinear least square regression, and I am trying
> to find the best way to do it based on variuos examples that I found
> online.
>
> In the following code, I have trouble understanding what stata does
> with the macro `if' at the end of the generate command. Would anybody
> clarify that for me? I could not find an explanation for this use of
> "if" in either [P] or [U] manual (or Google).
>
> // Some temporary variables
>     tempvar kterm lterm
>     generate double `kterm' = `delta'*`capital'^(-1*`rho') `if'
>     generate double `lterm' = (1-`delta')*`labor'^(-1*`rho') `if'
>
>     // Now fill in dependent variable
>     replace `logout' = `b0' - 1/`rho'*ln(`kterm'+`lterm') `if'
>
> Best Regards,
> Francesca
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/



-- 
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index