R/samp_continuous.R
    samp_continuous.RdFits models for trait evolution of continuous characters, evaluating sampling uncertainty.
samp_continuous( data, phy, n.sim = 30, breaks = seq(0.1, 0.5, 0.1), model, n.cores = NULL, bounds = list(), track = TRUE, ... )
| data | Data vector for a single binary trait, with names matching tips in   | 
    
|---|---|
| phy | A phylogeny (class 'phylo') matching   | 
    
| n.sim | The number of times species are randomly deleted for each   | 
    
| breaks | A vector containing the percentages of species to remove.  | 
    
| model | The evolutionary model (see Details).  | 
    
| n.cores | number of cores to use. If 'NULL', number of cores is detected.  | 
    
| bounds | settings to constrain parameter estimates. See   | 
    
| track | Print a report tracking function progress (default = TRUE)  | 
    
| ... | Further arguments to be passed to   | 
    
The function tree_continuous returns a list with the following
components:
call: The function call
data: The original full data vector
optpar: Transformation parameter used (e.g. lambda, kappa etc.)
full.model.estimates: Parameter estimates (rate of evolution sigsq
and where applicable optpar), root state z0, 
AICc for the full model without deleted species.
break.summary.tab: Summary per break of the mean and median effects 
of species removal on percentage and absolute change parameter estimates.
sensi.estimates: Parameter estimates (sigsq and optpar),(percentual) difference 
in parameter estimate compared to the full model (DIFsigsq, sigsq.perc,sDIFsigsq, 
DIFoptpar, optpar.perc,sDIFoptpar), 
AICc and z0 for each repeat with random species removed.
optpar: Transformation parameter used (e.g. lambda, kappa etc.)
This function randomly removes a given percentage of species (controlled by breaks),  
fits different models of continuous character evolution using fitContinuous, 
repeats this this many times (controlled by n.sim), stores the results and calculates 
the effects on model parameters.
Different evolutionary models from fitContinuous can be used, i.e. BM,OU,
EB, trend, lambda, kappa, delta and drift.
See fitContinuous for more details on character models and tree transformations.
Output can be visualised using sensi_plot.
Paterno, G. B., Penone, C. Werner, G. D. A. sensiPhy: An r-package for sensitivity analysis in phylogenetic comparative methods. Methods in Ecology and Evolution 2018, 9(6):1461-1467
Yang Z. 2006. Computational Molecular Evolution. Oxford University Press: Oxford.
Harmon Luke J, Jason T Weir, Chad D Brock, Richard E Glor, and Wendell Challenger. 2008. GEIGER: investigating evolutionary radiations. Bioinformatics 24:129-131.
Werner, G.D.A., Cornwell, W.K., Sprent, J.I., Kattge, J. & Kiers, E.T. (2014). A single evolutionary innovation drives the deep evolution of symbiotic N2-fixation in angiosperms. Nature Communications, 5, 4087.
# \dontshow{ #Load data: data("primates") #Model trait evolution accounting for phylogenetic uncertainty adultMass<-primates$data$adultMass names(adultMass)<-rownames(primates$data) samp_cont<-samp_continuous(data = adultMass,phy = primates$phy[[1]], model = "BM",n.sim=1,breaks=c(.1,.2),n.cores = 2, track = TRUE)#> | | | 0% | |=================================== | 50% | |======================================================================| 100%# } if (FALSE) { #Load data: data("primates") #Model trait evolution accounting for sampling size adultMass<-primates$data$adultMass names(adultMass)<-rownames(primates$data) samp_cont<-samp_continuous(data = adultMass,phy = primates$phy[[1]], model = "OU",n.sim=25,breaks=seq(.05,.2,.05),n.cores = 2, track = TRUE) #Print summary statistics summary(samp_cont) sensi_plot(samp_cont) sensi_plot(samp_cont, graphs = 1) #Use a different evolutionary model samp_cont2<-samp_continuous(data = adultMass,phy = primates$phy[[1]], model = "kappa",n.sim=25,breaks=seq(.05,.2,.05),n.cores = 2,track = TRUE) summary(samp_cont2) sensi_plot(samp_cont2) sensi_plot(samp_cont2, graphs = 2) samp_cont3<-samp_continuous(data = adultMass,phy = primates$phy[[1]], model = "BM",n.sim=25,breaks=seq(.05,.2,.05),n.cores = 2,track = TRUE) summary(samp_cont3) }