Skip to content
Prev 19450 / 20628 Next

R-sig-mixed-models Digest, Vol 176, Issue 4

Dear Philip , Thierry, Ben and other list followers,

Thanks for your response.
Maybe the following codes can help you get a feel of the data that I am using, due to working in a cloud server I cannot share the real data I use. I also shared the latest models formula I tried to run but every time I have convergence problems :-(

set.seed(1)
df<-data.frame(id=rep(1:3,each=4),treatment=sample(c(0,1),12,replace = T),
               event=sample(c(0,1),12,replace = T),
               person.time=sample(c(15,31,30),12,replace = T),
               age=rep(c(65,58,74),each=4),gender=rep(c("m","f","m"),each=4))
df$person.time<-ave(df$person.time,df$id,FUN = cumsum)
df$logtime<-log(df$person.time)
# codes for model:
library(lme4)
nbm<-glmer.nb(event~treatment+age+gender+offset(logtime)+(1|id),df,glmerControl(optCtrl = list(maxfun=50)),verbose = T)
#END.


Please note that in data an individual can have multiple events over time and the treatment is a time variant variable; in real data I do not have complete separation problem.

Bests, Amir