Description Usage Arguments Details Value Note See Also Examples
View source: R/NB.likelihood.R
This will return return the log-likelihood value given a value of N.
1 | NB.likelihood(N, infile, alleles, sample.interval)
|
N |
The effective population size dor diploid individuals. |
infile |
Your input data file in a plain text format. This data contains the allele counts at each locus and from each sampling time point. |
alleles |
a vector containing the number of alleles at each locus. For example, c(4, 4, 4) would mean that 3 loci are sampled, with 4 alleles each. |
sample.interval |
a vector stating at which generations the samples were taken. For example, c(0, 8) would indicate that two samples were collected from the 0th and 8th generation. |
More details please see NB.estimator
.
This function returns one single element, the log-likelihood of the model given the effective population size N and your inputs.
This function allows you to use your own optimisation algorithms or customise the parameters using optim
or nlm
. Otherwise please use NB.estimator
which has the internal optim
wrapped inside.
1 2 3 4 5 6 7 8 9 10 11 | ## CREATE SAMPLE DATASET
NB.example.dataset()
##SEE WHAT'S THE LOG-LIKELIHOOD VALUE IS WHEN N=1000
NB.likelihood(N=1000, infile='sample_data.txt',
alleles=rep(4, 50), sample.interval=c(0, 8))
#####
# NUMERICAL RESULT
#[1] -544.0405
#####
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.