UPDATE - One of the authors of the nlme package wrote the following: Internally the nlme package uses compiled code such as LAPACK which does not have provision for missing values. The results when using na.pass will be unpredictable and invalid.
I am calculating mixed models (linear growth models) with the
nlme package in R for a sample with N = 45 and 10 time points measuring change in health over time. Health (outcome) is measured at all time points, but the predictors are only measured at one time point. I have some missing values in the predictors (10 people have missing values in the predictors) so I decided to use
na.action = na.pass to include all persons. However, the results vary immensely when I conduct small changes that should not change a lot.
My basic function is:
lgm1 <- lme(health ~ predictor*time, data=data1, random= ~time | id, na.action = na.pass, correlation = corAR1())
With this function, the predictor and the
predictor * time interaction are significant. However, when I change the order of the predictors (now:
time * predictor), the result is completely different, there is not even a hint of significance in the predictor, only the interaction stays the same.
When I replace
na.omit, the result is completely different as well (n.s. for all). At least, with
na.omit, the order of the predictors doesn't change the result anymore.
Does anybody know why this happens and how I can deal with it in a good way? What does
na.pass do? I am not sure how to deal with this finding as the differences are huge and I don't want to draw the wrong conclusions from the data.