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: Conditional logistic regression: how to
From
Liliana Andriano <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Conditional logistic regression: how to
Date
Mon, 18 Nov 2013 10:33:12 +0100
Thank you very much Marta. This makes more sense and Stata returns me
the results, instead of error.
Have a nice journey.
Best,
Liliana
2013/11/18 Marta Garcia-Granero <[email protected]>:
> Ah! Now I see.
>
> Shouldn't your final command be:
>
> mi estimate: clogit _case x1 x2, group(_set)
>
> HTH,
> Marta
>
> El 18/11/2013 10:11, Liliana Andriano escribió:
>
>> Thank you for your reply Marta. The fact is that I need to estimate
>> the fixed effects logit regressions relying on conditional logits,
>> also known as the case-control technique (Chamberlain, 1980), so I
>> should randomly select pairs from each
>> sample, consisting of one death reported during five years preceding
>> the survey and one birth that still survived at the survey time. For
>> this I have realized that the sttocc command in Stata allows you to
>> convert survival-time data to case-control data, but before running
>> it, the declaration of survival data is necessary.
>>
>> Do you know if I randomly select pairs from each sample even though I
>> am not declaring survival data and then converting survival-time data
>> to case-control data?
>>
>> Your help is very appreciated.
>> Many thanks in advance.
>>
>> Best,
>> Liliana
>>
>>
>>
>> 2013/11/18 Marta Garcia-Granero <[email protected]>:
>>>
>>> Hi Liliana:
>>>
>>> Maybe I am missing something, because I'm no Stata expert.
>>>
>>> As a former SPSS user, a program that did not have a specific command for
>>> conditional logistic, I used the well known trick of using survival
>>> analysis
>>> (Cox) instead. Since Stata has -clogit-, I don't think you need to
>>> declare
>>> survival data before running it.
>>>
>>> See this simple example (maybe too simple) where -clogit- and -stcox-
>>> outputs are exactly the same.
>>>
>>> * Sample data from www.hrc.es/bioest/Reglog_9.html (coding for hepat had
>>> to
>>> be reversed!!) *
>>> input hepat alcoh drug stratum
>>> 1 15 1 1
>>> 0 10 0 1
>>> 0 0 0 1
>>> 1 70 1 2
>>> 0 20 0 2
>>> 0 30 0 2
>>> 1 40 1 3
>>> 0 40 0 3
>>> 0 0 0 3
>>> 1 10 0 4
>>> 0 20 1 4
>>> 0 50 0 4
>>> 1 30 1 5
>>> 0 10 0 5
>>> 0 20 0 5
>>> 1 80 0 6
>>> 0 20 0 6
>>> 0 30 0 6
>>> 1 50 1 7
>>> 0 35 0 7
>>> 0 10 0 7
>>> 1 60 1 8
>>> 0 5 0 8
>>> 0 10 0 8
>>> 1 90 0 9
>>> 0 65 0 9
>>> 0 5 0 9
>>> 1 30 1 10
>>> 0 10 0 10
>>> 0 40 0 10
>>> end
>>>
>>> * Using clogit *
>>> clogit hepat c.alcoh i.drug c.alcoh#i.drug, group(stratum) or
>>>
>>> * using Cox *
>>> gen ptime=1+(hepat==0)
>>> stset ptime, failure(hepat==1)
>>> stcox c.alcoh i.drug c.alcoh#i.drug, strata(stratum)
>>>
>>> I hope this helps
>>>
>>> Marta García-Granero, PhD
>>> Dpt. of Biochemistry and Genetics,
>>> University of Navarra
>>>
>>> El 14/11/2013 15:59, liliana escribió:
>>>
>>>> Dear statlist users,
>>>>
>>>> I am trying to run a conditional logistic regression. The analysis
>>>> consists
>>>> of studying the determinants of child mortality. Before running the
>>>> conditional logistic regression I should randomly select pairs from each
>>>> sample, consisting of one death reported during five years preceding the
>>>> survey and one birth that still survived at the survey time. Moreover, I
>>>> have also imputed the missing values of an explanatory variables, which
>>>> means that before the stata command I should insert the mi estimate:
>>>> option.
>>>>
>>>> What I have done in Stata is
>>>>
>>>> set seed 8021
>>>>
>>>> then I have declared my data to be survival data and then
>>>>
>>>> sttocc, match(mortality), where mortality is a dummy variable assuming
>>>> value
>>>> 0 if the child died during five years preceding the survey.
>>>>
>>>> Then I go with:
>>>>
>>>> mi estimate: clogit y x1 x2, group(_set)
>>>>
>>>> Stata tells me that
>>>>
>>>> (regular variables _st _d _t _t0 unregistered because not in m=0)
>>>> groups (strata) are not nested within clusters
>>>> an error occurred when mi estimate executed clogit on m=1
>>>> r(459);
>>>>
>>>>
>>>> May you tell me what's wrong with these commands, please?
>>>>
>>>> Thank you very much.
>>>>
>>>> Best,
>>>> Liliana
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>>
>>>> http://statalist.1588530.n2.nabble.com/Conditional-logistic-regression-how-to-tp7580452.html
>>>> Sent from the Statalist mailing list archive at Nabble.com.
>>>> *
>>>> * For searches and help try:
>>>> * http://www.stata.com/help.cgi?search
>>>> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/