Learn R Programming

⚠️There's a newer version (1.8.0) of this package.Take me there.

PhylogeneticEM (version 1.0.1)

Automatic Shift Detection using a Phylogenetic EM

Description

Implementation of the automatic shift detection method for Brownian Motion (BM) or Ornstein<80><93>Uhlenbeck (OU) models of trait evolution on phylogenies. Some tools to handle equivalent shifts configurations are also available.

Copy Link

Version

Install

install.packages('PhylogeneticEM')

Monthly Downloads

182

Version

1.0.1

License

GPL (>= 2) | file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Paul Bastide

Last Published

May 1st, 2017

Functions in PhylogeneticEM (1.0.1)

PhyloEM

Model Estimation with Detection of Shifts
add_complementary

Add several entries, when only one is not NA.
allocate_subset_node.simulate

Iteration allocation
check.selection.strength

Check selection strength
allocate_regimes_from_shifts

Allocation of regimes to nodes.
allocate_shifts_from_regimes

Allocation of shifts to edges
check_data

Test the format of data entry.
check_dimensions

Check dimensions of the parameters
check_parsimony

Check Parsimony, assuming no homoplasy
check_parsimony_clusters

Check wether an allocation of the shifts is parsimonious, in the "infinite site model".
compute_actualization_matrix_ultrametric

Compute Matrix W of actualization (Ultrametric case)
compute_betas_from_shifts

Computation of the optimal values at nodes and tips.
compute_var_diff.BM

Compute variances of differences between nodes and parents.
compute_variance_covariance.BM

Complete variance covariance matrix for BM
compute_times_ca

Comon Ancestors Times
compute_tree_correlations_matrix.BM

Matrix of tree-induced correlations for the BM
correspondenceEdges

Correspondence between edges numbers
compute_fixed_moments

Compute fixed moments for E step.
compute_gauss_lasso

Do a lm on top of a lasso regression.
compute_mean_variance.simple

Compute moments of params_old
compute_residuals.simple

Residuals
enumerate_parsimony

Enumerate all the possible regime allocations, given a culstering of the tips.
enumerate_tips_under_edges

Tips descendants of nodes.
estimateEM

Perform One EM
extract

Extraction function
compute_expectations.BM

Compute the expected states of a BM
compute_expectations.scOU

Compute the expected states of a scOU
compute_shifts_from_betas

Computation of shifts from the vector of optimal values
compute_state_filter

List of potential daughter states when parent is in state k.
extract.partitionsNumber

Extract from object partitionsNumber
extract.simul_process

Extraction of simulated traits
is.in.ranges

Check wether parameters are in ranges.
lasso_regression_K_fixed.glmnet_multivariate

Do a lasso regression with the number of non-zero variables fixed.
enlight

Make the result lighter
extract.parsimonyCost

Extraction of the actual number of solutions.
extract.parsimonyNumber

Extraction of the actual number of solutions.
imputed_traits

Ancestral State Reconstruction
incidence.matrix

Incidence matrix of a tree.
penalty_pBIC

Penalty function type pBIC
plot.PhyloEM

Plot for class PhyloEM
plot.params_process

Plot for class simul_process
compute_tree_correlations_matrix.scOU

Matrix of tree-induced correlations for the scOU
compute_var_M.BM

Computation of the variance.
extract.enumerate_parsimony

Extract the result of enumerate_parsimony at a node.
extract.equivalent_shifts

Extract the shifts values for one trait.
compute_diff_exp.BM

Compute differences of expectations between node and parent.
compute_dist_phy

Phylogenetic Distances
compute_stationary_variance

Compute the stationary variance matrix
compute_sum_var_diff

Compute weighted sum of var_diff
equivalent_shifts_values

Find values given edges. OU stationary case. Ultrametric tree.
estimate.alpha

Function to estimate alpha
prod.index

Product of elements of a matrix
shifts.vector_to_list

Compute the list of shifts.
shifts_to_simmap

Simmap format mapping from list of edges
wrapper_E_step

Wrapper for E step in EM
extract.variance_covariance

Extract sub-matrices of variance.
find_grid_alpha

Find a reasonable grid for alpha
init.enumerate_parsimony

Initialization for the enumeration of parsimonious solutions.
init.incidence.matrix

Initialization for incidence matrix
init.parsimonyNumber

Initialization for parsimonyNumber.
format_output

Run the EM for several values of K
get_variance_node

Get variance matrix of a node
init.alpha.gamma.estimation

Initialisation the selection strength alpha using robust estimation
init.simulate.BM

