Description Usage Arguments Value Examples
View source: R/fbd.likelihood.R
Maximum likelihood estimation of birth, death and sampling rates for a given set of stratigraphic ranges under the FBD model
1 2 3 | fbd.likelihood.est(b, d, s, k, frs, est.b = T, est.d = T, est.s = F,
lower.b = 0.001, lower.d = 0.001, lower.s = 0.001, upper.b = 10,
upper.d = 10, upper.s = 100, complete = F)
|
b |
Initial value for birth rate |
d |
Initial value for death rate |
s |
Initial value for sampling rate |
k |
Number of fossils |
frs |
Dataframe of species ranges including first birth and death time, first appearance, number of co-existing lineages and extant indicator |
est.b |
If TRUE estimate birth rate, else fix birth rate to the initial value (default = T) |
est.d |
If TRUE estimate death rate, else fix death rate to the initial value (default = T) |
est.s |
If TRUE estimate sampling rate, else fix death sampling to the initial value (default = F) |
complete |
If TRUE assume complete species sampling (default = F) |
Named list including parameter estimates and likelihood
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # simulate tree & fossils
birth = 1
death = 0.1
t = TreeSim::sim.bd.taxa(100, 1, birth, death)[[1]]
psi = 1
f = FossilSim::sim.fossils.poisson(psi, t)
k = length(f$h)
# add extant occurrences
f = FossilSim::add.extant.occ(t, f)
# asymmetric taxon mapping
f = FossilSim::asymmetric.fossil.mapping(t, f)
# calculate range attachment times given incomplete sampling
frs = FossilSim::attachment.times(t,f)
# rename range data headers
names(frs)[2]<-"bi"
names(frs)[3]<-"di"
names(frs)[4]<-"oi"
frs = recount.extant(frs)
frs = recount.gamma(frs)
# estimate
fbd.likelihood.est(birth, death, psi, k, frs)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.