| merge_rotations {PhylogeneticEM} | R Documentation |
Merge fits from independent runs of PhyloEM.
Description
merge_rotations takes several fits from PhyloEM, and
merge them according to the best score (maximum likelihood or least squares).
For each number of shifts,
The datasets needs to be equal up to a rotation. This is tested thanks to a QR
decomposition, see function find_rotation.
Usage
merge_rotations(..., method.selection = NULL, tol = NULL)
Arguments
... |
objects of class |
method.selection |
(optional) selection method to be applied to the merged fit.
See |
tol |
(optional) relative numerical tolerance. See |
Value
An object of class PhyloEM, result of the merge.
Examples
## Not run:
## Load Data
data(monkeys)
## Run method
# Note: use more alpha values for better results.
res <- PhyloEM(Y_data = monkeys$dat, ## data
phylo = monkeys$phy, ## phylogeny
process = "scOU", ## scalar OU
random.root = TRUE, ## root is stationary
stationary.root = TRUE,
K_max = 10, ## maximal number of shifts
nbr_alpha = 4, ## number of alpha values
parallel_alpha = TRUE, ## parallelize on alpha values
Ncores = 2)
## Rotate dataset
rot <- matrix(c(cos(pi/4), -sin(pi/4), sin(pi/4), cos(pi/4)), nrow= 2, ncol = 2)
Yrot <- t(rot) %*% monkeys$dat
rownames(Yrot) <- rownames(monkeys$dat)
## Fit rotated dataset
# Note: use more alpha values for better results.
res_rot <- PhyloEM(Y_data = Yrot, ## rotated data
phylo = monkeys$phy,
process = "scOU",
random.root = TRUE,
stationary.root = TRUE,
K_max = 10,
nbr_alpha = 4,
parallel_alpha = TRUE,
Ncores = 2)
## Merge the two
res_merge <- merge_rotations(res, res_rot)
## Plot the selected result
plot(res_merge)
## Plot the model selection criterion
plot_criterion(res_merge)
## End(Not run)
[Package PhylogeneticEM version 1.7.0 Index]