aphylo_cv | R Documentation |
This implements Leave-one-out cross-validation (LOO-CV) for trees of class aphylo and multiAphylo.
aphylo_cv(...)
## S3 method for class 'formula'
aphylo_cv(model, ...)
... |
Further arguments passed to the method. |
model |
As passed to aphylo_mcmc. |
For each observation in the dataset (either a single gene if of
class aphylo, or an entire tree if of class multiAphylo), we restimate
the model removing the observation and use the parameter estimates to make
a prediction on it. The prediction is done using the function predict.aphylo_estimates
with argument loo = TRUE
.
An object of class aphylo_cv
with the following components:
pred_out
Out of sample prediction.
expected
Expected annotations
call
The call
ids
Integer vector with the ids of the leafs used in the loo process.
# It takes about two minutes to run this example
set.seed(123)
atrees <- rmultiAphylo(10, 10, P = 1)
cv_multi <- aphylo_cv(atrees ~ mu_d + mu_s + Pi)
cv_single <- aphylo_cv(atrees[[1]] ~ mu_d + mu_s + Pi)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.