Statalist


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

AW: st: AW: Return results only from observations used in estimated model


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: AW: Return results only from observations used in estimated model
Date   Sun, 4 Oct 2009 21:36:47 +0200

<> 


As an -ereturn- function, -e(sample)- is "ephemeral", though. If you want it
to stick around, turn it into a binary variable such as

-gen byte estsample1=e(sample)-



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von John Antonakis
Gesendet: Sonntag, 4. Oktober 2009 21:28
An: [email protected]
Betreff: Re: st: AW: Return results only from observations used in estimated
model

Dear Martin and Richard:

Great!

-if e(sample)-

......does the trick!

By table, I wanted to table the frequencies of the categorical 
predictors, i.e.,

table y x z if e(sample), row col sc

Now I get the same number of observations from the table as I did in the 
logistic.

Thanks much.
John.

____________________________________________________

Prof. John Antonakis
Associate Dean Faculty of Business and Economics
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland

Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305

Faculty page:
http://www.hec.unil.ch/people/jantonakis&cl=en

Personal page:
http://www.hec.unil.ch/jantonakis
____________________________________________________



On 04.10.2009 21:21, Martin Weiss wrote:
 > <>
 >
 > Just condition on -e(sample)-. I am not quite sure what "table the 
results"
 > is supposed to mean, though.
 >
 >
 > *************
 >
 > vers 10.1
 >
 > clear*
 > set obs 150
 >
 > gen x1=26+int(27*runiform())
 > gen x2=runiform()<.48
 >
 > gen byte draw = /*
 >  */ runiform() < /*
 >  */ invlogit(1+.02*x1+.3*x2)
 > 
 > logistic draw x*
 >
 > tempvar tem
 > gen `tem'=runiform()
 > sort `tem'
 >
 > drop in 121/150
 >
 > logistic draw x*
 > 
 > table draw if e(sample),  /*
 > */ c(freq mean x1 mean x2)
 > *************
 >
 >
 >
 > HTH
 > Martin
 >
 > -----Ursprüngliche Nachricht-----
 > Von: [email protected]
 > [mailto:[email protected]] Im Auftrag von John 
Antonakis
 > Gesendet: Sonntag, 4. Oktober 2009 21:17
 > An: [email protected]
 > Betreff: st: Return results only from observations used in estimated 
model
 >
 > Hi:
 >
 > Suppose I run a model using logistic on a data set with 150 observations:
 >
 > logistic y x z q r
 >
 > Now, suppose that because of listwise, the number of observations in the
 > logistic model are 120.
 >
 > How would I table the results (using say only variable x and z) based
 > ONLY on the data from the logistic model (i.e., the listwise sample) and
 > not the whole sample ?
 >
 > Thanks in advance,
 > John.
 >

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