lik_profile | R Documentation |
The aim of the function is two-fold: 1) estimate a 95% confidence
around each parameter of a calibrated model, and 2) see if perhaps a local minimum was found rather
than a global minimum. To achieve this, the likelihood profiling goes through
every parameter one by one. For each parameter,
the model is sequentially refit with the parameter value set to
increasingly lower and higher values, and the likelihood of the model given the
data calculated (using log_lik()
). The likelihood is then compared
to the likelihood of the original model (using a likelihood ratio). This leads
to the development of a likelihood profile, from which a plot a 95%
confidence interval for the parameter is derived.
The idea of the function is a variable stepwise algorithm:
When the likelihood ratio changes very little (less than l_crit_min
), the stepsize is
increased (up to a maximum, specified by f_step_max
). When the lik.
ratio changes too much (more than l_crit_max
), the algorithm tries again
with a smaller stepsize (also bound to a minimum: f_step_min
). Note that
the stepsize is used as a fraction of the parameter value that is tried.
To prevent very small stepsizes when the value goes towards zero (as can
be the case for effect thresholds), an absolute minimum
stepsize (f_step_abs
), which is specified as a fraction of the best
parameter value (Xhat
) (unless it is zero, then the algorithm takes
something small).
Note that the likelihood of the model given the data can be calculated across
all datasets provided in the calibration set x
, or calculated separately for
each individual dataset before being combined into one likelihood (by adjusting
the optional parameter individual
). The latter
has the advantage that different datasets can be given different weights in
the likelihood calculation (using the "weight" slot of the caliset objects,x
).
Further, for continuous data (e.g. biomass), the likelihood considers the variance (standard
deviation) in the log likelihood calculation, which can vary between datasets
when the likelihood is calculated for each dataset separately before combining
into an overall likelihood. The latter could be relevant when factors might lead
to variability between datasets (e.g. different labs, different animal culture,...)
To conduct the likelihood calculations on separate datasets, the parameter individual
which by default is 'FALSE' can be set to 'TRUE'. Then, then log likelihoods
are calculated for each dataset individually (or in subgroups, using the "tag" names of the
caliset object, if provided, to group datasets with the same "tag"
before calculating the log likelihood). Subsequently, the log
likelihoods for the subsets are combined into an overall likelihood (considering
the set weights provided in the "weight" slot of the caliset object).
Note that for each set only 1 weight can be provided (i.e. not individual
weights for each datapoint within the set), and that set with the same tag
should have identical weight.
The function was inspired by a MatLab BYOM v.6.8 procedure, created by Tjalling Jager. For details, please refer to BYOM (http://debtox.info/byom.html) as well as Jager (2021).
lik_profile(
x,
par,
output,
data = NULL,
bounds = NULL,
refit = TRUE,
type = c("coarse", "fine"),
individual = FALSE,
break_prof = FALSE,
log_scale = FALSE,
data_type = c("continuous", "count"),
...
)
x |
either a single scenario or a list of caliset objects |
par |
named vector - parameters (names and values) to be profiled |
output |
character vector, name of output column of |
data |
only needed if |
bounds |
optional list of lists (including lower and upper bound): uses defaults in |
refit |
if |
type |
|
individual |
if |
break_prof |
If |
log_scale |
|
data_type |
Character argument, |
... |
additional parameters passed on to |
A list containing, for each parameter profiled, the likelihood profiling results as a dataframe; the 95% confidence interval; the original parameter value; the likelihood plot object; and the recalibrated parameter values (in case a lower optimum was found)
Jager T, 2021: Robust Likelihood-Based Optimization and Uncertainty Analysis of Toxicokinetic-Toxicodynamic Models. Integrated Environmental Assessment and Management 17:388-397. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/ieam.4333")}
# Example with Lemna model - physiological params
library(dplyr)
# observations - control run
obs <- schmitt2013 %>%
filter(trial == "T0")
# update metsulfuron
myscenario <- metsulfuron %>%
set_param(c(k_phot_fix = TRUE, Emax = 1)) %>%
set_init(c(BM = 0.0012)) %>%
set_noexposure() %>%
set_bounds(list(k_phot_max=c(0, 1)))
fit <- calibrate(
x = myscenario,
par = c(k_phot_max = 1),
data = obs,
output = "FrondNo",
method = "Brent"
)
# Likelihood profiling
res <- lik_profile(
x = myscenario,
data = obs,
output = "FrondNo",
par = fit$par,
bounds = list(
k_phot_max = list(0, 30)
),
refit = FALSE,
type = "fine",
method = "Brent"
)
# plot
plot(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.