rcpp_calc_anclikes_sp_using_COOprobs {cladoRcpp}R Documentation

Calculate ancestral likelihoods given a COO-like probability matrix


This function does a pass through a COO-like transition probability matrix for a node, inputting the probabilities that have been passed down from above for the left and right branch, and the sum of weights for each ancestral state, and returns the ancestral relative probabilities.


rcpp_calc_anclikes_sp_using_COOprobs(Rcpp_leftprobs, Rcpp_rightprobs,
  RCOO_left_i_list, RCOO_right_j_list, RCOO_probs_list, Rsp_rowsums,
  printmat = TRUE)



Probabilities of the states at the base of the left descendant branch


Probabilities of the states at the base of the right descendant branch


0-based index of the allowed left states


0-based index of the allowed right states


Value of the specified nonzero cells


A vector of size (numstates) giving the sum of the relative probabilites of each combination of descendant states, assuming the probabilities of the left- and right-states are all equal (set to 1). This is thus the sum of the weights, and dividing by this normalization vector means that the each row of the speciation probability matrix will sum to 1. Default assumes the weights sum to 1 but this is not usually the case. Rsp_rowsums need only be calculated once per tree+model combination, stored, and then re-used for each node in the tree, yielding significant time savings.


Should the probability matrix output be printed to screen? (useful for debugging, but can be dramatically slow in R.app for some reason for even moderate numbers of states; perhaps overrunning the line length...)


This C++ implementation should be slightly faster than the R version, although for a simple pass through an array the difference may not be great.


R_anc_relprobs Vector of the probabilities of the ancestral states


Nicholas Matzke matzke@berkeley.edu

See Also


rcpp_calc_anclikes_sp #bibliography /Dropbox/_njm/__packages/cladoRcpp_setup/cladoRcpp_refs.bib @cite Matzke_2013 @cite Matzke_2014


# For the basic logic of a probablistic cladogenesis model, see

# For examples of running the functions, see the comparison of all functions at:
# ?cladoRcpp

[Package cladoRcpp version 0.15.1 Index]