[R] Gee

anafava@uiuc.edu anafava at uiuc.edu
Wed Aug 18 23:54:27 CEST 2004


I am trying to learn the gee function in R. So I try to 
generate some data and use this function. I have the 
following lines:

######################################## Gee

# Generating lny=10+2*Si-Si^2+eta
# eta ~ N(0,1)
# Si ~ U(0,11)

eta <- vector(mode="numeric",100)
eta <- rnorm(100)

Si <- vector(mode="numeric",100)
Si <- runif(100, min=0, max=11)

lny <- vector(mode="numeric",100)
lny <- 10+2*Si-Si^2+eta

id <- vector(mode="numeric",100)
id <- (1:100)


cons <- vector(mode="numeric",100)
for(i in 1:100) {
cons[i] <- 1
}

Si2 <- vector(mode="numeric",100)
for(j in 1:100) {
Si2[j] <- Si[j]^2
}

geedat <- data.frame(Si=Si,Si2=Si2,lny=lny,id=id,cons=cons)

lnyhat <- gee(lny~cons+Si-Si2, id=id, data=geedat, na.action)

And I received the following error message:

[1] "Beginning Cgee S-function, @(#) geeformula.q 4.13 
98/01/27"
Error in "[.data.frame"(structure(list(lny = c
(9.92388214744737, 2.54332321404939,  : 
        invalid subscript type

I don't know what I am doing wrong. May someone help me?

Thanks
Ana




More information about the R-help mailing list