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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Accessing saved results from -xtmelogit- for postestimation calculations


From   Marshall Garland <marshall.w.garland@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Accessing saved results from -xtmelogit- for postestimation calculations
Date   Fri, 12 Aug 2011 08:44:01 -0500

Excellent. This works perfectly.

Thanks, Eric.

-mwg

On Thu, Aug 11, 2011 at 8:58 PM, Eric Booth <ebooth@ppri.tamu.edu> wrote:
> <>
>
> Try running:
>
> **
> estimates esample:  outcome displacement  rep78, replace
> **
>
> before your line:
>
> **
> predict re, reffects level(rep78)
> **
>
> Your example modified with -estimates example-:
>
> ******
> cap rm model_1.ster
> discard
>
> sysuse auto.dta, clear
> *cd "C:\Data"
> gen outcome=0
> replace outcome=1 in 30/74
> xtmelogit outcome displacement || rep78:, variance laplace
> **look at example
> ereturn li
> est stats
> di "`r(N)'"
> count if e(sample)
> estimates esample
> di "`r(who)'"
> **
> estimates save model_1, replace
> **check re:
> predict re, reffects level(rep78)
> su re
>
>
> ///close stata
>
>
> discard
> *cd "C:\Data"
> estimates use model_1.ster
> sysuse auto.dta, clear
> gen outcome=0
> replace outcome=1 in 30/74
> xtmelogit
> **
> est stats
> estimates esample
> estimates esample:  outcome displacement  rep78, replace
> estimates esample
> **
> predict re, reffects level(rep78)
> su re
> ******
> - Eric
>
> On Aug 11, 2011, at 5:05 PM, Marshall Garland wrote:
>
>> Hello-
>>
>> I'm unable to use saved results from -xtmelogit- for postestimation
>> calculations. Results saved using -estimates save- are viewable when I
>> -estimates use- and replay them, but when I attempt to calculate
>> random effects, I get an "r(2000) no observations" error. I do not
>> receive the error when I save and restore estimates from -reg-. I
>> received the error both in Stata 12 MP for Windows and Stata 11 SE on
>> Unix. I suspected that it might have something to do with properly
>> setting the -e(sample)-, but if I include -estimates esample:- before
>> -predict-, I receive a "data have changed since estimation r(459);"
>> error.
>>
>> The syntax below reproduces the error. Has anyone else received this error?
>>
>> Thanks.
>>
>> -Marshall
>>
>> sysuse auto.dta, clear
>> cd "C:\Data"
>> gen outcome=0
>> replace outcome=1 in 30/74
>> xtmelogit outcome displacement || rep78:, variance laplace
>> estimates save model_1, replace
>> ///close stata
>> cd "C:\Data"
>> estimates use model_1.ster
>> sysuse auto.dta, clear
>> gen outcome=0
>> replace outcome=1 in 30/74
>> xtmelogit
>> predict re, reffects level(rep78)
>>
>>
>> ///now, with regress
>> sysuse auto.dta, clear
>> cd "C:\Data"
>> regress price foreign
>> estimates save model_2, replace
>> ///close stata
>> cd "C:\Data"
>> estimates use model_2.ster
>> sysuse auto.dta, clear
>> regress
>> predict b
>> *
>> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index