[R] geeglm error NA/NaN/Inf in 'y'

Brant Inman brant.inman at me.com
Sat Mar 1 18:51:33 CET 2014


R-helpers:

I am getting an error when trying to fit a GEE model.  Below is code reproducing the error.

###
library(foreign)
muscatine <- read.dta('http://www.hsph.harvard.edu/fitzmaur/ala2e/muscatine.dta')
  muscatine$gender <- as.factor(muscatine$gender)
  muscatine$y      <- as.factor(muscatine$y)
  muscatine$cage   <- muscatine$age - 12
  muscatine$cage2  <- muscatine$cage^2
head(muscatine); summary(muscatine)
muscatine2 <- na.omit(muscatine);  summary(muscatine2)  # Remove missing data

# GEE model to reproduce example in Fitzmaurice, Laird, Ware book
library(geepack)

f1 <- geeglm(y ~ gender*cage + gender*cage2, id=id, data=muscatine2, 
          family=binomial(link=logit), 
          waves=occasion, corstr='unstructured')
###

This gives me the following error

> f1 <- geeglm(y ~ gender*cage + gender*cage2, id=id, data=muscatine2, 
+           family=binomial(link=logit), 
+           waves=occasion, corstr='unstructured')
Error in lm.fit(zsca, qlf(pr2), offset = soffset) : NA/NaN/Inf in 'y'
In addition: Warning messages:
1: In model.response(mf, "numeric") :
  using type = "numeric" with a factor response will be ignored
2: In Ops.factor(y, mu) : - not meaningful for factors

###

I would tremendously appreciate any help that could explain why I am getting this error as I am not understanding this.

Brant 



More information about the R-help mailing list