uml.lik {mixstock} | R Documentation

## Likelihoods and gradients of stock analysis models

### Description

Calculate negative log likelihoods and gradients for unconditional and conditional models

### Usage

    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

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

[Package mixstock version 0.9.2 Index]