Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/tree_influ_phyglm.R
Performs leave-one-out deletion analysis for phylogenetic logistic regression, and detects influential species while evaluating uncertainty in trees topology.
1 2 3 4 5 6 7 8 9 10 | tree_influ_phyglm(
formula,
data,
phy,
n.tree = 2,
cutoff = 2,
btol = 50,
track = TRUE,
...
)
|
formula |
The model formula |
data |
Data frame containing species traits with row names matching tips
in |
phy |
A phylogeny (class 'phylo') matching |
n.tree |
Number of times to repeat the analysis with n different trees picked randomly in the multiPhylo file. |
cutoff |
The cutoff value used to identify for influential species (see Details) |
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 sequentially removes one species at a time, fits a phylogenetic
logistic regression model using phyloglm
, stores the
results and detects influential species. It repeats this operation using n trees,
randomly picked in a multiPhylo file.
Currently only logistic regression using the "logistic_MPLE"-method from
phyloglm
is implemented.
influ_phyglm
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 logistic models (i.e. trait~ predictor). In the future we will implement more complex models.
Output can be visualised using sensi_plot
.
The function influ_phyglm
returns a list with the following
components:
cutoff
: The value selected for cutoff
formula
: The formula
full.model.estimates
: Coefficients, aic and the optimised
value of the phylogenetic parameter (i.e. alpha
) for the full model
without deleted species.
influential_species
: List of influential species, both
based on standardised difference in interecept and in the slope of the
regression. Species are ordered from most influential to less influential and
only include species with a standardised difference > cutoff
.
sensi.estimates
: A data frame with all simulation
estimates. Each row represents a deleted clade for a given random tree. Columns report the calculated
regression intercept (intercept
), difference between simulation
intercept and full model intercept (DIFintercept
), 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
slope (DIFestimate
etc.). Additionally, model aic value (AIC
) and
the optimised value (optpar
) of the phylogenetic parameter
(i.e. alpha
) are reported.
data
: Original full dataset.
errors
: Species where deletion resulted in errors.
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.
phyloglm
, tree_phyglm
,
influ_phyglm
, tree_influ_phyglm
, sensi_plot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
# Simulate Data:
set.seed(6987)
mphy = rmtree(100, N = 30)
x = rTrait(n=1,phy=mphy[[1]])
X = cbind(rep(1,100),x)
y = rbinTrait(n=1,phy=mphy[[1]], beta=c(-1,0.5), alpha=.7 ,X=X)
dat = data.frame(y, x)
# Run sensitivity analysis:
tree_influ <- tree_influ_phyglm(y ~ x, data = dat, phy = mphy, n.tree = 5)
summary(tree_influ)
sensi_plot(tree_influ)
sensi_plot(tree_influ, graphs = 1)
sensi_plot(tree_influ, graphs = 2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.