This is the pre-byte compiled version of rcpp_calc_anclikes_sp
. rcpp_calc_anclikes_sp
is
byte-compiled, which (might) make it faster. See rcpp_calc_anclikes_sp
for full description and help.
rcpp_calc_anclikes_sp_prebyte(Rcpp_leftprobs, Rcpp_rightprobs, l, s = 1,
v = 1, j = 0, y = 1, dmat = NULL, maxent01s = NULL,
maxent01v = NULL, maxent01j = NULL, maxent01y = NULL,
max_minsize_as_function_of_ancsize = NULL, Rsp_rowsums = rep(1,
length(Rcpp_leftprobs)), printmat = FALSE)
Probabilities of the states at the base of the left descendant branch
Probabilities of the states at the base of the right descendant branch
List of state indices (0-based)
Relative weight of sympatric "subset" speciation. Default s=1
mimics LAGRANGE model.
Relative weight of vicariant speciation. Default v=1
mimics LAGRANGE model.
Relative weight of "founder event speciation"/jump speciation. Default j=0
mimics LAGRANGE model.
Relative weight of fully sympatric speciation (range-copying). Default y=1
mimics LAGRANGE model.
If given, a matrix of rank numareas giving multipliers for the probability
of each dispersal event between areas. Default NULL, which sets every cell of the
dmat
matrix to value 1. Users may construct their own parameterized dmat
(for example, making dmat
a function of distance) for inclusion in ML or
Bayesian analyses.
Matrix giving the relative weight of each possible descendant rangesize for
the smaller range, for a given ancestral rangesize, for a subset-sympatric speciation event.
Default is NULL
, which means the script will set up the LAGRANGE model (one descendent
always has range size 1).
Matrix giving the relative weight of each possible descendant rangesize for
the smaller range, for a given ancestral rangesize, for a vicariance speciation event.
Default is NULL
, which means the script will set up the LAGRANGE model (one descendent
always has range size 1).
Matrix giving the relative weight of each possible descendant rangesize for
the smaller range, for a given ancestral rangesize, for a founder-event speciation event.
Default is NULL
, which means the script will set up the LAGRANGE model (one descendent
always has range size 1).
Matrix giving the relative weight of each possible descendant rangesize for
the smaller range, for a given ancestral rangesize, for a full-sympatric (range-copying)
speciation event.
Default is NULL
, which means the script will set up the LAGRANGE model (one descendent
always has range size 1).
If given, any state with a range larger that this value will be given a probability of zero (for the branch with the smaller rangesize). This means that not every possible combination of ranges has to be checked, which can get very slow for large state spaces.
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...)
prob_ancestral_states
The probabilities of the ancestral states.
This function gets slow for large state spaces.
For information on byte-compiling, see http://www.r-statistics.com/2012/04/speed-up-your-r-code-using-a-just-in-time-jit-compiler/ and cmpfun
in the compiler
package.
rcpp_calc_anclikes_sp
#bibliography /Dropbox/_njm/__packages/cladoRcpp_setup/cladoRcpp_refs.bib
@cite Matzke_2013
@cite Matzke_2014
@cite ReeSmith2008
# NOT RUN {
# For the basic logic of a probablistic cladogenesis model, see
?rcpp_calc_anclikes_sp
# For examples of running the functions, see the comparison of all functions at:
# ?cladoRcpp
# }
Run the code above in your browser using DataLab