pharmpy.modeling.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)) 1 -0.313859 2 0.675721 3 -1.544240 4 1.921720 5 1.517677 ... 151 1.223935 152 -0.053334 153 -0.007023 154 0.931252 155 0.778389 Name: WRES, Length: 155, dtype: float64