symbolic_to_relprob_matrix_sp: Convert symbolic matrix (with text equations) to relprob...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/BioGeoBEARS_basics_v1.R

Description

This does the equivalent of symbolic_to_P_matrix, but for a speciation/cladogenesis matrix.

Usage

1
2
3
4
  symbolic_to_relprob_matrix_sp(spmat, cellsplit = "\\+",
    mergesym = "*", ys = 1, j = 0, v = 1,
    maxent_constraint_01 = 1e-04,
    maxent_constraint_01v = 1e-04, max_numareas = 6, ...)

Arguments

spmat

The speciation/cladogenesis matrix, with text formula.

cellsplit

The symbol to split the formulas on. Default "\\+" (plus symbol, with escape code).

mergesym

The symbol to merge the formulas with. Default "+".

ys

Relative weight of fully sympatric speciation (range-copying) and sympatric "subset" speciation. Default s=1 mimics LAGRANGE model.

v

Relative weight of vicariant speciation. Default v=1 mimics LAGRANGE model.

j

Relative weight of "founder event speciation"/jump speciation. Default j=0 mimics LAGRANGE model.

maxent_constraint_01

Parameter which assigns relative probabilities to different descendants range sizes, for the smaller descendant. Values can range from 0.0001 to 1. If maxent_constraint_01=0.0001, then the smaller descendant has a range size of 1 with probability 1 (i.e., the LAGRANGE default). If maxent_constraint_01=0.5, then all range sizes are equally weighted. If maxent_constraint_01=1, then the largest possible smaller descendant gets probability 1. The reference to "maxent" derives from the fact that the maxent probability distribution on a multistate, ordered, discrete variable – e.g. a die roll – can be calculated given just the mean value. Here, the maxent_constraint_01 parameter is multiplied by the (maximum rangesize + 1). Thus, when maxent_constraint_01=0.5, if there are 6 possible states, then the parameter becomes 3.5, which sets equal probabilities of all possible descendant ranges sizes, when range size can range from 1 to 6.

maxent_constraint_01v

Works the same as maxent_constraint_01, but just for descendants of vicariant events.

max_numareas

The maximum number of areas possible allowed for the smaller-ranged-daughter in either vicariant or sympatric types of cladogenesis/speciation.

...

Additional arguments to pass to relative_probabilities_of_subsets and relative_probabilities_of_vicariants, and thence to strsplit.

Details

These are 1-event probability matrices, not instantaneous rate matrices.

This function uses symbolic_cell_to_relprob_cell_sp in an sapply call. It still will not be very fast compared to the calculations in cladoRcpp, but can be useful for demonstrative purposes.

Value

cellval The output cell value.

Note

Go BEARS!

Author(s)

Nicholas J. Matzke matzke@berkeley.edu

References

http://phylo.wikidot.com/matzke-2013-international-biogeography-society-poster https://code.google.com/p/lagrange/

Matzke_2012_IBS

ReeSmith2008

See Also

symbolic_cell_to_relprob_cell_sp, make_relprob_matrix_de

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
testval=1
# Generate the text version of the speciation/cladogenesis probability matrix
# (actually a relative weights matrix
# until the rows are normalized so that each sums to 1).
spmat = make_relprob_matrix_bi(states_list=list("_", c("A"), c("B"), c("C"),
c("A","B"), c("B","C"), c("A","C"), c("A","B","C")), split_ABC=FALSE, splitval="",
code_for_overlapping_subsets=NA, printwarn=1)
spmat

# Look at the conditional probabilities generated by a variety of models
spPmat = symbolic_to_relprob_matrix_sp(spmat=spmat, cellsplit="\\\\+", mergesym="*",
ys=1, j=0, v=1, maxent_constraint_01=0.0001, maxent_constraint_01v=0.0001,
max_numareas=3)
spPmat = adf(spPmat); names(spPmat) = names(spmat); rownames(spPmat) = rownames(spmat)
spPmat

spPmat = symbolic_to_relprob_matrix_sp(spmat=spmat, cellsplit="\\\\+",
mergesym="*", ys=0.5, j=0, v=0.5, maxent_constraint_01=0.0001,
maxent_constraint_01v=0.0001, max_numareas=3)
spPmat = adf(spPmat); names(spPmat) = names(spmat); rownames(spPmat) = rownames(spmat)
spPmat

spPmat = symbolic_to_relprob_matrix_sp(spmat=spmat, cellsplit="\\\\+",
mergesym="*", ys=1, j=1, v=1, maxent_constraint_01=0.0001,
maxent_constraint_01v=0.0001, max_numareas=3)
spPmat = adf(spPmat); names(spPmat) = names(spmat); rownames(spPmat) = rownames(spmat)
spPmat

spPmat = symbolic_to_relprob_matrix_sp(spmat=spmat, cellsplit="\\\\+",
mergesym="*", ys=0.25, j=0.25, v=0.25, maxent_constraint_01=0.0001,
maxent_constraint_01v=0.0001, max_numareas=3)
spPmat = adf(spPmat); names(spPmat) = names(spmat); rownames(spPmat) = rownames(spmat)
spPmat

spPmat = symbolic_to_relprob_matrix_sp(spmat=spmat, cellsplit="\\\\+",
mergesym="*", ys=1, j=1, v=0, maxent_constraint_01=0.0001,
maxent_constraint_01v=0.0001, max_numareas=3)
spPmat = adf(spPmat); names(spPmat) = names(spmat); rownames(spPmat) = rownames(spmat)
spPmat

spPmat = symbolic_to_relprob_matrix_sp(spmat=spmat, cellsplit="\\\\+",
mergesym="*", ys=1, j=1, v=0, maxent_constraint_01=0.5,
maxent_constraint_01v=0.0001, max_numareas=3)
spPmat = adf(spPmat); names(spPmat) = names(spmat); rownames(spPmat) = rownames(spmat)
spPmat

spPmat = symbolic_to_relprob_matrix_sp(spmat=spmat, cellsplit="\\\\+",
mergesym="*", ys=1, j=0, v=0, maxent_constraint_01=0.5,
maxent_constraint_01v=0.0001, max_numareas=3)
spPmat = adf(spPmat); names(spPmat) = names(spmat); rownames(spPmat) = rownames(spmat)
spPmat

spPmat = symbolic_to_relprob_matrix_sp(spmat=spmat, cellsplit="\\\\+",
mergesym="*", ys=1, j=0, v=1, maxent_constraint_01=0.0001,
maxent_constraint_01v=0.5, max_numareas=3)
spPmat = adf(spPmat); names(spPmat) = names(spmat); rownames(spPmat) = rownames(spmat)
spPmat

BioGeoBEARS documentation built on May 29, 2017, 8:36 p.m.