set.seed(100)
N = 2000
k = 15
id = rep(1:N,each=k*2)
group = rep(0:1,each=(N/2)*k*2)
cond = rep(0:1,each=k,times=N)
tau = 0.5
b0 = 1
b1 = 0.4
b2 = 0.7
shape = 10
scaleConstant = 100
rInt = rep(rnorm(N,0,tau),each=k*2)
X = b0 + b1*group + b2*cond + rInt
rt = rgamma(N*k*2, shape = shape, scale = scaleConstant*exp(X)/shape)
df = data.frame(id,group,cond,rt)
combin = paste(paste0("group",group),paste0("cond",cond))
df$combin = factor(combin)
df$group = as.factor(df$group)
df$cond = as.factor(df$cond)
modLog_TrueLog = glmmTMB(rt ~ group * cond + (1|id) , family=Gamma(link="log"), data=df)
modIdent_TrueLog = glmmTMB(rt ~ group * cond + (1|id), family=Gamma(link="identity"), data=df)