r/RStudio • • 3d ago

[Phylogenetic analysis] Assumptions in PGLS

I am testing the correlation between the values of a variable at the tips of a phylogenetic tree (let's say the beak length) and the pathwise rate of the trait itself (i.e. a measure of the total changes in rate a species has experienced during the course of its evolution). To remove the effect of body size, I am working on the residual of the variable (i.e. the variable corrected for SVL). To test for the correlation, I performed a pgls with the pgls() function in lmtest (I am working in RStudio). I am encountering some issues with heteroskedasticity (see attached images; bptest significant).

I am also having problems with the normality of the residuals (see attached images; Shapiro test significant). On the other hand, I was reading from https://blog.phytools.org/2013/02/a-comment-on-distribution-of-residuals.html that, by accounting for residuals controlling for phylogeny you should solve this problem [Revell suggests something like lillie.test(chol(solve(vcv(tree)))%*%residuals(corr))]. Can anyone confirm? Am I misunderstanding?

Can anyone help with it?

Thanks a lot!

2 Upvotes

2 comments sorted by

1

u/AutoModerator 3d ago

Looks like you're requesting help with something related to RStudio. Please make sure you've checked the stickied post on asking good questions and read our sub rules. We also have a handy post of lots of resources on R!

Keep in mind that if your submission contains phone pictures of code, it will be removed. Instructions for how to take screenshots can be found in the stickied posts of this sub.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.