Statalist


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

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


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: AW: Return results only from observations used in estimated model
Date   Mon, 5 Oct 2009 12:37:50 +0100

See also

SJ-7-2  dm0030  . . . . . . . . . .  Stata tip 44: Get a handle on your
sample
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B. Jann
        Q2/07   SJ 7(2):266--267                                 (no
commands)
        tip on how to keep track of the observations that make
        up your estimation sample

Nick 
[email protected] 

John Antonakis

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.

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)
 > *************
 
John Antonakis

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

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