[R] ERROR NaNs produced; when comparing two logistic regression models with the ANOVA CHI test
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Feb 22 15:58:03 CET 2005
You need the models to be NESTED for this test to be valid. Look up
`analysis of deviance' in your textbooks.
You get the error because you have two unnested models with the same
number of parameters, so the F numerator is divided by 0. (But this is
merely a symptom of incorrect usage.)
On Tue, 22 Feb 2005, Jan Verbesselt wrote:
> Dear R-list,
>
> *When comparing two logistic regression models with the anova CHi test, I
> obtain the following error: (there are no NA's in the time series). How can
> this be solved such that I can compare two models on the same dataset were
> different explanatory variables are used?
>
>
> l.KBDI <- glm(zna.arson2 ~ zna.KBDI,family = binomial)
> l.NDWI <- glm(zna.arson2 ~ zna.NDWI,family = binomial)
>
> anova(l.KBDI,l.NDWI, test = "Chi")
>
>
> Analysis of Deviance Table
>
> Model 1: zna.arson2 ~ zna.KBDI
> Model 2: zna.arson2 ~ zna.NDWI
> Resid. Df Resid. Dev Df Deviance P(>|Chi|)
> 1 110 123.227
> 2 110 113.593 0 9.635
> Warning message:
> NaNs produced in: pchisq(q, df, lower.tail, log.p)
>
>
> *Is this caused by the non-linearity of the data?
> *How can I obtain a p-value?
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list