Evaluate change in objective function and likelihood components for up to 2 parameters.
Usage
# S4 method for class 'MSAassess'
profile(
fitted,
p1,
v1,
p2,
v2,
use_fitted = TRUE,
return_models = TRUE,
cores = 1,
...
)
get_likelihood_components(fitted)
# S3 method for class 'MSAprof'
plot(
x,
component = "objective",
rel = TRUE,
xlab,
ylab,
main,
plot2d = c("contour", "filled.contour"),
...
)Arguments
- fitted
- p1
Character string that represents the first parameter to be profiled, including the parameter name and index of the vector/array. See "Parameters" section of
make_parameters(). Additionally, this function allows users to specifyR0_sandh_s(in normal units).- v1
Vector of values corresponding to
p1- p2
Character string that represents the optional second parameter to be profiled
- v2
Vector of values corresponding to
p2- use_fitted
Logical, whether to use estimated parameters or the starting values in
fittedto start the profile- return_models
Logical, whether to return fitted models in the profile
- cores
Integer for the number of cores to use for parallel processing
- ...
Other argument to the base graphics function, i.e., either plot() or contour()
- x
Output from
profile.MSAassess()- component
Character for the column in
xto be plotted- rel
Logical, whether the relative change in
componentis plotted (TRUE) or the raw values (FALSE)- xlab
Optional character for the x-axis label
- ylab
Optional character for the y-axis label
- main
Optional character for the plot title
- plot2d
Character, plotting function for two-dimensional profiling (either a
contour()orfilled.contour()plot)
Value
Named list (length 2).
First, profile contains a data frame of the likelihood values that correspond to
fixed values of p1 and p2. Other columns:
Likelihood
loglikerefers to maximizing the probability of the observed data (higher values for better fit)Prior
logpriorrefers to maximizing the probability of a parameter to their prior distribution (higher values are closer to the prior mode)Penalty
penaltyare values added to the objective function when parameters exceed model bounds (lower values are better)fnis the objective function returned by RTMB (lower values are better)objectiveis the objective function returned by the optimizer (lower values are better)
Second, fits contains a list of the MSAassess objects if return_models = TRUE.
get_likelihood_components() returns a data.frame of the components to the objective function (log-likelihoods, log-priors, etc.)
as well as some diagnostic information: maximum gradient (maxgrad) and convergence (conv)
The accompanying plot function returns a line plot for a 1-dimensional profile or a contour plot for a two dimensional profile. Will plot the negative log likelihood or negative log prior (better fit with lower values).
Relative values are obtained by subtracting from the fitted value. See attr(x$profile, "fitted")