I want to plot the random- intercept complementary log-log regression in R, in order to check for unobserved user heterogeneity. I have searched through the internet and books and have only found one solution in Stata, maybe someone can adapt that to R. In Stata there are 2 commands available: 1)xtcloglog for two-level random intercept 2) gllamm for random-coefficient and and higher-levels models
My data relates if activities from people are completed or not and affected by sunshine. Completion is the DV and Sunshine would be the IV, this is a simplified version.
df <- people = c(1,1,1,2,2,3,3,4,4,5,5),
activity = c(1,1,1,2,2,3,4,5,5,6,6),
completion = c(0,0,1,0,1,1,1,0,1,0,1),
sunshine = c(1,2,3,4,5,4,6,2,4,8,4)
so far i use this code for the cloglog:
model<- as.formula("completion ~ sunshine")
clog_full = glm(model,data=df,family = binomial(link = cloglog))
summary(clog_full)
If anyone, also has an idea on how to run this model with a fixed intercept, i am happy to know.
Aucun commentaire:
Enregistrer un commentaire