Calls the mPTP C engine directly via .Call() — no external process,
no file parsing. Results are returned as a structured R object.
Usage
mptp(
tree,
method = c("multi", "single"),
outgroup = NULL,
outgroup_crop = FALSE,
pvalue = 0.001,
minbr = 1e-04,
seed = as.integer(Sys.time()),
quiet = FALSE
)Arguments
- tree
A path to a Newick tree file (character) or an
read.treephyloobject. Rooted and unrooted trees are both accepted.- method
Coalescent rate model:
"multi"(default, recommended) or"single".- outgroup
Character. Name of the outgroup taxon used for rooting an unrooted tree (optional; if omitted, the longest tip branch is used).
- outgroup_crop
Logical. If
TRUE, removes the outgroup after rooting (defaultFALSE).- pvalue
Numeric. Significance threshold for the likelihood ratio test (default
0.001).- minbr
Numeric. Minimum branch length; edges shorter than this are excluded from the analysis (default
0.0001).- seed
Integer. Random seed (default: current time).
- quiet
Logical. Suppress C-level progress messages (default
FALSE).
Value
An object of class "mptp_ml", a list with:
n_speciesInteger. Number of delimited species.
methodCharacter.
"multi"or"single".null_loglNumeric. Null-model log-likelihood.
best_loglNumeric. Best log-likelihood under mPTP.
pvalueNumeric. LRT p-value.
lrt_passedLogical. Whether the LRT rejected the null.
edge_countInteger. Edges longer than
minbr.total_edgesInteger. Total edges in the tree.
assignmentsData frame with columns
labelsandmptp(integer index;ptpwhenmethod = "single").