multLL: multLL calculates the negative log-likelihood for the...

View source: R/catchcurve.r

multLLR Documentation

multLL calculates the negative log-likelihood for the multinomial

Description

multLL is used when calculating the -ve log-likelihood for the multinomial used to describe the age-composition in a selectivity enhanced catch curve (see selectCC). It assumes the existence of three variables in its environment: 'age' - a vector of ages for which counts are available, 'M' the natural mortality, and 'counts' the count of each age-class in the sample. These variables need to have these specific names.

Usage

multLL(pars, ages, counts, M, matchage)

Arguments

pars

a vector containing starting estimates of the selectivity parameters inL50 - the age at which 50 twice the difference between the L50 and L95, and FF, the fishing mortality being estimated by the catch curve.

ages

the ages for which counts are available

counts

the counts of each age-class - the numbers-at-age

M

the natural mortality estimate

matchage

which ages contain data to be compared; no NAs included.

Value

the negative multinomial log-likelihood

Examples

## Not run: 
M <-  0.6
age <- 0:9
counts <- c(3,4,501,2531,936,233,76,17,5,1)
pars <- c(lm50=2.5,delta=0.5,fcur=0.6)
pp <- popN(max(age),M,pars[3],logist(pars[1],pars[2],age))
# calculate the negative log-likelihood
-dmultinom(counts,sum(counts),pp,log=TRUE)
# calculate the negative log-likelihood in a manner suitable for optim
matchage <- 1:10 # a value for each age
multLL(pars,age,counts,M,matchage)  

## End(Not run)

haddonm/datalowSA documentation built on Nov. 5, 2023, 6:40 p.m.