Marc Schwartz
2019-Jul-03 11:26 UTC
[R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]
Wolfgang, Perhaps I am missing something here, but with clogit(), or Heather's initial attempt at using clogistic(), as both have 'strata' arguments, wouldn't the 'strata' argument need to be able to accept a nested structure, along the lines of strata(id / site)? On the page that you link to below, I don't see an example of that type of nesting structure. The mixed effects models would generally support a nested random effects specification, if that makes sense here. Regards, Marc Schwartz> On Jul 3, 2019, at 4:41 AM, Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer at maastrichtuniversity.nl> wrote: > > Dear Heather, > > You can do this with clogit() from the 'survival' package, using strata(). See: > > http://www.metafor-project.org/doku.php/tips:clogit_paired_binary_data > > You can also use lme4::glmer(), glmmML::glmmML(), or metafor::rma.glmm() for that. [1] > > [1] Rerunning this example, I noticed a slight issue with the structuring of the output from rma.glmm() -- if you want to run that example, install the 'devel' version of metafor as described here: > > https://wviechtb.github.io/metafor/#installation > > Best, > Wolfgang > > -----Original Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Heather H Kettrey > Sent: Tuesday, 02 July, 2019 14:59 > To: r-help at r-project.org > Subject: [R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???] > > I need to run some conditional logistic regression models on a multilevel matched dataset (propensity score matched data from multiple research sites). > > I can pretty easily use the clogistic() function in the Epi package to run conditional logistic regression models on each separate/nested subset of the data (e.g., data obtained from each research site separately). However, I cannot figure out how to run an aggregate analysis (of all aggregated sites) in a way that accounts for clustering. > > When using unconditional logistic regression I can run the aggregate analysis lmer() function in the lme4 package. However, I cannot figure out how to run conditional logistic regression with the lmer() function (I am also open to any other packages/functions that might work). > > Thanks in advance for help with this. > > Heather Hensman Kettrey, PhD > Assistant Professor of Sociology > Clemson University
Wolfgang Viechtbauer
2019-Jul-03 13:15 UTC
[R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]
Ouch, that was a brain fart on my part! But indeed, since we can fit a 'single-site model' using glmer() (as shown), we should be able to just add 'site' as another random effect with (1 | site / id). Best, Wolfgang On July 3, 2019 1:26:54 PM GMT+02:00, Marc Schwartz <marc_schwartz at me.com> wrote:>Wolfgang, > >Perhaps I am missing something here, but with clogit(), or Heather's >initial attempt at using clogistic(), as both have 'strata' arguments, >wouldn't the 'strata' argument need to be able to accept a nested >structure, along the lines of strata(id / site)? > >On the page that you link to below, I don't see an example of that type >of nesting structure. > >The mixed effects models would generally support a nested random >effects specification, if that makes sense here. > >Regards, > >Marc Schwartz > > >> On Jul 3, 2019, at 4:41 AM, Viechtbauer, Wolfgang (SP) ><wolfgang.viechtbauer at maastrichtuniversity.nl> wrote: >> >> Dear Heather, >> >> You can do this with clogit() from the 'survival' package, using >strata(). See: >> >> >http://www.metafor-project.org/doku.php/tips:clogit_paired_binary_data >> >> You can also use lme4::glmer(), glmmML::glmmML(), or >metafor::rma.glmm() for that. [1] >> >> [1] Rerunning this example, I noticed a slight issue with the >structuring of the output from rma.glmm() -- if you want to run that >example, install the 'devel' version of metafor as described here: >> >> https://wviechtb.github.io/metafor/#installation >> >> Best, >> Wolfgang
Heather H Kettrey
2019-Jul-03 14:40 UTC
[R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]
Hi Marc and Wolfgang, Thanks for your help. Is the following interpretation of your exchange correct? I need to use the glmer() function in the lme4 package (first installing the devel version of metaphor). I can specify both site and matched pairing as random effects using (1 | site / id). Is this understanding correct? Thanks, Heather Heather Hensman Kettrey, PhD Assistant Professor of Sociology Clemson University ________________________________ From: Wolfgang Viechtbauer <wolfgang.viechtbauer at maastrichtuniversity.nl> Sent: Wednesday, July 3, 2019 9:15:50 AM To: Marc Schwartz Cc: Heather H Kettrey; R-help Subject: Re: [R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???] Ouch, that was a brain fart on my part! But indeed, since we can fit a 'single-site model' using glmer() (as shown), we should be able to just add 'site' as another random effect with (1 | site / id). Best, Wolfgang On July 3, 2019 1:26:54 PM GMT+02:00, Marc Schwartz <marc_schwartz at me.com> wrote:>Wolfgang, > >Perhaps I am missing something here, but with clogit(), or Heather's >initial attempt at using clogistic(), as both have 'strata' arguments, >wouldn't the 'strata' argument need to be able to accept a nested >structure, along the lines of strata(id / site)? > >On the page that you link to below, I don't see an example of that type >of nesting structure. > >The mixed effects models would generally support a nested random >effects specification, if that makes sense here. > >Regards, > >Marc Schwartz > > >> On Jul 3, 2019, at 4:41 AM, Viechtbauer, Wolfgang (SP) ><wolfgang.viechtbauer at maastrichtuniversity.nl> wrote: >> >> Dear Heather, >> >> You can do this with clogit() from the 'survival' package, using >strata(). See: >> >> >https://urldefense.proofpoint.com/v2/url?u=http-3A__www.metafor-2Dproject.org_doku.php_tips-3Aclogit-5Fpaired-5Fbinary-5Fdata&d=DwIFaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=BBiFu06xLWCETvNuhD6uw-_crP2zH6EmpC772CQach0&m=PP2LCJ_pE4EwJysp-nsvWt8oIJqJ0nhFvSMBuh7T-ww&s=dvbBssAbENU3KBtLTcWb64QHTComM-RmP8my38CxhW0&e>> >> You can also use lme4::glmer(), glmmML::glmmML(), or >metafor::rma.glmm() for that. [1] >> >> [1] Rerunning this example, I noticed a slight issue with the >structuring of the output from rma.glmm() -- if you want to run that >example, install the 'devel' version of metafor as described here: >> >> https://urldefense.proofpoint.com/v2/url?u=https-3A__wviechtb.github.io_metafor_-23installation&d=DwIFaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=BBiFu06xLWCETvNuhD6uw-_crP2zH6EmpC772CQach0&m=PP2LCJ_pE4EwJysp-nsvWt8oIJqJ0nhFvSMBuh7T-ww&s=POvfvp_zMlzeLnfGS2EavvZp1-P_0utedAIqz994QkI&e>> >> Best, >> Wolfgang[[alternative HTML version deleted]]
Abby Spurdle
2019-Jul-05 00:30 UTC
[R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]
(Back ON-LIST). (And combining two of Marc's posts).> Perhaps I am missing something here, but with clogit(), or Heather'sinitial attempt at using clogistic(), as both have 'strata' arguments, wouldn't the 'strata' argument need to be able to accept a nested structure, along the lines of strata(id / site)?> I would defer to the mixed models experts, but I think that the basicapproach using nested random effects seems to make sense.> The mixed effects models would generally support a nested random effectsspecification, if that makes sense here. I found the coxme() function from the coxme package. According to it's documentation: "Fit a Cox model containing mixed (random and fixed) effects." I found some sources stating that a Cox model, is equivalent to a Conditional Logistic Model, in some cases. And another source that said that you need to set time equal to one, for every data point. However, I haven't verified any of this. I don't know if it's possible to use the coxme() function in conjunction with Marc's idea for nested random effects...? [[alternative HTML version deleted]]