I fitted a linear mixed effects model using nlme package for aids dataset.
Here, CD4 is the CD4 cell count, obstime is the time of observation, and patient is the patient id.
My linear mixed effects model looks like this:
lmeFIT <- lme(CD4 ~ obstime, random = ~ 1|patient, data=aids_train)
I have split my dataset into training and testing set where, my testing set consists of data from 2 subjects and training set consists of data from the remaining subjects. The model shown above, fits random intercepts for different patients in the training dataset. Now, my questions are
- Once the model has been fitted, how exactly does mixed effects model predict outputs for new patient ids in my testing dataset?
- All the examples I have seen online show that using mixed effects models we can plot fitted lines with different intercepts for each subject in the training dataset. However, how do we know what the intercept would be for the new dataset in the testing dataset? What is the mathematical explanation for that?