BioGeoBEARS
. It calculates
the likelihood of the tip data (the geographic ranges
observed at the tips) given a phylogenetic tree, a Q
transition matrix specifying the model of range evolution
along branches, and a speciation probability matrix
specifying the probability of the various possible
ancestor-->(Left descendant, Right descendant) range
evolution events at phylogenetic nodes/speciation events.
calc_loglike_sp(tip_condlikes_of_data_on_each_state, phy, Qmat, spPmat = NULL, min_branchlength = 1e-21, return_what = "loglike", probs_of_states_at_root = NULL, rootedge = FALSE, sparse = FALSE, printlevel = 1, use_cpp = TRUE, input_is_COO = FALSE, spPmat_inputs = NULL, cppSpMethod = 3, cluster_already_open = NULL, calc_ancprobs = FALSE, null_range_allowed = TRUE, fixnode = NULL, fixlikes = NULL, stratified = FALSE, states_allowed_TF = NULL)
input_is_COO
.NULL
; users should
usually use spPmat_inputs
. spPmat
is A
numeric matrix representing the probability of each
ancestor range-->(Left range, Right range) transition at
cladogenesis events. There are different ways to
represent this matrix. In the simplest representation,
this is just a rectangular matrix with numstates rows
(representing the ancestral states) and numstates^2
columns (representing all possible descendant pairs).
Use of this type of matrix is specified by
cppSpMethod=1
. It is calculated from a textual
speciation matrix (typically spmat
in the code)
via symbolic_to_relprob_matrix_sp
. However,
this matrix gets huge and slow for large numbers of
states/ranges. cppSpMethod=2
and
cppSpMethod=3
implement successively more
efficient and faster representation and processing of
this matrix in COO-like formats. See
rcpp_calc_anclikes_sp_COOprobs
for the cppSpMethod=2
method, and
rcpp_calc_anclikes_sp_COOweights_faster
for the cppSpMethod=3
method (the fastest).NULL
, effectively means an equal probability for
each state (this is also what LAGRANGE
assumes;
and running with NULL will reproduce exactly the
LAGRANGE
parameter inferences and
log-likelihood).FALSE
.mat2coo
) if necessary according
to the input_is_COO
parameter.cladoRcpp
be used to speed up
calculations? Default TRUE
.TRUE
) or a standard dense
matrix (FALSE
). Default FALSE
.spPmat
(the speciation transition probability
matrix) can be calculated on-the-fly, according to the
method in cppSpMethod
. See example.spPmat_inputs
is given, the program
will generate the appropriate spPmat on-the-fly, and the
user does not have to input the full spPmat
manually.cluster_already_open =
makeCluster(rep("localhost",num_cores_to_use), type =
"SOCK")
. Note: this will work on most platforms,
including Macs running R from command line, but will NOT
work on Macs running the R GUI R.app
, because
parallel processing functions like MakeCluster
from e.g. library(parallel)
for some reason crash
R.app. The program runs a check for R.app and will just
run on 1 node if found.return_what
.
rexpokit
) and fast C++ routines
for calculating the probabilities of range inheritance
scenarios at cladogenesis (package
cladoRcpp
), major speed gains
can be achieved. Most of the complexity in the input
parameters and the code serves these more rapid
alternatives. However, note that due to the explosion of the geographic
range state space with more geographic areas (see
numstates_from_numareas
), any
computational method that explicitly calculates the
likelihood of all states will eventually become unusable
between 8-20 areas, depending on details. An alternative
method, which is fast for large numbers of areas, is
BayArea, by Landis, Matzke, Moore, and Huelsenbeck; see
Landis et al. (2013). However, BayArea does not
currently implement cladogenesis models; it only has
continuous-time model for evolutionary change along
branches. In effect, this means that the cladogenesis
model is sympatric speciation with complete range copying
with probability 1.
Matzke_2012_IBS
ReeSmith2008
calc_loglike_sp
,
rcpp_calc_anclikes_sp
,
rcpp_calc_anclikes_sp_COOprobs
,
rcpp_calc_anclikes_sp_COOweights_faster
,
mat2coo
,
rcpp_calc_anclikes_sp_COOweights_faster