Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: clogit:determining number of observations for each level of a categorical variable


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: clogit:determining number of observations for each level of a categorical variable
Date   Mon, 27 Jun 2011 19:10:25 +0100

-findit distinct- also finds other and more recent sources, including 


FAQ     . . . . . . . . . . . . . .  Calculating the number of distinct values
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        9/06    How do I calculate the number of distinct
                values seen so far?
                http://www.stata.com/support/faqs/data/distinctvalues.html

FAQ     . . . . . . . . .  Counting distinct strings across a set of variables
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        7/04    How do I count the number of distinct strings
                across a set of variables?
                http://www.stata.com/support/faqs/data/distinctstrings.html

FAQ     . . . . . . . . . . . . . . . . . . .  Number of distinct observations
        . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox and G. Longton
        4/02    How do I compute the number of distinct observations?
                http://www.stata.com/support/faqs/data/distinct.html

SJ-8-4  dm0042  . . . . . . . . . . . .  Speaking Stata: Distinct observations
        (help distinct if installed)  . . . . . .  N. J. Cox and G. M. Longton
        Q4/08   SJ 8(4):557--568
        shows how to answer questions about distinct observations
        from first principles; provides a convenience command

Nick 
[email protected] 

Jacob Fowles
Sent: 27 June 2011 17:47

I have used the user written command by Longton and Cox named
"distinct" for this exact purpose ("ssc install distinct").  There is
also a Stata FAQ on
this subject that provides some other strategies:

http://www.stata.com/support/faqs/data/distinct.html

On Mon, Jun 27, 2011 at 9:36 AM, Daniel Herbert Opi


> I am new to Statalist and had a question that I hope I can get some
> input on. I am carrying out conditional logistic regression-clogit
> (example below) on a case control study where each case has been
> matched to a control to look at the effect of several independent
> categorical variables (xyz and abc in my example) on a dependent
> variable of disease outcome (disease). The output in stata shows the
> total number of observations used for the analysis (326 in this case)
> but I was wondering whether there is a way of determining the number
> of observations used for each level of the independent categorical
> variables (xyz and abc) since I can already tell some observations (65
> in this case) have been dropped because of having all positive or
> negative outcomes.
>
> . clogit disease i.xyz i.abc, strata (set1) or
> note: 65 groups (65 obs) dropped because of all positive or
>       all negative outcomes.
> Iteration 0:   log likelihood = -107.72902
> Iteration 1:   log likelihood = -107.64854
> Iteration 2:   log likelihood = -107.64852
> Iteration 3:   log likelihood = -107.64852
> Conditional (fixed-effects) logistic regression   Number of obs   =        326
>                                                   LR chi2(4)      =      10.67
>                                                   Prob > chi2     =     0.0305
> Log likelihood = -107.64852                       Pseudo R2       =     0.0472
> ------------------------------------------------------------------------------
>      disease | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
>          xyz |
>           1  |   2.380791    .951431     2.17   0.030      1.08782    5.210571
>           2  |    2.73225    1.09711     2.50   0.012     1.243735    6.002232
>              |
>          abc |
>           1  |   .5346201   .1450661    -2.31   0.021     .3141063    .9099424
>           2  |   .9274642   .3857671    -0.18   0.856     .4104408    2.095771
> ------------------------------------------------------------------------------

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index