Description Usage Arguments Details Value Author(s) References See Also Examples
Generate a subsample from a phylogenetic tree that maximizes the remaining amount of evolutionary history (see Nee and May 1997).
1 | Nee_May_1997(x, n)
|
x |
|
n |
A positive integer number indicating the sample size. |
The algorithm selects n - 1 oldest nodes, defining n clades. One species from each clade is randomly selected (Nee and May 1997).
A pruned phylogenetic tree.
Bruno Vilela
Sean Nee and Robert M. May. "Extinction and the loss of evolutionary history." Science 278.5338 (1997): 692-694.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | require(ape)
set.seed(50)
tree <- rcoal(50)
k = 10
par(mfrow = c(1, 2))
plot(tree, main = paste("Original tree \n n =", Ntip(tree)))
plot(Nee_May_1997(tree, k), main = paste("Tree with phylogenetic history maximized
n =", k, "(Nee & May 1997)"))
# Compare the sampler algorithm with Nee and May (1997) method:
PD_ob <- sum(Nee_May_1997(tree, k)$edge.length)
n_a = 20
alphas <- seq(-5, 5, length.out = n_a)
rep = 100
PD <- matrix(ncol = n_a, nrow = rep)
for (j in 1:rep) {
for (i in 1:n_a) {
PD[j, i] <- sum(run_sampler_phy(tree, k, alpha = alphas[i], starting = "t10")$edge.length)
}
}
PD_max <- apply(PD, 2, max)
PD_min <- apply(PD, 2, min)
PD_mean <- apply(PD, 2, mean)
par(mfrow = c(1, 1))
plot(alphas, PD_mean, ylab = "Phylogenetic Diveristy",
ylim = c(min(PD), max(c(PD, PD_ob))), type = "l", lwd = 2, col = "black")
lines(alphas, PD_max, lty = 2, col = "gray20")
lines(alphas, PD_min, lty = 2, col = "gray20")
points(max(alphas) + max(alphas) *.05, PD_ob, col = "red", pch = 18, cex = 2)
legend(x = max(alphas) - max(alphas) * .90, y = min(PD) + min(PD) * 2,
legend = c("Sampler (mean)", "Sampler (min and max)", "Nee & May"),
pch = c(NA, NA, 18), lty = c(1, 2, NA),
col = c("black", "gray20","red"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.