Initialize BM
merge_complementary_vectors

Merge several complementary vectors into one.
merge_params_independent

Merge a list of independent parameters into into one parameter
plot.enumerate_parsimony

Plot all the equivalent solutions.
init.compute_betas_from_shifts

Initialisation for the computation of the optimal values
init.incidence.matrix.full

Initialization for incidence matrix (full tree)
init.parsimonyCost

Initialization for parsimonyCost.
find_independent_regression_vectors.glmnet_multivariate

Given a regularization path, find K selected independant variables.
find_shift_values

Find values given edges. OU stationary case. Ultrametric tree.
init.allocate_regimes_from_shifts

Initialisation for the allocation of shifts.
plot.equivalent_shifts

Plot all the equivalent solutions.
segmentation.BM

Segmentation in the BM case
segmentation.OU.specialCase.lasso

Segmentation in the OU special case, using lasso regression
update.enumerate_parsimony

Actualization of the enumeration.
params_OU

Create an object params_process for an OU
params_process.PhyloEM

Parameter estimates
qr.solve_exact

exact qr.solve
init.EM.lasso

Initialisation of the shifts using Lasso.
recursionDown

Generic recursion down the tree.
segmentation.OU.specialCase.same_shifts

Segmentation in the OU special case, conserving the same shifts position.
shifts.list_to_matrix

Compute the matrix of shifts.
sum.simplex

Sum on a simplex
optimize_costs_given_shift_position.OU.specialCase

Minimization of the sum of costs, given the shift position.
params_BM

Create an object params_process for a BM
partitionsNumber

Number of different models
update.incidence.matrix

Update function for incidence matrix
test.root.state

Test state of root.
update.parsimonyNumber

Actualization for parsimonyNumber.
update.partitionsNumber.gen

Update formula in the general case
penalty_BaraudGiraudHuet_likelihood

Penalty function type Baraud Giraud Huet.
simul_process

Simulate a Stochastic Process on a tree
simulate_internal

Simulate a Stochastic Process on a tree
transform_branch_length

Transform branch length for a re-scaled BM
transform_shifts_values

Transform the shift values
init.simulate.OU

Initialize state and expectation matrices
init.simulate.StateAndExp

Initialize state and expectation matrices
params_process

Create an object params_process
params_process.character

Create an object params_process
clusters_from_shifts

Clustering associated to a shift allocation, assuming no homoplasy.
compute_E.simple

E step
compute_log_likelihood.simple

Log Likelihood
compute_mahalanobis_distance.simple

Squared Mahalanobis Distance
compute_variance_covariance.OU

Complete variance covariance matrix for OU
compute_variance_covariance.scOU

Complete variance covariance matrix for scOU
parsimonyCost

Minimal number of shifts needed to get a clustering.
parsimonyNumber

Number of equivalent parsimonious allocations.
residuals.PhyloEM

Residuals of a fitted object
equivalent_shifts

Find all equivalent shifts allocations and values.
equivalent_shifts_edges

Find all the equivalent shift edges allocations.
go_back_to_original_process

Scale the parameters back to the original process
impute.data.Rphylopars

Initial imputation of missing data for lasso
incidence.matrix.full

Incidence matrix of a tree.
incidence_matrix_actualization_factors

Compute the actualizations factors to apply to the incidence matrix.
log_likelihood

Log Likelihood of a fitted object
matrix_of_possibles

Compute parent matrix from possibles daughter matrices.
model_selection

Model Selection of a fitted object
monkeys

New World Monkeys dataset
penalty_BirgeMassart_shape1

Penalty function type Birg<U+00E9>-Massart 1
sample_edges_intervals

Sample equally espaced edges.
shifts.list_to_vector

Compute the vector of shifts.
shifts.matrix_to_list

Compute the list of shifts.
update.allocate_regimes_from_shifts

Update function for regime allocation.
update.compute_betas_from_shifts

Update function ofr optimal value computation
penalty_BirgeMassart_shape2

Penalty function type Birg<U+00E9>-Massart 2
sample_shifts_edges

Sample shifts edges in a parsimonious way.
scale_params

Scale variance and selection strenght from a linear transform
split_params_independent

Split independent parameters into a list of parameters
sum.partitions

Sum on all subsets.
sum.partitions.cardFixed

Sum on subsets of a given cardinal.
sum.prod.comb

Sum on a simplex
update.incidence.matrix.full

Update function for incidence matrix
update.parsimonyCost

Actualization for parsimonyCost.