[R] ERROR NaNs produced; when comparing two logistic regression models with the ANOVACHI test

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.ac.be
Tue Feb 22 16:02:30 CET 2005


these models are not nested and thus LRT should not be used. You get 
no p-value because Df=0 in your case. As an alternative you could look 
at the deviances.

I hope it helps.

Best,
Dimitris

p.s., you referred to `non-linearity of the data' if you mean that the 
probability of positive responses is a nonlinear function of your 
explanatory variables then you could use splines to model it (see 
e.g., at function `lrm()' from the Design package).

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Jan Verbesselt" <Jan.Verbesselt at agr.kuleuven.ac.be>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, February 22, 2005 3:19 PM
Subject: [R] ERROR NaNs produced;when comparing two logistic 
regression models with the ANOVACHI test


> 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?
>
>
> Thanks,
> Jan
>
> _______________________________________________________________________
> ir. Jan Verbesselt
> Research Associate
> Lab of Geomatics and Forest Engineering K.U. Leuven
> Vital Decosterstraat 102. B-3000 Leuven Belgium
> Tel:+32-16-329750   Fax: +32-16-329760
> http://gloveg.kuleuven.ac.be/
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list