[R-sig-ME] Doubtful significance in mixed effect model

Thierry Onkelinx th|erry@onke||nx @end|ng |rom |nbo@be
Mon Nov 4 09:33:48 CET 2019

Dear Chia-Yu,

(A|B) defines a random slope along A within each level of grouping factor
B. In maths you can write it as b_i0 + b_i1 * A with b_i0 the random
intercept and b_i1 the random slope for level i from B.
Random slopes are only relevant is the variable A as different values
**within** levels of B. So if age and sex don't change within patient, it
doesn't make sense to add them as a random effect.

A good exploratory data analysis and common sense is a better way to look
for confounding factors.

Best regards,

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx using inbo.be
Havenlaan 88 bus 73, 1000 Brussel

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey


Op za 2 nov. 2019 om 19:41 schreef Chia-Yu Chen <jessica821112 using gmail.com>:

> Hi,
> I have a problem on the significance of age and sex when running glmer on
> my longitudinal data.
> My 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)"[2]
> My Question
> 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.
> Best,
> Chia-Yu
>         [[alternative HTML version deleted]]
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

	[[alternative HTML version deleted]]

More information about the R-sig-mixed-models mailing list