R: Run the EM for several values of K

format_output {PhylogeneticEM} | R Documentation

## Run the EM for several values of K

### Description

`estimateEM_several_K.OUsr` uses function `estimateEM` on the data, for all values of K between 0 and K_max.

### Usage

    format_output(results_estim_EM, phylo, time = NA)

### Arguments

`results_estim_EM` | output of function `estimateEM`
`time` | to run the function

### Details

The EM is first launched for K=0, with alpha and gamma estimated. The estimated values of alpha, gamma and beta_0 found by this first EM are then used as initialization parameters for all the other runs of the EM for other K. The EMs are parallelized thanks to packages `foreach` and `doParallel`. WARNING : this code only work of OU with stationary root, on an ultrametric tree.

### Value

summary a data frame with K_max lines, and columns: - alpha_estim the estimated selection strength - gamma_estim the estimated root variance - beta_0_estim the estimated value of root optimum - EM_steps number of iterations needed before convergence - DV_estim has the EM diverged ? - CV_estim has the EM converged ? - log_likelihood log likelihood of the data using the estimated parameters - mahalanobis_distance_data_mean the Mahalanobis distance between the data and the estimated means at the tips - least_squares the Mahalanobis distance, renormalized by gamma^2: mahalanobis_distance_data_mean * gamma_estim. - mean_number_new_shifts the mean number of shifts that changed over the iterations of the EM - number_equivalent_solutions the number of equivalent solutions to the solution found. - K_try the number of shifts allowed. - complexity the complexity for K_try - time the CPU time needed.

params a list of inferred parameters

params_init a list of initial parameters

alpha_0 initial values of alpha

gamma_0 initial values of gamma

Zhat reconstructed node states

m_Y_estim reconstructed tip states

edge.quality for each edge, relative number of iterations in which they were present.

[Package PhylogeneticEM version 1.1.0 Index]