GLM with random factor in R

3

I need to make a glm in the R, but there is dependence between the data. I was asked to enter this dependency as a random factor in the analysis. But I'm not getting a command for this.

Overview:
- GLM, binomial
- 2 response variables and 2 explanatory variables + random factor.

I've tried this:

modelo1<-glm(cbind(visitas,acertos)~cor_vantajosa*fase,random=~1|id,binomial(link="logit"),data=dados)

Any help is welcome!

    
asked by anonymous 27.06.2014 / 16:25

1 answer

2

You can use the glmer function of the lme4 package.

In your case it should look like this:

modelo <- glmer(cbind(visitas, acertos) ~ cor_vantajosa*fase + (1 | id), data = dados, family = binomial)
    
26.08.2014 / 03:10