I would like to be able to compare 2 models as is often done as follows:
modelA <- lm(Ys ~ X1 + X2 + X3)
modelB <- lm(Ys ~ X1 + X2)
anova(modelA, modelB)
but instead of adding or removing a co-variate- my first model is a fixed effects model with a single time point per subject, and my second model is a mixed effects model with several time points per subject and grouped by subjectID:
modelA <- lm(Ys ~ X1 + X2 + X3) #e.g. 5 observations/subjects
modelB <- lme(Ys ~ X1 + X2 + X3, random= ~ 1 | subjectID)
#e.g. same 5 subjects with 3 time points each= 15 observations
since chi-square with anova fails in this scenario, how should I compare them. Is there a specific package in R
I should use? An F-test requires knowing what the d.f. are for a mixed model, which I am unclear on how to calculate.
Thanks for your help!