Lior,

If you're interested in an r-squared for a gls, you can use the R2_pred
from the rr2 package: https://rdrr.io/github/arives/rr2/man/R2_pred.html

Something like this:

result.pgls <- gls(y ~ x, data = df,
                                correlation = corBrownian(phy = tree, form
= ~ tip.name))
linear <- lm(y ~ x, data = df)
r2 <- R2_pred(result.pgls, linear)

Oscar
--
Oscar Johnson, Ph.D.
Postdoctoral Fellow, Department of Biological Sciences
The University of Texas at El Paso
ojohn...@utep.edu | henicorh...@gmail.com
http://www.oscarjohnson.net/



> Message: 1
> Date: Fri, 21 Jul 2023 11:22:21 +0200 (CEST)
> From: Emmanuel Paradis <emmanuel.para...@ird.fr>
> To: Lior Glick <liorg...@mail.tau.ac.il>
> Cc: r-sig-phylo <r-sig-phylo@r-project.org>
> Subject: Re: [R-sig-phylo] Correlation coefficient from a PGLS
> Message-ID: <818792209.2134234.1689931341074.javamail.zim...@ird.fr>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Lior,
>
> R-squared and Pearson's coefficient are two different things:
>
> R-squared (aka coefficient of determination) quantifies the quantity of
> variance of a variable (the response, 'y' in your example) that is
> explained by the model where some predictors can be controlled by the
> experimenter. This concept is difficult to apply in evolutionary models
> since variables are (usually) not controlled.
>
> The correlation coefficient quantifies the link between two uncontrolled
> variables without any assumption whether one is a response and the other is
> the predictor. In the case of phylogenetic comparative analyses, the
> correlation between PICs is certainly what you are looking for: see ?pic in
> ape.
>
> HTH,
>
> Best,
>
> Emmanuel
>
> ----- Le 18 Juil 23, à 19:29, Lior Glick liorg...@mail.tau.ac.il a écrit :
>
> > Hello,
> >
> > I ran a PGLS analysis like this:
> > model = gls(y ~ x, correlation = corBrownian(phy = tree, form=~species),
> > data = data_df, method = "ML")
> >
> > I was able to extract the coefficients (intercept + b1 in this case), as
> > well as the relevant p-values. What I couldn't figure out is how to get a
> > correlation coefficient between y and x, something like R-squared or
> > pearson's coefficient.
> >
> > Can you please help with that?
> > Thanks!
> >
> >       [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-phylo mailing list - R-sig-phylo@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> > Searchable archive at
> http://www.mail-archive.com/r-sig-phylo@r-project.org/
>
>
>
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to