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 

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to