Learn R Programming

invivoPKfit (version 2.0.1)

calc_hessian: Calculate Hessian

Description

Calculate Hessian matrix given parameter values and data

Usage

calc_hessian(
  pars_opt,
  pars_const,
  observations,
  modelfun,
  dose_norm,
  log10_trans
)

Value

A square numeric matrix, both dimensions the same as the length of `pars_opt`. It will have rownames and column names that are the same as the names of `pars_opt`.

Arguments

pars_opt

Named numeric: A vector of parameter values for the parameters that were optimized. For example, you can get this using [coef.pk()] with `include_type = "optim"`.

pars_const

Named numeric: A vector of parameter values for parameters that were held constant, not optimized (but are necessary to evaluate the model). For example, you can get this using [coef.pk()] with `include_type = "const"`.

observations

The data used to fit the model. For example, you can get this using [get_data.pk()].

modelfun

The name of the function that evaluates the model (passed to [log_likelihood()]).

dose_norm

Logical: Whether to dose-normalize concentrations before evaluating log-likelihood. Passed to [log_likelihood()].

log10_trans

Logical: Whether to log10-transform concentrations before evaluating log-likelihood. Passed to [log_likelihood()].

Author

Caroline Ring

Details

Calculate the Hessian matrix: the matrix of second derivatives of the objective function with respect to parameters, evaluated for a single set of parameter values for a single model and a single data set. Here, the objective function is the negative log-likelihood implemented in [log_likelihood()], evaluated jointly across the data that was used to fit the model. This is a workhorse function called by [get_hessian.pk()] and, indirectly, by [coef_sd.pk()]. When the number of optimized parameters is \(n\), the respective Hessian matrix will be \(n \times n\).