| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: problems with e(sample)
If you -preserve- before you do the regression, then your e(sample)
won't be preserved as it wasn't there, so when you hit -restore- the
ereturn values got zapped.
You may want to watch out for -discard- too. I had similar problems
looking for the ereturn values, not knowing that I had wiped the slate
clean as I try desperately to save some memory space for running more
regressions.
On 6/16/06, Zurab Sajaia <[email protected]> wrote:
I found the cause of problem, -restore- works after setting all the ereturns
and it clears e(sample) leaving other parameters unchanged.
"esample(varname) specified with ereturn post or repost gives the name of
the 0/1 variable indicating the observations involved in the estimation.
The variable is removed from the data but is available for use as
e(sample);"
This is what they say in the help so it's still unclear to me why e(sample)
disapeares after restoring original data...
>From: Richard Williams <[email protected]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: Re: st: problems with e(sample)
>Date: Fri, 16 Jun 2006 18:21:40 -0500
>
>At 04:22 PM 6/16/2006, Zurab Sajaia wrote:
>>Hi all,
>>
>>I ecountered a problem with disapearing e(sample) and couldn't find what
>>can be wrong:
>>
>>I have an eclass program, which sets leaves some ereturn parameters as
>>well as setting e(sample)
>>
>>program myprogram, eclass
>>
>>...
>>ereturn post, esample(`touse')
>>ereturn local cmd="myprogram"
>>...
>>
>>count if e(sample)
>>end // myprogram
>>
>>When I run the program -count- within the program displays correct number
>>but if I write
>>.count if e(sample) from command line, it returns 0. Somehow e(sample)
>>gets cleared although other parameters, for example e(cmd) still contains
>>"myprogram".
>
>We might need to see a little more code here. Here is my version of
>myprogram.ado:
>
>program myprogram, eclass
> tempvar touse
> gen `touse' = 1
> ereturn post, esample(`touse')
> ereturn local cmd="myprogram"
> count if e(sample)
>end
>
>Here it is in action:
>
>. sysuse auto
>(1978 Automobile Data)
>
>. myprogram
> 74
>
>. count if e(sample)
> 74
>
>So, it seems to work fine for me. i also tried
>
>gen `touse' = foreign
>
>and that worked fine too, yielding counts of 22. So, I don't think there
>is an inherent problem, but something else in your code may be zapping
>things.
>
>
>-------------------------------------------
>Richard Williams, Notre Dame Dept of Sociology
>OFFICE: (574)631-6668, (574)631-6463
>FAX: (574)288-4373
>HOME: (574)289-5227
>EMAIL: [email protected]
>WWW (personal): http://www.nd.edu/~rwilliam
>WWW (department): http://www.nd.edu/~soc
>
>*
>* For searches and help try:
>* http://www.stata.com/support/faqs/res/findit.html
>* http://www.stata.com/support/statalist/faq
>* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
--
Ada Ma
Research Fellow
Health Economics Research Unit
University of Aberdeen, UK.
http://www.abdn.ac.uk/heru/
Tel: +44 (0) 1224 553863
Fax: +44 (0) 1224 550926
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/