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]]
Marc Schwartz
2019-Jul-03 15:19 UTC
[R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]
Hi Heather, I would defer to the mixed models experts, but I think that the basic approach using nested random effects seems to make sense. I don?t know that there is a dependency of glmer()/lme4 on metafor for this specific use case, but would defer to Wolfgang on that point. Regards, Marc> On Jul 3, 2019, at 10:40 AM, Heather H Kettrey <hkettre at clemson.edu> wrote: > > 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]]
Wolfgang Viechtbauer
2019-Jul-03 17:05 UTC
[R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]
No need to install metafor for lme4. Best, Wolfgang On July 3, 2019 5:19:13 PM GMT+02:00, Marc Schwartz <marc_schwartz at me.com> wrote:>Hi Heather, > >I would defer to the mixed models experts, but I think that the basic >approach using nested random effects seems to make sense. > >I don?t know that there is a dependency of glmer()/lme4 on metafor for >this specific use case, but would defer to Wolfgang on that point. > >Regards, > >Marc > > >> On Jul 3, 2019, at 10:40 AM, Heather H Kettrey <hkettre at clemson.edu> >wrote: >> >> 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