# Create a Type I character costmatrix:
constant_costmatrix <- make_costmatrix(
min_state = 0,
max_state = 0,
character_type = "unordered"
)
# Classify costmatrix:
classify_costmatrix(costmatrix = constant_costmatrix)
# Create a Type II character costmatrix:
binary_symmetric_costmatrix <- make_costmatrix(
min_state = 0,
max_state = 1,
character_type = "unordered"
)
# Classify costmatrix:
classify_costmatrix(costmatrix = binary_symmetric_costmatrix)
# Create a Type III character costmatrix:
unordered_costmatrix <- make_costmatrix(
min_state = 0,
max_state= 2,
character_type = "unordered"
)
# Classify costmatrix:
classify_costmatrix(costmatrix = unordered_costmatrix)
# Create a Type IV character costmatrix:
linear_ordered_costmatrix <- make_costmatrix(
min_state = 0,
max_state= 2,
character_type = "ordered"
)
# Classify costmatrix:
classify_costmatrix(costmatrix = linear_ordered_costmatrix)
# Create a Type V character costmatrix:
nonlinear_ordered_costmatrix <- convert_adjacency_matrix_to_costmatrix(
adjacency_matrix = matrix(
data = c(
0, 1, 0, 0,
1, 0, 1, 1,
0, 1, 0, 0,
0, 1, 0, 0
),
nrow = 4,
dimnames = list(0:3, 0:3)
)
)
# Classify costmatrix:
classify_costmatrix(costmatrix = nonlinear_ordered_costmatrix)
# Create a Type VI character costmatrix:
binary_irreversible_costmatrix <- make_costmatrix(
min_state = 0,
max_state= 1,
character_type = "irreversible"
)
# Classify costmatrix:
classify_costmatrix(costmatrix = binary_irreversible_costmatrix)
# Create a Type VII character costmatrix:
multistate_irreversible_costmatrix <- make_costmatrix(
min_state = 0,
max_state= 2,
character_type = "irreversible"
)
# Classify costmatrix:
classify_costmatrix(costmatrix = multistate_irreversible_costmatrix)
# Create a Type VIII character costmatrix:
binary_dollo_costmatrix <- make_costmatrix(
min_state = 0,
max_state= 1,
character_type = "dollo"
)
# Classify costmatrix:
classify_costmatrix(costmatrix = binary_dollo_costmatrix)
# Create a Type IX character costmatrix:
multistate_dollo_costmatrix <- make_costmatrix(
min_state = 0,
max_state= 2,
character_type = "dollo"
)
# Classify costmatrix:
classify_costmatrix(costmatrix = multistate_dollo_costmatrix)
# Create a Type X character costmatrix:
multistate_symmetric_costmatrix <- make_costmatrix(
min_state = 0,
max_state= 5,
character_type = "ordered"
)
multistate_symmetric_costmatrix$type <- "custom"
multistate_symmetric_costmatrix$costmatrix <- matrix(
data = c(
0, 1, 2, 3, 2, 3,
1, 0, 3, 2, 1, 2,
2, 3, 0, 3, 2, 1,
3, 2, 3, 0, 1, 2,
2, 1, 2, 1, 0, 1,
3, 2, 1, 2, 1, 0
),
nrow = multistate_symmetric_costmatrix$size,
ncol = multistate_symmetric_costmatrix$size,
byrow = TRUE,
dimnames = list(
multistate_symmetric_costmatrix$single_states,
multistate_symmetric_costmatrix$single_states
)
)
# Classify costmatrix:
classify_costmatrix(costmatrix = multistate_symmetric_costmatrix)
# Create a Type XI character costmatrix:
binary_asymmetric_costmatrix <- make_costmatrix(
min_state = 0,
max_state= 1,
character_type = "ordered"
)
binary_asymmetric_costmatrix$type <- "custom"
binary_asymmetric_costmatrix$costmatrix <- matrix(
data = c(
0, 1,
10, 0
),
nrow = binary_asymmetric_costmatrix$size,
ncol = binary_asymmetric_costmatrix$size,
byrow = TRUE,
dimnames = list(
binary_asymmetric_costmatrix$single_states,
binary_asymmetric_costmatrix$single_states
)
)
binary_asymmetric_costmatrix$symmetry <- "Asymmetric"
# Classify costmatrix:
classify_costmatrix(costmatrix = binary_asymmetric_costmatrix)
# Create a Type XII character costmatrix:
multistate_asymmetric_costmatrix <- make_costmatrix(
min_state = 0,
max_state= 2,
character_type = "ordered"
)
multistate_asymmetric_costmatrix$type <- "custom"
multistate_asymmetric_costmatrix$costmatrix <- matrix(
data = c(
0, 1, 1,
1, 0, 1,
10, 10, 0
),
nrow = multistate_asymmetric_costmatrix$size,
ncol = multistate_asymmetric_costmatrix$size,
byrow = TRUE,
dimnames = list(
multistate_asymmetric_costmatrix$single_states,
multistate_asymmetric_costmatrix$single_states
)
)
multistate_asymmetric_costmatrix$symmetry <- "Asymmetric"
# Classify costmatrix:
classify_costmatrix(costmatrix = multistate_asymmetric_costmatrix)
Run the code above in your browser using DataLab