I have a mixed model of several different variables that I would like to run a boxcox function on to get an idea of the appropriate lambda value. After some research I found that the coxme
function may be more appropriate for a mixed model. I keep getting errors when attempting to run the coxme function on my model.
Here is my original attempt:
coxme(lmer(WAKDE~
Avg.AS.Temp+
Avg.Temp.Seasonality+
Avg.PPT.Seasonality+
Avg.Winter.PPT+
Avg.Summer.PPT+
Avg.MSAVI2+
Avg.Timelag.MSAVI2+
Avg.Timelag.winter.PPT+
Avg.Timelag.summer.PPT+
Avg.TRI+
(1|Site/ID),data=Env.HR))
This resulted in the following errors:
boundary (singular) fit: see help('isSingular')
Error in if (n == 0) stop("No observations remain in the data set") :
argument is of length zero
After some researching I managed to find this workaround
coxme(lmer(WAKDE~
Avg.AS.Temp+
Avg.Temp.Seasonality+
Avg.PPT.Seasonality+
Avg.Winter.PPT+
Avg.Summer.PPT+
Avg.MSAVI2+
Avg.Timelag.MSAVI2+
Avg.Timelag.winter.PPT+
Avg.Timelag.summer.PPT+
Avg.TRI+
(1|Site/ID),data=Env.HR,
lmerControl(optimizer ='optimx',
optCtrl=list(method='nlminb'),
check.conv.singular = .makeCC(action = "ignore", tol = 1e-4))))
Which gave me the following error:
Error in if (REML) p else 0L : the condition has length > 1
This led me to my current attempt:
coxme(lmer(WAKDE~
Avg.AS.Temp+
Avg.Temp.Seasonality+
Avg.PPT.Seasonality+
Avg.Winter.PPT+
Avg.Summer.PPT+
Avg.MSAVI2+
Avg.Timelag.MSAVI2+
Avg.Timelag.winter.PPT+
Avg.Timelag.summer.PPT+
Avg.TRI+
#Site+
(1|Site/ID),data=Env.HR,
REML=FALSE,
lmerControl(optimizer ='optimx',
optCtrl=list(method='nlminb'),
check.conv.singular = .makeCC(action = "ignore", tol = 1e-4))))
This code results in the following error:
Error in if (n == 0) stop("No observations remain in the data set") :
argument is of length zero
And I can't seem to find a fix for this one. Any ideas about how to fix it, or if there's a more appropriate way to estimate a lambda value for a mixed effects model? Thanks!