Tom
Tom

Reputation: 31

Creating a weight variable in Mixed Effects model using GLMMadapatve to constrain baseline values

I am using GLMMadaptive package (https://cran.r-project.org/web/packages/GLMMadaptive/index.html) to estimate mixed effects hurdle model and wanting to weight the baseline values to be equal at baseline. The code for the model is as follows:


Model1 <- mixed_model(fixed = Y ~ Time + Contrast1 + Contrast2, 
              zi_fixed = ~ 1+Time + Contrast1,
              zi_random = ~ 1 | ID,
              random = ~ 1 | ID,
              weights = varIdent(form = ~ 1 | Time), #Weighting for baseline constraints
              data = data1, 
              na.action = na.omit,
              family = hurdle.poisson())

However, the varIdent(form = ~ 1 | Time) function generates an error for this model, but the same code of lme() model doesn't generate an error.

The error reads quote Error in mixed_model(fixed = Y ~ Time + Contrast1 + Contrast2, : the length of 'weights' does not match with the number of groups in 'data

Is there a way to create the varIdent(form = ~ 1 | Time) weights externally for this type of model?

Upvotes: 0

Views: 9

Answers (0)

Related Questions