run_sampler_phy: Aggregated and overdispersed sampling for phylo objects

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Generate aggregated or overdispersed sampling designs for any given phylogenetic tree (class phylo). Results can be used to design experiments/samples, for resample proposes and data bias removal.

Usage

1
2
run_sampler_phy(x, n, alpha, dist.func = cophenetic, n_start = 1,
  return_start = FALSE, starting = NULL)

Arguments

x

phylo object.

n

A positive integer number indicating the sample size.

alpha

Number indicating the strength of aggregation (if negative) or overdispersion (if positive). When alpha = 0 sample is random.

dist.func

Function to calculate the phylogenetic distance. The function should be able to receive a phylo object and return a matrix indicating the pairwise distance between tips. Row and column names should be given. Default uses cophenetic from ape package. Other examples include

n_start

Number of initial selected tips. Default is one starting tip.

return_start

if TRUE the starting tip is returned.

starting

Character vector indicating the starting tips. If not provided, random starting value(s) is(are) selected.

Details

The function uses the algorithm in run_sampler, but here it accepts a phylo object as input.

Value

The function returns a pruned phylogenetic tree.

Author(s)

Bruno Vilela

See Also

run_sampler

Nee_May_1997

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Generate a random tree
require(ape)
set.seed(100)
tree <- rcoal(10)
set.seed(2)
# Highly overdispersed 50% resample design (alpha = 100)
overdispersed <- run_sampler_phy(tree, 5, alpha = 100, starting = "t10")
# Highly aggregated 50% resample design (alpha = -100)
aggregated <- run_sampler_phy(tree, 5, alpha = -100, starting = "t10")
# Random 50% resample design (alpha = 0)
random <- run_sampler_phy(tree, 5, alpha = 0, starting = "t10")
# Plot to compare
par(mfrow = c(2, 2))
plot(tree, main = "Full tree", cex = 1)
axis(1)
plot(overdispersed, main = "Overdispersed 50% sampling", cex = 1)
axis(1)
plot(aggregated, main = "Aggregated 50% sampling", cex = 1)
axis(1)
plot(random, main = "Random 50% sampling", cex = 1)
axis(1)

BrunoVilela/sampler documentation built on May 20, 2019, 2:23 p.m.