#' # simulate a phylogenetic tree
phy <- ape::rtree(10)
# simulate characters along the branches of the tree
morpho_data <- sim.morpho(tree = phy,
k = c(2,3,4),
trait.num = 20,
ancestral = TRUE,
partition = c(10,5,5),
ACRV = "gamma",
variable = TRUE,
ACRV.ncats = 4,
define.Q = NULL)
# randomly remove data
missing.data <- sim.missing.data(data = morpho_data,
method = "random",
seq = "tips",
probability = 0.5)
# remove data based on the partition
missing.data <- sim.missing.data(data = morpho_data,
method = "partition",
seq = "tips",
probability = c(0.7, 0, 0.5))
# remove data based on the rate it was simulated under
missing.data <- sim.missing.data(data = morpho_data,
method = "rate",
seq = "tips",
probability = c(0,0,0.2,1))
# remove characters from specific traits
missing.data <- sim.missing.data(data = morpho_data,
method = "trait",
seq = "tips",
probability = 1,
traits = c(1,2,5))
# remove characters from specific taxa
missing.data <- sim.missing.data(data = morpho_data,
method = "taxa",
seq = "tips",
probability = 1,
taxa = c("t1", "t2"))
Run the code above in your browser using DataLab