[R-sig-ME] R-sig-mixed-models Digest, Vol 155, Issue 3

Ades, James j@de@ @end|ng |rom uc@d@edu
Tue Jan 28 01:58:04 CET 2020


Chia-yu,

I think you need to read through some of the information for lmer and mixed-modeling.

In your second model you have sex as a random slope, varying across patient (which isn’t right, maybe it would be if every single patient were transgender). Sex should be a fixed factor, with age, and drug doses. It looks like “case” is merely a place holder, and since you have patient as a random factor, you’ve taken care of the repeated measures. That said, case could also be used as a timepoint indicator, in which case it’s fine as a fixed factor (or you could make that a random slope— (Case | Patient), but I don’t know the importance of time in your study.  You could do stepwise, where you sequentially add the fixed factors, though in doing so, you should also probably look into possible interactions of sex on drug and age on drug. I’m not sure the specifics of Drug A and B; it seems in one case, they’re administered at the same time. So maybe it’s best to pick out the most important interactions, since interactions can become unwieldy pretty quickly.

value ~ Age * Sex * DrugA * DrugB + (Case | Patient) would be an interaction on all terms…which might make sense if all IVs are significant. That said, good look reading that.

Test with the likelihood ratio test using ANOVA(m1, m2), though if you have absences for patients then your LRT will have different observations, and it won’t work. 

Best, 

James


> On Nov 3, 2019, at 3:00 AM, r-sig-mixed-models-request using r-project.org wrote:
> 
> Send R-sig-mixed-models mailing list submissions to
> 	r-sig-mixed-models using r-project.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> or, via email, send a message with subject or body 'help' to
> 	r-sig-mixed-models-request using r-project.org
> 
> You can reach the person managing the list at
> 	r-sig-mixed-models-owner using r-project.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of R-sig-mixed-models digest..."
> 
> 
> Today's Topics:
> 
>   1. Doubtful significance in mixed effect model (Chia-Yu Chen)
>   2. Re: Your response to my R-sig-ME question (Lenth, Russell V)
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Sat, 2 Nov 2019 19:40:15 +0100
> From: Chia-Yu Chen <jessica821112 using gmail.com>
> To: r-sig-mixed-models using r-project.org
> Subject: [R-sig-ME] Doubtful significance in mixed effect model
> Message-ID: <78B7183F-D5C1-4622-BA8A-B1852C5AD8AB using gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> 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]]
> 
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Sat, 2 Nov 2019 22:25:37 +0000
> From: "Lenth, Russell V" <russell-lenth using uiowa.edu>
> To: Francesco Romano <fbromano77 using gmail.com>
> Cc: "r-sig-mixed-models using r-project.org"
> 	<r-sig-mixed-models using r-project.org>
> Subject: Re: [R-sig-ME] Your response to my R-sig-ME question
> Message-ID:
> 	<DM6PR04MB438084D57E44BFBA85B23DD7F17D0 using DM6PR04MB4380.namprd04.prod.outlook.com>
> 	
> Content-Type: text/plain; charset="iso-8859-1"
> 
> If the question is how to do multiplicity adjustments for multiple sets of comparisons in 'emmeans', that is pretty simple to do. For example, starting with
> 
>    library("emmeans")
>    emm <- emmeans(model, ~ factor1 | factor2)
> 
> By default,
> 
>    pairs(emm, by = "factor1")
> 
> will apply the Tukey adjustment to the pairwise comparisons of factor2 for each level of factor1, SEPARATELY. If instead, you want to multiplicity-adjust all of those simple comparisons as one family, summarize those results after removing the 'by' variable:
> 
>    summary(pairs(emm, by = "factor1"), by = NULL, adjust = "mvt")
> 
> (Note that the Tukey adjustment is not appropriate for that family because it is not ONE set of pairwise comparisons. The mvt adjustment is the same adjustment that the multcomp package appluies by default.)
> 
> You of course may also want simple comparisons of factor1 for each level of factor2; just reverse the roles of the two factors in the above.
> 
> If you want to combine both of those families into a single family consisting of all simple comparisons of both factor2|factor1 and factor1|factor2, that can be done as well via 'rbind':
> 
>    allcmps <- pairs(emm, simple = "each")   # creates a list of two emmGrid objects
>    summary(do.call(rbind, allcmps), adjust = "mvt")
> 
> I hope that helps
> 
> Russ
> 
> Russell V. Lenth  -  Professor Emeritus
> Department of Statistics and Actuarial Science   
> The University of Iowa  -  Iowa City, IA 52242  USA   
> Voice (319)335-0712 (Dept. office)  -  FAX (319)335-3017
> 
> 
> 
> -----Original Message-----
> 
> Date: Fri, 1 Nov 2019 21:00:03 -0400
> From: Ben Bolker <bbolker using gmail.com>
> To: Francesco Romano <fbromano77 using gmail.com>
> Cc: "r-sig-mixed-models using r-project.org"
> 	<r-sig-mixed-models using r-project.org>
> Subject: Re: [R-sig-ME] Your response to my R-sig-ME question
> Message-ID: <c5952d23-0ab9-e201-f775-5c90d89f5dff using gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> 
>  [cc'ing r-sig-mixed-models]
> 
>  Honestly, it looks to me like you *do* need multiple-comparisons corrections here. I can't give you detailed advice about how to do it; emmeans does the pairwise comparisons, but it's not immediately obvious how to do correction for *multiple* sets of pairwise comparisons.
> (Perhaps you could get away with only doing the corrections at the level of sets of pairwise comparisons.)  As I mentioned before, this is not a particularly mixed-model-related question.  You could try CrossValidated (https://stats.stackexchange.com).  The emmeans and multcomp packages will probably be what you need in terms of machinery.
> 
>  sincerely
>   Ben Bolker
> 
> 
> 
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> R-sig-mixed-models mailing list
> R-sig-mixed-models using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> 
> 
> ------------------------------
> 
> End of R-sig-mixed-models Digest, Vol 155, Issue 3
> **************************************************



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