evaluate_eta_gradient#

pharmpy.modeling.evaluate_eta_gradient(model, etas=None, parameters=None, dataset=None)[source]#

Evaluate the numeric eta gradient

The gradient is evaluated at the current model parameter values or optionally at the given parameter values. The gradient is done for each data record in the model dataset or optionally using the dataset argument. The gradient is done at the current eta values or optionally at the given eta values.

This function currently only support models without ODE systems

Parameters:
  • model (Model) – Pharmpy model

  • etas (dict) – Optional dictionary of eta values

  • parameters (dict) – Optional dictionary of parameters and values

  • dataset (pd.DataFrame) – Optional dataset

Returns:

pd.DataFrame – Gradient

Examples

>>> from pharmpy.modeling import load_example_model, evaluate_eta_gradient
>>> from pharmpy.tools import load_example_modelfit_results
>>> model = load_example_model("pheno_linear")
>>> results = load_example_modelfit_results("pheno_linear")
>>> etas = results.individual_estimates
>>> evaluate_eta_gradient(model, etas=etas)
     dF/dETA_1  dF/dETA_2
0     -0.159537 -17.609116
1     -9.325893 -19.562289
2     -0.104417 -11.346161
3     -4.452951 -16.682310
4    -10.838840 -18.981836
..          ...        ...
150   -5.424423 -19.973013
151  -14.497185 -17.344797
152   -0.198714 -22.697161
153   -7.987731 -23.941806
154  -15.817067 -22.309945

[155 rows x 2 columns]

See also

evaluate_epsilon_gradient

Evaluate the epsilon gradient