Log-likelihood values for the NB estimator

Share:

Description

This will return return the log-likelihood value given a value of N.

Usage

1
NB.likelihood(N, infile, alleles, sample.interval)

Arguments

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.

Details

More details please see NB.estimator.

Value

This function returns one single element, the log-likelihood of the model given the effective population size N and your inputs.

Note

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.

See Also

NB.estimator.

Examples

 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
	#####