Description Usage Arguments Details Value Author(s) References See Also Examples
Estimate the impact on model estimates of phylogenetic logistic regression after removing clades from the analysis.
1 2 3 4 5 6 7 8 9 10 11 | clade_phyglm(
formula,
data,
phy,
btol = 50,
track = TRUE,
clade.col,
n.species = 5,
n.sim = 100,
...
)
|
formula |
The model formula |
data |
Data frame containing species traits with row names matching tips
in |
phy |
A phylogeny (class 'phylo') matching |
btol |
Bound on searching space. For details see |
track |
Print a report tracking function progress (default = TRUE) |
clade.col |
The column in the provided data frame which specifies the clades (a character vector with clade names). |
n.species |
Minimum number of species in a clade for the clade to be
included in the leave-one-out deletion analysis. Default is |
n.sim |
Number of simulations for the randomization test. |
... |
Further arguments to be passed to |
This function sequentially removes one clade at a time, fits a phylogenetic
logistic regression model using phyloglm
and stores the
results. The impact of of a specific clade on model estimates is calculated by a
comparison between the full model (with all species) and the model without
the species belonging to a clade.
To account for the influence of the number of species on each clade (clade sample size), this function also estimates a null distribution expected for the number of species in a given clade. This is done by fitting models without the same number of species as in the given clade. The number of simulations to be performed is set by 'n.sim'. To test if the clade influence differs from the null expectation for a clade of that size, a randomization test can be performed using 'summary(x)'.
Currently, only logistic regression using the "logistic_MPLE"-method from
phyloglm
is implemented.
clade_phyglm
detects influential clades based on
difference in intercept and/or estimate when removing a given clade compared
to the full model including all species.
Additionally, to account for the influence of the number of species on each clade (clade sample size), this function also estimates a null distribution expected for the number of species in a given clade. This is done by fitting models without the same number of species in the given clade. The number of simulations to be performed is set by 'n.sim'. To test if the clade influence differs from the null expectation for a clade of that size, a randomization test can be performed using 'summary(x)'.
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 clade_phyglm
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. alpha
) for the full model
without deleted species.
sensi.estimates
: A data frame with all simulation
estimates. Each row represents a deleted clade. Columns report the calculated
regression intercept (intercept
), difference between simulation
intercept and full model intercept (DIFintercept
), 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 are
reported.
null.dist
: A data frame with estimates for the null distributions
for all clades analysed.
data
: Original full dataset.
errors
: Clades where deletion resulted in errors.
clade.col
: Which column was used to specify the clades?
Gustavo Paterno & Gijsbert 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
, clade_phylm
,
influ_phyglm
, sensi_plot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Not run:
# Simulate Data:
set.seed(6987)
phy = rtree(150)
x = rTrait(n=1,phy=phy)
X = cbind(rep(1,150),x)
y = rbinTrait(n=1,phy=phy, beta=c(-1,0.5), alpha=.7 ,X=X)
cla <- rep(c("A","B","C","D","E"), each = 30)
dat = data.frame(y, x, cla)
# Run sensitivity analysis:
clade <- clade_phyglm(y ~ x, phy = phy, data = dat, n.sim = 30, clade.col = "cla")
# To check summary results and most influential clades:
summary(clade)
# Visual diagnostics for clade removal:
sensi_plot(clade)
# Specify which clade removal to plot:
sensi_plot(clade, "B")
sensi_plot(clade, "C")
sensi_plot(clade, "D") #The clade with the largest effect on slope and intercept
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.