Convert mixed linear model from lmer to lme to create model with equal variances for fixed effect

I am currently working with mixed linear models, with which I want to compare whether variance between two methods is statistically different.

This is my model code (using lmer package):

model_a <- lmer(grootte ~ 1 + methode + (1|pnummer) + (1|endoscopist) + (0+methode|endoscopist), data = scale_dataset_methode_1_2, control = lmerControl(optimizer = "bobyqa"))

I used the "bobyqa" optimizer to solve the failure to convergence problems. To test whether the (residual) variance (obtained by the model above) is statistically different between the two methods (variable 'methode'), I want to fit the same model twice: once assuming that the residual variances of the methods are similar, and once allowing method-specific variance. Subsequently, I will compare the Akaike's information criterion (AIC) values of the models using a X2- distribution with one degree of freedom to test statistical difference (code below).


However, I am struggling to design the two models. If I want to create a model which presumes that variance of the methods is equal. What would be the best way to do so with lmer? Alternatively, I could possibly use the weight = varIdent function from the lme function of the nlme package. However, I struggle to convert my lmer code to a working lme model. I tried the code as underneath.

fitted_model <- lme(grootte ~ methode, random = list(pnummer = pdBlocked(list(1)), endoscopist = pdBlocked(list(1 + methode))), data = scale)

I do however keep getting the following error:

Error in pdConstruct.pdBlocked(object, value, form, nam, data, pdClass) : must have formula when no names are given

I can't find a solution.. Does anyone know a solution using either the lmer or the lme functions? Any help would be very welcome! Thank you.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.