multLL | R Documentation |
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.
multLL(pars, ages, counts, M, matchage)
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. |
the negative multinomial log-likelihood
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.