Description Usage Arguments Details Value Note See Also Examples
The concept of effective population size is imporatnt in population genetics. This function estimates the effective population size N_e from temporally-sapced genetic data using maximum likelihood method with continuous approximation.
1 2 | NB.estimator(infile, alleles, sample.interval, bound = c(50, 1e+07),
profile.likelihood=FALSE)
|
infile |
The input dataset. It should be a plain text file (*.txt) containing the number of alleles of each allele, at each locus, from each temporal sample. For example, Suppose we have i temporal samples from the focal population, j loci, and K_j alleles at locus j.
Denoting the number of copies of allele k at locus j from sample i as n_{k,j,i}, then the input format of data is as follows:
|
alleles |
A vector containing the number of alleles at each locus. For example, |
sample.interval |
A vector stating at which generations the samples were taken. For example, |
bound |
Lower and upper bound for searching for the effective population size. Default values are |
profile.likelihood |
|
The input arguments above largely follow the input format of MLNE (Wang, 2001; Wang and Whitlock, 2003) to allow users to switch between platforms with the minimal effort.
The infile should be in a plain text (*.txt) file format. It contains the same information as the input data as MLNE does. The built-in optim
optimiser is wrapped within this function.
N |
The point estimate of the effective population size N_e. |
CI |
The approximate 95% confidence interval calculated from the log-likelihood. They are the region where the log-likelihood is 2 units below the maxima. |
log.like |
The value of the maximised log-likelihood. |
profile.CI |
A list of log-likelihood values as a function of N_e within the 95% confidence interval. |
If you would like to use your own optimisation algorithm or customerise the parameters within the optim
function, please consider using NB.likelihood
from this package.
NB.likelihood
. NB.example.dataset.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## CREATE SAMPLE DATASET
NB.example.dataset()
## RUN THE FUNCTION
NB.estimator(infile='sample_data.txt', alleles=rep(4, 50),
sample.interval=c(0, 8), profile.likelihood=FALSE)
#####
## NUMERICAL RESULTS
#$N
# [1] 1241.079
#
#$CI
#[1] 594.195 6375.933
#
#$log.like
#[1] -543.9159
#####
|
[1] "sample_data.txt is generated in your working directory"
$N
[1] 1241.079
$CI
[1] 594.195 6375.933
$log.like
[1] -543.9159
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.