| merge_rotations | R Documentation |
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.
merge_rotations(..., method.selection = NULL, tol = NULL)
... |
objects of class |
method.selection |
(optional) selection method to be applied to the merged fit.
See |
tol |
(optional) relative numerical tolerance. See |
An object of class PhyloEM, result of the merge.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.