# Generate an example three-state unordered character costmatrix:
# Generate an example three-state unordered character costmatrix:
unordered_costmatrix <- make_costmatrix(
min_state = 0,
max_state = 2,
character_type = "unordered"
)
# Generate an example three-state ordered character costmatrix:
ordered_costmatrix <- make_costmatrix(
min_state = 0,
max_state = 2,
character_type = "ordered"
)
# Generate an example three-state ordered character costmatrix with polymorphism included:
unordered_polymorphism_costmatrix <- list(
size = 7,
n_states = 3,
single_states = c("0", "1", "2"),
type = "unordered",
costmatrix = matrix(
data = c(
0, 2, 2, 1, 1, 3, 2,
2, 0, 2, 1, 3, 1, 2,
2, 2, 0, 3, 1, 1, 2,
1, 1, 3, 0, 2, 2, 1,
1, 3, 1, 2, 0, 2, 1,
3, 1, 1, 2, 2, 0, 1,
2, 2, 2, 1, 1, 1, 0
),
nrow = 7,
byrow = TRUE,
dimnames = list(
c(as.character(x = 0:2), "0&1", "0&2", "1&2", "0&1&2"),
c(as.character(x = 0:2), "0&1", "0&2", "1&2", "0&1&2")
)
),
symmetry = "Symmetric",
includes_polymorphisms = TRUE,
polymorphism_costs = "geometric",
polymorphism_geometry = "hypercube",
polymorphism_distance = "manhattan",
includes_uncertainties = FALSE,
pruned = FALSE,
dollo_penalty = 999,
base_age = 1,
weight = 0.5
)
class(unordered_polymorphism_costmatrix) <- "costMatrix"
# Add uncertainties to unordered costmatrix:
unordered_costmatrix_uncertainties <- add_uncertainties_to_costmatrix(
costmatrix = unordered_costmatrix
)
# Show unordered costmatrix with uncertainties included:
unordered_costmatrix_uncertainties$costmatrix
# Add uncertainties to ordered costmatrix:
ordered_costmatrix_uncertainties <- add_uncertainties_to_costmatrix(
costmatrix = ordered_costmatrix
)
# Show ordered costmatrix with uncertainties included:
ordered_costmatrix_uncertainties$costmatrix
# Add uncertainties to unordered costmatrix with polymorphisms:
unordered_polymorphism_costmatrix_uncertainties <- add_uncertainties_to_costmatrix(
costmatrix = unordered_polymorphism_costmatrix
)
# Show unordered polymorphism costmatrix with uncertainties included:
unordered_polymorphism_costmatrix_uncertainties$costmatrix
Run the code above in your browser using DataLab