evaluate_epsilon_gradient#

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

Evaluate the numeric epsilon 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_epsilon_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_epsilon_gradient(model, etas=etas)
     dY/dEPS_1
0     17.771084
1     28.881859
2     11.441728
3     21.113050
4     29.783055
..          ...
150   25.375041
151   31.833395
152   22.876707
153   31.905095
154   38.099690

[155 rows x 1 columns]

See also

evaluate_eta_gradient

Evaluate the eta gradient