Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: error in logistic regression when fitting models


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: error in logistic regression when fitting models
Date   Sun, 06 Feb 2005 20:09:47 -0500

At 07:47 PM 2/6/2005 -0500, [email protected] wrote:
I am using logistic regression with Stata 8.1 to build models for prediction of infection risk. Stata runs the full model. Then, by removing variables (using p<0.2), I create new models, step by step. However, at some moment, after to run the "lrtest" command (in order to fitting both unconstrained and constrained models), Stata accuses an error (number 498) informing that the two last models have different observation numbers. What I have to do? In order to outline this trouble, can you propose me some procedure? It follows a sequence of commands that I am executing and the problem that occurs.
The Ns differ because your variables have differing amounts of missing data; as you drop variables you regain cases. Specifically, asa has missing cases. Since you start with the most complex model first, probably the easiest thing to do is add

if e(sample)

to the end of each logistic regression line after the first, e.g.

xi: logistic SSI i.contamin i.tipoproc i.hospital if e(sample)

Also check the -mark- and -markout- commands.

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* 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