I am constructing a multiple linear regression of the effect of temperature (T_irrad), dose (rdose) and reading wavelength (wvl) on the optical density of dosimeters (od) using lme. The full model is:
h1 <- lme(od-1 ~ t_irrad + wvl + rdose + t_irrad\*wvl + t_irrad\*rdose + rdose\*wvl +
t_irrad\*rdose\*wvl, method="ML", random = ~ 1 | rep, data = HD1)
This runs without error. I wish to improve and simplify the model by stepwise elimination of non-significant factors. The first step is to remove the three way interaction term:
h2 <- lme(od-1 ~ t_irrad + wvl + rdose + t_irrad\*wvl + t_irrad\*rdose + rdose\*wvl,
method="ML", random = ~ 1 | rep, data = HD1)
and then test the model quality by ANOVA:
anova(h1, h2)
which gives the output:
Model | df | AIC | BIC | logLik | Test | L.Ratio | p-value | |
---|---|---|---|---|---|---|---|---|
h2 | 1 | 15 | -6002.122 | -5927.295 | 3016.061 | |||
h3 | 2 | 12 | -6003.097 | -5943.236 | 3013.549 | 1 vs 2 | 5.024561 | 0.17 |
The next step is to remove the factor wvl*rdose interaction term:
h3 <- lme(od-1 ~ t_irrad + wvl + rdose + t_irrad\*wvl + t_irrad\*rdose,
method="ML", random = ~ 1 | rep, data = HD1)
The lme runs without error, but when I run anova(h2, h3)
I get the error message:
Error in adjustSigma && object$method == "ML" : invalid 'x' type in 'x && y'
I have run exactly the equivalent procedure on another data set (another model of dosimeter) with the same predictors. The factors removed are different but otherwise it is the identical procedure and works all the time.
Can anyone explain why the ANOVA failed, what the message means and how I might resolve this?
Thank you