View source: R/datalow_utils.r
multinomLL | R Documentation |
multinomLL calculates the negative log-likelihood for the multinomial distribution. Commonly used with length and age composition data in assessment models. Zero observations in particular categories do not matter as the equation is - Sum(Obs x log(expected-proportion)). Thus zeros in the observations just contribute zero to the sum.
multinomLL(counts, predprop)
counts |
the observed counts in each category (age or length) that is to be fitted by the model |
predprop |
the predicted proportions in each category. One needs a separate function to calculate this. |
a single scalar value, the -veLL
## Not run:
obs <- c(0,5,11,19,12,3,0,0)
expprop <- c(0.018,0.002,0.12,0.4,0.3,0.12,0.03,0.01)
multinomLL(obs,expprop) # should be 92.61393
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.