overfitPGLS: Testing PGLS_fossil overfit

View source: R/overfitPGLS.R

overfitPGLSR Documentation

Testing PGLS_fossil overfit

Description

Testing the robustness of PGLS_fossil results to sampling effects and phylogenetic uncertainty.

Usage

overfitPGLS(modform,oveRR=NULL,phylo.list=NULL,data=NULL,...)

Arguments

modform

data as passed to PGLS_fossil.

oveRR

an object produced by applying overfitRR to be provided if PGLS_fossil rescaled according to RRphylo rates should be performed.

phylo.list

a list of phylogenetic trees to be provided if PGLS_fossil on unscaled trees should be performed.

data

a data.frame or list including response and predictor variables as named in modform. If not found in data, the variables are taken from current environment.

...

further argument passed to PGLS_fossil.

Value

The function returns a list containing two 'RRphyloList' objects including results of PGLS_fossil performed by using the phylogeny as it is ($tree) and/or rescaled according to RRphylo rates ($RR). The output always has an attribute "Call" which returns an unevaluated call to the function.

Author(s)

Silvia Castiglione, Carmela Serio, Giorgia Girardi, Pasquale Raia

References

Castiglione, S., Tesone, G., Piccolo, M., Melchionna, M., Mondanaro, A., Serio, C., Di Febbraro, M., & Raia, P. (2018). A new method for testing evolutionary rate variation and shifts in phenotypic evolution. Methods in Ecology and Evolution, 9: 974-983.doi:10.1111/2041-210X.12954

See Also

overfitPGLS vignette ; Alternative-trees vignette

Examples

## Not run: 
cc<- 2/parallel::detectCores()
library(phytools)
library(ape)

# generate fictional data to test the function
rtree(100)->tree
fastBM(tree)->resp
fastBM(tree,nsim=3)->resp.multi
fastBM(tree)->pred1
fastBM(tree)->pred2
data.frame(y1=resp,x2=pred1,x1=pred2)->dat

# perform RRphylo and PGLS_fossil with univariate/multivariate phenotypic data
PGLS_fossil(modform=y1~x1+x2,data=dat,tree=tree)->pgls_noRR
RRphylo(tree,resp,clus=cc)->RR
PGLS_fossil(modform=resp~pred1+pred2,RR=RR)->pgls_RR

PGLS_fossil(modform=y1~x1+x2,data=list(y1=resp.multi,x2=pred1,x1=pred2),tree=tree)->pgls2_noRR
RRphylo(tree,resp.multi,clus=cc)->RR2
PGLS_fossil(modform=resp.multi~pred1+pred2,tree=tree,RR=RR2)->pgls2_RR

# overfitPGLS routine
# generate a list of subsampled and swapped phylogenies to test
tree.list<-resampleTree(RR$tree,s = 0.25,swap.si=0.1,swap.si2=0.1,nsim=10)

# test the robustnes of PGLS_fossil with univariate/multivariate phenotypic data
ofRR<-overfitRR(RR = RR,y=resp,phylo.list=tree.list,clus=cc)
ofPGLS<-overfitPGLS(oveRR = ofRR,phylo.list=tree.list,modform = y1~x1+x2,data=dat)

ofRR2<-overfitRR(RR = RR2,y=resp.multi,phylo.list=tree.list,clus=cc)
ofPGLS2<-overfitPGLS(oveRR = ofRR2,phylo.list=tree.list,modform = y1~x1+x2,
                     data=list(y1=resp.multi,x2=pred1,x1=pred2))

## End(Not run)

RRphylo documentation built on April 3, 2025, 9:43 p.m.