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

From |
Maarten buis <maartenbuis@yahoo.co.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Logistic regression |

Date |
Fri, 24 Oct 2008 15:38:39 +0100 (BST) |

--- Charles Chasela <Charles.Chasela@ucd.ie> wrote: > In doing a logistic regression, after storing A and B to do a > Likelihood ratio test lrtest A B, it said there is a difference in > the population in the two variables 884 vs 885. > > Is there anything I can do to deal with the problem. The most likely cause is missing data. Stata will ignore an observation if any of the variables in the model contains a missing value. So if you leave out a variable that contains missing data then your sample (not population) is likely to increase as Stata won't ignore those observations with missing values on the variable you left out. The example below reproduces this problem. *-------- begin example ------------ sysuse auto, clear logit foreign mpg rep78 est store a logit foreign mpg est store b lrtest a b *-------- end example -------------- (For more on how to use examples I sent to the Statalist, see http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html ) If you type -count if missing(rep78)- you will see that rep78 contains 5 missing values. The easiest solution is to restrict your sample to only those with complete observations in all variables of the most complete model. The example below shows two ways of doing that: *------------ begin example ------------- sysuse auto, clear logit foreign mpg rep78 est store a logit foreign mpg if e(sample) est store b lrtest a b sysuse auto, clear logit foreign mpg rep78 est store a logit foreign mpg if !missing(rep78) est store b lrtest a b *--------------- end example -------------- (For more on how to use examples I sent to the Statalist, see http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html ) Hope this helps, Maarten ----------------------------------------- Maarten L. Buis Department of Social Research Methodology Vrije Universiteit Amsterdam Boelelaan 1081 1081 HV Amsterdam The Netherlands visiting address: Buitenveldertselaan 3 (Metropolitan), room N515 +31 20 5986715 http://home.fsw.vu.nl/m.buis/ ----------------------------------------- * * 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/

**References**:**Re: st: Logistic regression***From:*Charles Chasela <Charles.Chasela@ucd.ie>

- Prev by Date:
**Re: st: suggested references about the variables to include in zero-inflated portion of zinb?** - Next by Date:
**st: RE: RE: St: replace in** - Previous by thread:
**Re: st: Logistic regression** - Next by thread:
**Re: st: Logistic regression** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |