GLM with random factor in R

Asked

Viewed 489 times

3

I need to do a glm in R, but there is dependency between the data. I was asked to insert this dependency as a random factor in the analysis. But I’m not getting a command for it.

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

I tried that:

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

Any help is welcome!

1 answer

2

You can use the function glmer package lme4.

In your case it should stay that way:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.