Performs analyses of sensitivity to species sampling by randomly removing species and detecting the effects on parameter estimates in phylogenetic logistic regression.
1 2 
formula 
The model formula 
data 
Data frame containing species traits with row names matching tips
in 
phy 
A phylogeny (class 'phylo') matching 
times 
The number of times species are randomly deleted for each

breaks 
A vector containing the percentages of species to remove. 
btol 
Bound on searching space. For details see 
track 
Print a report tracking function progress (default = TRUE) 
... 
Further arguments to be passed to 
This function randomly removes a given percentage of species (controlled by
breaks
) from the full phylogenetic logistic regression, fits a phylogenetic
logistic regression model without these species using phyloglm
,
repeats this many times (controlled by times
), stores the results and
calculates the effects on model parameters.
Only logistic regression using the "logistic_MPLE"method from
phyloglm
is implemented.
Currently, this function can only implement simple linear models (i.e. trait~ predictor). In the future we will implement more complex models.
Output can be visualised using sensi_plot
.
The function samp_phylm
returns a list with the following
components:
formula
: The formula
full.model.estimates
: Coefficients, aic and the optimised
value of the phylogenetic parameter (e.g. lambda
or kappa
) for
the full model without deleted species.
samp.model.estimates
: A data frame with all simulation
estimates. Each row represents a model rerun with a given number of species
n.remov
removed, representing n.percent
of the full dataset.
Columns report the calculated regression intercept (intercept
),
difference between simulation intercept and full model intercept (DFintercept
),
the percentage of change in intercept compared to the full model (intercept.perc
)
and intercept pvalue (pval.intercept
). All these parameters are also reported
for the regression slope (DFslope
etc.). Additionally, model aic value
(AIC
) and the optimised value (optpar
) of the phylogenetic
parameter (e.g. kappa
or lambda
, depending on the phylogenetic model
used) are reported. Lastly we reported the standardised difference in intercept
(sDFintercept
) and slope (sDFslope
).
sign.analysis
For each break (i.e. each percentage of species
removed) this reports the percentage of statistically signficant (at p<0.05)
intercepts (perc.sign.intercept
) over all repititions as well as the
percentage of statisticaly significant (at p<0.05) slopes (perc.sign.slope
).
data
: Original full dataset.
Please be aware that dropping species may reduce power to detect significant slopes/intercepts and may partially be responsible for a potential effect of species removal on pvalues. Please also consult standardised differences in the (summary) output.
Gustavo Paterno & Gijsbert D.A. Werner
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 N2fixation in angiosperms. Nature Communications, 5, 4087.
#' Ho, L. S. T. and Ane, C. 2014. "A lineartime algorithm for Gaussian and nonGaussian trait evolution models". Systematic Biology 63(3):397408.
phyloglm
, samp_phylm
,
influ_phyglm
, sensi_plot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  # Simulate Data:
set.seed(6987)
phy = rtree(100)
x = rTrait(n=1,phy=phy)
X = cbind(rep(1,100),x)
y = rbinTrait(n=1,phy=phy, beta=c(1,0.5), alpha=.7 ,X=X)
dat = data.frame(y, x)
# Run sensitivity analysis:
samp < samp_phyglm(y ~ x, data = dat, phy = phy, times = 10)
# To check summary results and most influential species:
summary(samp)
## Not run:
# Visual diagnostics for clade removal:
sensi_plot(samp)
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.