Performs leave-one-out deletion analysis for phylogenetic logistic regression, and detects influential species, while taking into account potential interactions with intraspecific variability.
1 2 3 4 5 6 7 8 9 10 11 12 13
The model formula:
Data frame containing species traits with row names matching tips
A phylogeny (class 'phylo') matching
Name of the column containing the standard deviation or the standard error of the predictor
variable. When information is not available for one taxon, the value can be 0 or
Number of datasets resimulated taking into account intraspecific variation (see:
Transformation for the predictor variable (e.g.
A character string indicating which distribution to use to generate a random value for the response
and/or predictor variables. Default is normal distribution: "normal" (function
The cutoff value used to identify for influential species (see Details)
Bound on searching space. For details see
Print a report tracking function progress (default = TRUE)
Further arguments to be passed to
This function fits a phylogenetic linear regression model using
phylolm, and detects
influential species by sequentially deleting one at a time. The regression is repeated
n.intra times for
simulated values of the dataset, taking into account intraspecific variation. At each iteration, the function
generates a random value for each row in the dataset using the standard deviation or errors supplied, and
detect the influential species within that iteration.
influ_phylm detects influential species based on the standardised
difference in intercept and/or slope when removing a given species compared
to the full model including all species. Species with a standardised difference
above the value of
cutoff are identified as influential. The default
value for the cutoff is 2 standardised differences change.
Currently, this function can only implement simple models (i.e. trait~ predictor). In the future we will implement more complex models.
Output can be visualised using
intra_influ_phylm returns a list with the following
cutoff: The value selected for
formula: The formula
full.model.estimates: Coefficients, aic and the optimised
value of the phylogenetic parameter (e.g.
lambda) for the full model
without deleted species.
influential_species: List of influential species, both
based on standardised difference in intercept and in the slope of the
regression. Species are ordered from most influential to less influential and
only include species with a standardised difference >
sensi.estimates: A data frame with all simulation
estimates. Each row represents a deleted clade for an iteration of resimulated
data. Columns report the calculated regression intercept (
difference between simulation intercept and full model intercept (
the standardised difference (
sDIFintercept), the percentage of change in intercept compared
to the full model (
intercept.perc) and intercept p-value
pval.intercept). All these parameters are also reported for the regression
DIFestimate etc.). Additionally, model aic value (
the optimised value (
optpar) of the phylogenetic parameter
lambda, depending on the phylogenetic model used) are
data: Original full dataset.
errors: Species where deletion resulted in errors.
When Vx exceeds X negative (or null) values can be generated, this might cause problems
for data transformation (e.g. log-transformation). In these cases, the function will skip the simulation. This problem can
be solved by increasing
n.intra, changing the transformation type and/or checking the target species in output$sp.pb.
n.intra at high values can take a long time to execute, since the total number of iterations equals
n.intra * nrow(data).
Gustavo Paterno, Caterina Penone & Gijsbert D.A. Werner
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.
Ho, L. S. T. and Ane, C. 2014. "A linear-time algorithm for Gaussian and non-Gaussian trait evolution models". Systematic Biology 63(3):397-408.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
## Not run: #Generate data set.seed(6987) phy = rtree(100) x = rTrait(n=1,phy=phy,parameters=list(ancestral.state=2,optimal.value=2,sigma2=1,alpha=1)) X = cbind(rep(1,100),x) y = rbinTrait(n=1,phy=phy, beta=c(-1,0.5), alpha=.7 ,X=X) z = rnorm(n = length(x),mean = mean(x),sd = 0.1*mean(x)) dat = data.frame(y, x, z) # Run sensitivity analysis: intra_influ <- intra_influ_phyglm(formula = y ~ x, data = dat, phy = phy, Vx = "z", n.intra = 5,track = TRUE,distrib="normal",x.transf=NULL) # To check summary results and most influential species: summary(intra_influ) # Visual diagnostics for clade removal: sensi_plot(intra_influ) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.