Description Usage Arguments Value
View source: R/make_coalescent_data.r
Generates a list containing the data elements necessary to fit a SPMRF model to coalescent data, where effective population sizes are estimated on a uniform grid.
This function is based on code written by Michael Karcher for the phylodyn
package and expanded for use with spmrf
.
1 | make_coalescent_data(samp_times, n_sampled, coal_times, grid)
|
samp_times |
numeric vector of sampling times. |
n_sampled |
numeric vector of samples taken per sampling time. |
coal_times |
vector of coalescent times |
grid |
vector of grid boundaries (length is number of grid cells plus 1) |
A list containing
J
number of grid cells
N
number of subgrid cells
y
vector of length N
of binary indicators for whether a subgrid cell ends in a coalescent time or not
gridrep
vector of length J
containing number of subintervals in each grid cell
Aik
vector of length N
containing the binomial coefficient or 'coalescent factor' for each subgrid cell. This is equal to choose(x.k, 2), where x.k is the number of active lineages in subgrid cell k.
coalind
vector of length N
containing indicator for the coalescent event associated with each subgrid cell
ncoal
number of coalescent times, which is equal to the number of samples minus 1
ncoalv
vector of length J
containing the number of coalescent events in each grid cell
cstart
vector of length ncoal
containing the index of the starting subgrid cell in the range of subgrid cells covering the time between coalescent events
cend
vector of length ncoal
containing the index of the ending subgrid cell in the range of subgrid cells covering the time between coalescent events
dalpha
vector of length N
containing the width of each subgrid cell
rep.idx
matrix of J
by 2 where the first column contains for the index for the subgrid cell at which each grid cell starts and the second column contains the index for the subgrid cell at which each grid cell ends.
log_mu
scalar value containing the natural log of the MLE for a constant population size estimated from the coalescent data
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.