[R-sig-ME] Doubtful significance in mixed effect model
je@@|c@821112 @end|ng |rom gm@||@com
Sat Nov 2 19:40:15 CET 2019
I have a problem on the significance of age and sex when running glmer on my longitudinal data.
A longitudinal data where each patient is tested at 3 timepoints (here, define as “case”). There are different treatments between cases. Along with “case”, other factors include age, sex and drug dosages. So it looked something like this (there are 23 patients, each has 3 cases)
Patient Case Age Sex DrugA DrugB Value
1 1 10 0 5 10 20
1 2 10 0 10 0 30
1 3 10 0 15 0 55
What I want to do
The goal of this study is to show that “value” is significantly different across “cases”. Age, sex, drugA, drugB are all potential confounders. Here I want to see if either of these factors has confounding effects, that is, whether adding these factors to the model will be better or not.
How I did it
First, I constructed 2 nested models, and then I compared the 2 models with likelihood test. If m2 is better than m1, then I assume this factor has significance for value. Since it’s a longitudinal data, the “patient” is treated as random factor. I ran through the factors one by one, here take “sex” for example:
m1 <- lme4::glmer(data = subdata, formula = value ~ Case + (1 | Patient))
m2 <- lme4::glmer(data = subdata, formula = value ~ Case + (1 | Patient) + ( Sex | Patient))
p_value <- lmtest::lrtest (m1, m2)$"Pr(>Chisq)"
I expected that m2 shouldn’t be better than m1 for sex and age, because for each patient they didn’t change over 3 cases. I thought by specifying "( Sex | Patient)” in the model would tell R that sex doesn’t change for each patient, and thus it doesn’t have any predictive ability for the value. However, lrtest showed that for some patients, m2 is better than m1, meaning that age or sex is significant. I’m wondering is there anything wrong in my codes? Doesn’t ( Sex | Patient) tell R that sex doesn’t change for each patient? How should I code so that m2 won’t be better than m1 for sex and age? Or is there any better way doing this?
I’ve tried many combinations of the code, but I still can’t solve this problem. Could anyone give me some advices? Any suggestion is appreciated! Thank you in advance.
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models