Learn R Programming

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

PhylogeneticEM (version 1.0.0)

Automatic Shift Detection using a Phylogenetic EM

Description

Implementation of the automatic shift detection method for Brownian Motion (BM) or Ornstein–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

271

Version

1.0.0

License

GPL (>= 2) | file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Paul Bastide

Last Published

January 31st, 2017

Functions in PhylogeneticEM (1.0.0)

clusters_from_shifts

Clustering associated to a shift allocation, assuming no homoplasy.
check.selection.strength

Check selection strength
check_parsimony

Check Parsimony, assuming no homoplasy
check_dimensions

Check dimensions of the parameters
check_parsimony_clusters

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

Test the format of data entry.
compute_expectations.scOU

Compute the expected states of a scOU
compute_fixed_moments

Compute fixed moments for E step.
compute_gauss_lasso

Do a lm on top of a lasso regression.
compute_expectations.BM

Compute the expected states of a BM
compute_diff_exp.BM

Compute differences of expectations between node and parent.
compute_dist_phy

Phylogenetic Distances
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_log_likelihood.simple

Log Likelihood
compute_E.simple

E step
compute_state_filter

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

Compute the stationary variance matrix
compute_sum_var_diff

Compute weighted sum of var_diff
compute_times_ca

Comon Ancestors Times
compute_residuals.simple

Residuals
compute_shifts_from_betas

Computation of shifts from the vector of optimal values
compute_tree_correlations_matrix.BM

Matrix of tree-induced correlations for the BM
compute_mahalanobis_distance.simple

Squared Mahalanobis Distance
compute_tree_correlations_matrix.scOU

Matrix of tree-induced correlations for the scOU
compute_mean_variance.simple

Compute moments of params_old
enlight

Make the result lighter
enumerate_tips_under_edges

Tips descendants of nodes.
equivalent_shifts_values

Find values given edges. OU stationary case. Ultrametric tree.
equivalent_shifts_edges

Find all the equivalent shift edges allocations.
compute_variance_covariance.scOU

Complete variance covariance matrix for scOU
correspondenceEdges

Correspondence between edges numbers
compute_var_diff.BM

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

Computation of the variance.
compute_variance_covariance.BM

Complete variance covariance matrix for BM
compute_variance_covariance.OU

Complete variance covariance matrix for OU
estimate.alpha

Function to estimate alpha
extract.enumerate_parsimony

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

Extract from object partitionsNumber
extract.simul_process

Extraction of simulated traits
extract.equivalent_shifts

Extract the shifts values for one trait.
extract

Extraction function
extract.variance_covariance

Extract sub-matrices of variance.
extract.parsimonyCost

Extraction of the actual number of solutions.
find_grid_alpha

Find a reasonable grid for alpha
extract.parsimonyNumber

Extraction of the actual number of solutions.
imputed_traits

Ancestral State Reconstruction
incidence_matrix_actualization_factors

Compute the actualizations factors to apply to the incidence matrix.
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.
init.alpha.gamma.estimation

Initialisation the selection strength alpha using robust estimation
penalty_BirgeMassart_shape1

Penalty function type Birgé-Massart 1
penalty_BaraudGiraudHuet_likelihood

Penalty function type Baraud Giraud Huet.
get_variance_node

Get variance matrix of a node
format_output

Run the EM for several values of K
init.parsimonyNumber

Initialization for parsimonyNumber.
init.simulate.BM

Initialize BM
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.
parsimonyNumber

Number of equivalent parsimonious allocations.
partitionsNumber

Number of different models
plot.params_process

Plot for class simul_process
plot.equivalent_shifts

Plot all the equivalent solutions.
init.incidence.matrix.full

Initialization for incidence matrix (full tree)
init.enumerate_parsimony

Initialization for the enumeration of parsimonious solutions.
merge_complementary_vectors

Merge several complementary vectors into one.
merge_params_independent

Merge a list of independent parameters into into one parameter
qr.solve_exact

exact qr.solve
recursionDown

Generic recursion down the tree.
shifts.list_to_matrix

Compute the matrix of shifts.
shifts.list_to_vector

Compute the vector of shifts.
sum.simplex

Sum on a simplex
allocate_shifts_from_regimes

Allocation of shifts to edges
test.root.state

Test state of root.
allocate_subset_node.simulate

Iteration allocation
go_back_to_original_process

Scale the parameters back to the original process
model_selection

Model Selection of a fitted object
init.parsimonyCost

Initialization for parsimonyCost.
init.incidence.matrix

Initialization for incidence matrix
impute.data.Rphylopars

Initial imputation of missing data for lasso
monkeys

New World Monkeys dataset
params_OU

Create an object params_process for an OU
PhyloEM

Model Estimation with Detection of Shifts
plot.enumerate_parsimony

Plot all the equivalent solutions.
sum.partitions

Sum on all subsets.
sum.prod.comb

Sum on a simplex
update.incidence.matrix

Update function for incidence matrix
incidence.matrix

Incidence matrix of a tree.
incidence.matrix.full

Incidence matrix of a tree.
update.parsimonyCost

Actualization for parsimonyCost.
init.compute_betas_from_shifts

Initialisation for the computation of the optimal values
init.EM.lasso

Initialisation of the shifts using Lasso.
log_likelihood

Log Likelihood of a fitted object
matrix_of_possibles

Compute parent matrix from possibles daughter matrices.
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
segmentation.OU.specialCase.same_shifts

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

Simmap format mapping from list of edges
add_complementary

Add several entries, when only one is not NA.
allocate_regimes_from_shifts

Allocation of regimes to nodes.
segmentation.BM

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

Segmentation in the OU special case, using lasso regression
split_params_independent

Split independent parameters into a list of parameters
update.enumerate_parsimony

Actualization of the enumeration.
sum.partitions.cardFixed

Sum on subsets of a given cardinal.
init.simulate.OU

Initialize state and expectation matrices
update.incidence.matrix.full

Update function for incidence matrix
params_process.PhyloEM

Parameter estimates
init.simulate.StateAndExp

Initialize state and expectation matrices
parsimonyCost

Minimal number of shifts needed to get a clustering.
penalty_pBIC

Penalty function type pBIC
penalty_BirgeMassart_shape2

Penalty function type Birgé-Massart 2
sample_shifts_edges

Sample shifts edges in a parsimonious way.
plot.PhyloEM

Plot for class PhyloEM
params_process.character

Create an object params_process
update.parsimonyNumber

Actualization for parsimonyNumber.
scale_params

Scale variance and selection strenght from a linear transform
residuals.PhyloEM

Residuals of a fitted object
prod.index

Product of elements of a matrix
sample_edges_intervals

Sample equally espaced edges.
shifts.matrix_to_list

Compute the list of shifts.
wrapper_E_step

Wrapper for E step in EM
shifts.vector_to_list

Compute the list of shifts.
transform_branch_length

Transform branch length for a re-scaled BM
simul_process

Simulate a Stochastic Process on a tree
simulate_internal

Simulate a Stochastic Process on a tree
transform_shifts_values

Transform the shift values
update.allocate_regimes_from_shifts

Update function for regime allocation.
update.compute_betas_from_shifts

Update function ofr optimal value computation
update.partitionsNumber.gen

Update formula in the general case