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: ivtobit with lagged dummy variables as instruments


From   Charles Koss <hqtiger@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: ivtobit with lagged dummy variables as instruments
Date   Thu, 14 Apr 2011 10:18:04 -0500

Thank you Dr. Cox for the advice.

Charles

On Thu, Apr 14, 2011 at 9:18 AM, Nick Cox <njcoxstata@gmail.com> wrote:
> You don't need scalars for your example, as I explained.
>
> Your name -minv- was your choice. You could use one character names. I
> agree: evocative names are often better.
>
> The only reason to use -scalar()- is to avoid name conflict with
> variables. It is easy enough to use some personal convention that
> always avoids any clashes. Thus, you could decide that variable names
> are always lower case, scalar names always upper case.
>
> So the call could be as short as
>
> `= S'
>
> Nick
>
> On Thu, Apr 14, 2011 at 3:06 PM, Charles Koss <hqtiger@gmail.com> wrote:
>> Dr. Cox, thank you for the follow up in the side issue of this thread.
>> Now I wonder, is there a faster way to give reference to scalars in
>> stata? In addition to the scalar's name, 11 caracters had to be typed
>> for it { `= scalar(minv)'  }, way too much!
>>
>> Charles
>>
>>
>> Charles Koss
>> http://charlesonnet.blogspot.com
>>
>> clear
>> webuse laborsup
>> describe
>> ivtobit fem_inc fem_educ kids (other_inc = male_educ), ll(12) twostep
>>
>> summ other_inc
>> drop in 298 //delete inf. obs.
>> hist other_inc //histogram
>> summ other_inc
>> scalar minv = r(sd) //censoring
>> display minv
>> ivtobit fem_inc fem_educ kids (other_inc = male_educ), ll(`r(sd)') twostep
>> ivtobit fem_inc fem_educ kids (other_inc = male_educ), ll(`=
>> scalar(minv)') twostep
>>
>>
>> On Wed, Apr 13, 2011 at 9:07 AM, Nick Cox <njcoxstata@gmail.com> wrote:
>>> Charles's post raised a side issue.
>>>
>>> Instead of
>>>
>>> summ other_inc
>>> scalar minv = r(min)
>>> display minv
>>> ivtobit fem_inc fem_educ kids (other_inc = male_educ), ll(.70566559) twostep
>>>
>>> you can just enter r(min) directly, as it has a local macro persona.
>>>
>>> summ other_inc
>>> ivtobit fem_inc fem_educ kids (other_inc = male_educ), ll(`r(min)') twostep
>>>
>>> Alternatively, if you were using a scalar, you need to evaluate it on the fly
>>>
>>> ... ll(`= scalar(minv)') ...
>>>
>>> See help for -macro-. That way, the expression
>>>
>>> scalar(minv)
>>>
>>> is evaluated before -ivtobit- looks at its input, so it just sees the
>>> numeric result.
>>>
>
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index