Compute negative log-likelihood for EcoState model
Usage
compute_nll(
p,
taxa,
years,
noB_i,
type_i,
n_species,
project_vars,
DC_ij,
Bobs_ti,
Cobs_ti,
Nobs_ta_g2,
Wobs_ta_g2,
log_prior,
fit_eps,
fit_nu,
stanza_data,
settings,
control
)
Arguments
- p
list of parameters
- taxa
Character vector of taxa included in model.
- years
Integer-vector of years included in model
- noB_i
Boolean vector indicating which taxa have no B value
- type_i
character vector indicating whether a taxon is "hetero", "auto", or "detritus"
- n_species
number of species
- project_vars
function to integrate differential equation
- DC_ij
Diet projections matrix
- Bobs_ti
formatted matrix of biomass data
- Cobs_ti
formatted matrix of catch data
- Nobs_ta_g2
formatted list of age-comp data
- Wobs_ta_g2
formatted list of weight-at-age data
- log_prior
A user-provided function that takes as input the list of parameters
out$obj$env$parList()
whereout
is the output fromecostate()
, and returns a numeric vector where the sum is the log-prior probability. For examplelog_prior = function(p) dnorm( p$logq_i[1], mean=0, sd=0.1, log=TRUE)
specifies a lognormal prior probability for the catchability coefficient for the firsttaxa
with logmean of zero and logsd of 0.1- fit_eps
Character-vector listing
taxa
for which the model should estimate annual process errors in dB/dt- fit_nu
Character-vector listing
taxa
for which the model should estimate annual process errors in consumptionQ_ij
- stanza_data
output from
make_stanza_data
- settings
Output from
stanza_settings()
, used to define age-structured dynamics (called stanza-groups).- control
output from ecostate_control
Details
Given a list of parameters, calculates the joint negative log-likelihood, where the Laplace approximation is then used to marginalize across random effects to calculate the log-marginal likelihood of fixed effects. The joint likelihood includes the fit to fishery catches, biomass indices, age-composition data, weight-at-age data, priors, and the distribution for random effects.