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

Diana Michl dm|ch| @end|ng |rom un|-pot@d@m@de
Mon Nov 4 11:20:44 CET 2019


Sorry I forgot to send my response below to the entire list.

Glad I could help.

Best



-------- Weitergeleitete Nachricht --------
Betreff: 	Re: [R-sig-ME] Doubtful significance in mixed effect model
Datum: 	Mon, 4 Nov 2019 00:24:33 +0100
Von: 	Chia-Yu Chen <jessica821112 using gmail.com>
An: 	Diana Michl <dmichl using uni-potsdam.de>



Dear Diana,

Thank you so much for your reply! I didn’t know my syntax was wrong 
until I read your explanations. They are really helpful, and I have 
solved my problem by specifying that age and sex are nested within 
patient. Thank you once again :)

Best wishes,
Chia-Yu

> On Nov 2, 2019, at 21:54, Diana Michl <dmichl using uni-potsdam.de 
> <mailto:dmichl using uni-potsdam.de>> wrote:
>
> Hi Chia-Yu,
>
> (Sex | Patient) isn't right exactly because sex does not change within 
> a patient. What you probably mean is (1|sex/patient), the / implies 
> that sex is nested within patient. What you wrote means pretty much 
> the opposite, that sex does vary by patient and that you want a 
> different intercept for sex for each patient.
>
> If sex varies BY anything at all, it's definitely not the patient. You 
> might need to tell us what sex varies by. Or you write (1 | sex) if 
> you want different intercepts for sex. _However,_ it seems to me it 
> makes more sense to include sex as fixed effect!
>
> Secondly, if you want a random effect like (sex |...) at all, you 
> should include sex as a fixed effect in addition, anyway.
>
> So this is probably your best choice:
>
> lme4::glmer(data = subdata, formula =  value ~  Case + Sex + (1 | Patient)
>
> or, only if it makes sense:
>
> lme4::glmer(data = subdata, formula =  value ~  Case + Sex + (1 | Patient) + ( Sex | ...?))
>
> or, also only if it really makes sense:
>
> m2 <- lme4::glmer(data = subdata, formula =  value ~  Case + (1 | Patient) + ( 1 | Sex))
>
> Diana
>   
> Am 02.11.2019 um 19:40 schrieb Chia-Yu Chen:
>> 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
> -- 
> Diana Michl, M.A.
> PhD candidate
> International Experimental Linguistics
> Universität Potsdam/FU Berlin
> uni-potsdam.de/en/ling/staff-list/diana-michl.html 
> <http://uni-potsdam.de/en/ling/staff-list/diana-michl.html>
>
> #Recently published:
> Michl, D. (2019). Metonymies are more literal than metaphors: evidence 
> from ratings of German idioms. Language and Cognition, 11(1), 98–124. 
> https://doi.org/10.1017/langcog.2019.7
> Michl, D. (2019). Speedy Metonymy, Tricky Metaphor, Irrelevant 
> Compositionality: How Nonliteralness Affects Idioms in Reading and 
> Rating. Journal of Psycholinguistic Research, 2(1), 56–82.
> https://doi.org/10.1007/s10936-019-09658-7
>


	[[alternative HTML version deleted]]



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