The names of the levels in a factor variable matter

201 Views Asked by At

I have fitted an lme model using a factor variable studytreat. It appears in the model in two places, as a fixed effect, and also to model heterogeneity in the residual variance so that each level of studytreat has its own variance. This is the model:

modelLME <- lme(logkp ~ studytreat, 
                random = ~ -1 + STUDY | ptno, 
                weights = varIdent(form = ~1 | studytreat))

I have a problem which doesn't fill me with confidence in lme! If I label the levels in studytreat as 11, 12, 21, 24 (in that order) then the function works fine. However, if I switch the numbers around to get 11, 21, 12, 42 then when I call summary(modelLME)$apVar I get the error message:

[1] "Non-positive definite approximate variance-covariance"

Does anyone have any idea why this should make a difference?

0

There are 0 best solutions below