evaluate_weighted_residuals#

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

Evaluate the weighted residuals

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

This function currently only support models without ODE systems

Parameters:
  • model (Model) – Pharmpy model

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

  • dataset (pd.DataFrame) – Optional dataset

Returns:

pd.Series – WRES

Examples

>>> from pharmpy.modeling import load_example_model, evaluate_weighted_residuals
>>> from pharmpy.tools import load_example_modelfit_results
>>> model = load_example_model("pheno_linear")
>>> results = load_example_modelfit_results("pheno_linear")
>>> parameters = results.parameter_estimates
>>> evaluate_weighted_residuals(model, parameters=dict(parameters))
0     -0.313859
1      0.675721
2     -1.544240
3      1.921720
4      1.517677
        ...
150    1.223935
151   -0.053334
152   -0.007023
153    0.931252
154    0.778389
Name: WRES, Length: 155, dtype: float64