[R-sig-ME] [EXTERNAL] AW: [EXT] Re: Re: partial effects plots

Henrik Singmann @|ngm@nn @end|ng |rom gm@||@com
Wed Jul 31 22:10:49 CEST 2024


Hi Laura,

These plots can be produced with the gratia package:
https://gavinsimpson.github.io/gratia/

Please note that these plots are based on GAMMs and not GLMMs. The easiest
way to see this is that the effect of each variable on the x-axis does not
follow a simple parametric form (e.g., linear or curvilinear) but is
non-linear and recovered from the data (using a spline). If you want to
produce such a plot, you need to fit a GAM, which you can do using package
mgcv.

Best,
Henrik


Am Mi., 31. Juli 2024 um 14:09 Uhr schrieb Lee, Laura M via
R-sig-mixed-models <r-sig-mixed-models using r-project.org>:

> Thanks, everyone, for your quick response. I am interested in the
> relationship between the outcome and each explanatory variable. I am
> interested in creating plots similar to Figures 4a and 4b in the paper at
> https://www.frontiersin.org/journals/marine-science/articles/10.3389/fmars.2023.1154689/full#h10
> .
>
> I tried running peplot() using the code from the link Daniel (
> https://rpubs.com/milesdwilliams15/328471), but could not get it to work.
>
> I was able to extract effects using the 'remef' package (
> https://github.com/hohenstein/remef), but I am not sure where to go from
> there.
>
>
> Best,
>
> Laura
>
>
>
> -----Original Message-----
> From: Daniel Lüdecke <d.luedecke using uke.de>
> Sent: Wednesday, July 31, 2024 2:38 AM
> To: 'John Fox' <jfox using mcmaster.ca>; 'Ben Bolker' <bbolker using gmail.com>; Lee,
> Laura M <laura_lee using fws.gov>
> Cc: r-sig-mixed-models using r-project.org
> Subject: [EXTERNAL] AW: [EXT] Re: [R-sig-ME] Re: partial effects plots
>
>
>
>  This email has been received from outside of DOI - Use caution before
> clicking on links, opening attachments, or responding.
>
>
>
> Dear all,
> yes, partial *residuals* are possible with the effects package (see
> https://cran.r-project.org/web/packages/effects/vignettes/partial-residuals.pdf)
> or ggeffects (
> https://strengejacke.github.io/ggeffects/articles/introduction_partial_residuals.html
> ).
>
> I don't think partial *regression* plots are possible for any of those
> packages (maybe for the effects package, I'm not sure).
>
> Laura, maybe you can clarify what kind of plots you would like to have?
> Terminology may be unclear here. I'm not sure if I confused partial
> *effects* with partial *regression* plots. Beside the mentioned functions
> in the car-package, this website describes partial-effects plots:
> https://rpubs.com/milesdwilliams15/328471
>
> Best
> Daniel
>
> -----Ursprüngliche Nachricht-----
> Von: John Fox <jfox using mcmaster.ca>
> Gesendet: Dienstag, 30. Juli 2024 23:08
> An: Ben Bolker <bbolker using gmail.com>; Daniel Lüdecke <d.luedecke using uke.de>;
> Laura_Lee using fws.gov
> Cc: r-sig-mixed-models using r-project.org
> Betreff: [EXT] Re: [R-sig-ME] Re: partial effects plots
>
> Dear Ben, Daniel, and Laura,
>
> First, added-variable (partial-regression) plots are often confused with
> component + residuals (partial-residual) plots, but they are not the same.
>
> Second, "effect" plots are essentially component + residuals plots
> (possibly without the residuals).
>
> Finally, it's possible to show partial residuals in effect plots for mixed
> models constructed by the effects package.
>
> I hope this helps,
>   John
>
> --
> John Fox, Professor Emeritus
> McMaster University
> Hamilton, Ontario, Canada
> web: https://www.john-fox.ca/
> --
>
> On 2024-07-30 4:52 p.m., Ben Bolker wrote:
> > Caution: External email.
> >
> >
> >    OK, in this case you'll need to be able to generate partial
> > residuals, which may be doable via the package at
> > https://gith/
> > ub.com%2Fhohenstein%2Fremef&data=05%7C02%7CLaura_Lee%40fws.gov%7C9c1f9
> > 42cac544a28211c08dcb12bdd0a%7C0693b5ba4b184d7b9341f32f400a5494%7C0%7C0
> > %7C638580049186171278%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQ
> > IjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=cZEOirnq
> > pSl%2BOiEfZJNbguKdfw2Szm7jznMZTDXi7X0%3D&reserved=0
> >
> > On 7/30/24 16:30, Daniel Lüdecke wrote:
> >> I'm not sure if the partial effects plots differ from what emmeans,
> >> ggeffects, effects etc. plot by default.
> >> Isn't another name for "partial effects plots" the "added variables
> >> plot", implemented in car::avPlot() / car::avPlots()?
> >>
> >> Not sure if mixed models are supported, though.
> >>
> >> -----Ursprüngliche Nachricht-----
> >> Von: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> Im
> >> Auftrag von Ben Bolker
> >> Gesendet: Dienstag, 30. Juli 2024 22:18
> >> An: r-sig-mixed-models using r-project.org
> >> Betreff: [EXT] Re: [R-sig-ME] partial effects plots
> >>
> >>     Start with emmeans or effects packages? In particular
> >>
> >> library(effects)
> >>
> >> plot(allEffects(fitted_model))
> >>
> >> On 7/30/24 15:44, Lee, Laura M via R-sig-mixed-models wrote:
> >>> Hello all,
> >>>
> >>> I have fit a GLMM to presence/absence data (family = binomial) from
> >>> an acoustic telemetry study. I have five fixed effects-Year (a
> >>> factor), Day of Year, Hour of Day, Sex (a factor), and water
> >>> temperature-and one random effect-Fish ID (a factor). I am looking
> >>> to create partial effects plots for the covariates. Can anyone
> >>> direct me to some sample code or suggest a package to help me get
> >>> started. My Google searches haven't been very fruitful.
> >>>
> >>> I would appreciate any assistance on this matter. Thank you for your
> >>> time!
> >>>
> >>>
> >>> Best,
> >>>
> >>> Laura
> >>>
> >>>
> >>> #############################
> >>> Laura M. Lee
> >>> USFWS - Northeast Fishery Center
> >>> P.O. Box 75
> >>> 308 Washington Ave.
> >>> Lamar, PA  16848
> >>> Phone: 570-726-4247 x 50122
> >>> Laura_Lee using fws.gov<mailto:Laura_Lee using fws.gov>
> >>> #############################
> >>>
> >>>
> >>>
> >>>      [[alternative HTML version deleted]]
> >>>
> >>> _______________________________________________
> >>> R-sig-mixed-models using r-project.org mailing list
> >>> https://st/
> >>> at.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mixed-models&data=05%7C02%7C
> >>> Laura_Lee%40fws.gov%7C9c1f942cac544a28211c08dcb12bdd0a%7C0693b5ba4b1
> >>> 84d7b9341f32f400a5494%7C0%7C0%7C638580049186175290%7CUnknown%7CTWFpb
> >>> GZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6M
> >>> n0%3D%7C0%7C%7C%7C&sdata=Iu%2F%2Fa6Lh6WVYhRuJztyjq5%2ByY2ogprNblZSpl
> >>> taIFzA%3D&reserved=0
> >> _______________________________________________
> >> R-sig-mixed-models using r-project.org mailing list
> >> https://sta/
> >> t.ethz.ch%2F&data=05%7C02%7CLaura_Lee%40fws.gov%7C9c1f942cac544a28211
> >> c08dcb12bdd0a%7C0693b5ba4b184d7b9341f32f400a5494%7C0%7C0%7C6385800491
> >> 86180611%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIi
> >> LCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=W2RLKcok9vuM2pvmLCn
> >> Q%2B6qQP4w%2BDsc1vcrGO2zf2x8%3D&reserved=0
> >> mailman/listinfo/r-sig-mixed-models
> >>
> >> --
> >>
> >> _____________________________________________________________________
> >>
> >> Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen
> >> Rechts; Gerichtsstand: Hamburg |
> >> http://www/.
> >> uke.de%2F&data=05%7C02%7CLaura_Lee%40fws.gov%7C9c1f942cac544a28211c08
> >> dcb12bdd0a%7C0693b5ba4b184d7b9341f32f400a5494%7C0%7C0%7C6385800491861
> >> 85163%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJ
> >> BTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=EWjIv5aRNzXBF8MGyZv%2F
> >> cAZWAIZMYET46YxNThcXZrI%3D&reserved=0
> >> Vorstandsmitglieder: Prof. Dr. Christian Gerloff (Vorsitzender),
> >> Joachim Prölß, Prof. Dr. Blanche Schwappach-Pignataro, Corinna Wriedt
> >> _____________________________________________________________________
> >
> > _______________________________________________
> > R-sig-mixed-models using r-project.org mailing list
> > https://stat/
> > .ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mixed-models&data=05%7C02%7CLaur
> > a_Lee%40fws.gov%7C9c1f942cac544a28211c08dcb12bdd0a%7C0693b5ba4b184d7b9
> > 341f32f400a5494%7C0%7C0%7C638580049186189269%7CUnknown%7CTWFpbGZsb3d8e
> > yJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%
> > 7C%7C%7C&sdata=CYdI3J8r9MpBmF%2BuTxgOXut6TeuaVkIE1uyGpGTk8gM%3D&reserv
> > ed=0
>
>
> --
>
> _____________________________________________________________________
>
> Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen
> Rechts; Gerichtsstand: Hamburg | http://www.uke.de/
> Vorstandsmitglieder: Prof. Dr. Christian Gerloff (Vorsitzender), Joachim
> Prölß, Prof. Dr. Blanche Schwappach-Pignataro, Corinna Wriedt ___________
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>


-- 
Dr. Henrik Singmann
Associate Professor, Experimental Psychology
University College London (UCL), UK
http://singmann.org

	[[alternative HTML version deleted]]



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