uml.lik: Likelihoods and gradients of stock analysis models

Description Usage Arguments Details Value Author(s) Examples

View source: R/mixstock.R

Description

Calculate negative log likelihoods and gradients for unconditional and conditional models

Usage

1
2
3
4
5
6
7
8
uml.lik(p, data, transf=c("full","part","none"), verbose=FALSE,
debug=FALSE)
cml.lik(p, sourcefreq, data, transf=c("full","part","none"),
           verbose=FALSE, fulllik=TRUE, debug=FALSE)
cml.grad(p, sourcefreq, data, transf="full",
           verbose=FALSE,fulllik=NULL,debug=FALSE)
uml.grad(p,  data, transf="full", debug=FALSE, verbose=FALSE)
dcmat.a(x,debug=FALSE)

Arguments

p

a vector of parameters.

data

a data set in mixstock.data format

sourcefreq

source frequencies

transf

how are parameters transformed?

verbose

print messages?

debug

debug?

x

vector of parameters

fulllik

for CML, give likelihood corresponding to source samples (test only)?

Details

The log likelihood is the log multinomial likelihood of the mixed population samples (data$mixsamp) given the expected frequencies in the mixed population, which are computed from the contributions and the source marker frequencies, plus the log multinomial likelihoods of the samples in each source given the marker frequencies specified for each source. dcmat.a is a utility function for the gradient calculations.

Value

Negative log likelihood, possibly plus a constant corresponding to the normalization factor

Author(s)

Ben Bolker

Examples

1
2
3
4
5
6
7
data(simex)
rfreq <- normcols(simex$sourcesamp)
tmpf <- function(p) {
  uml.lik(c(p,1-p,rfreq),simex,transf="none")
}
pvec <- seq(0.01,0.99,by=0.01)
plot(pvec,sapply(pvec,tmpf))

mixstock documentation built on May 2, 2019, 6:48 p.m.