predict_outliers#

pharmpy.tools.predict_outliers(model, results, cutoff=3.0)[source]#

Predict outliers for a model using a machine learning model.

See the simeval documentation for a definition of the residual

Please refer to www.page-meeting.org/?abstract=10029 for more information on training and estimated precision and accuracy.

Parameters:
  • model (Model) – Pharmpy model

  • results (ModelfitResults) – ModelfitResults for the model

  • cutoff (float) – Cutoff threshold for a residual signaling an outlier

Returns:

pd.DataFrame – Dataframe over the individuals with a residual column containing the raw predicted residuals and a outlier column with a boolean to tell whether the individual is an outlier or not.

Examples

>>> from pharmpy.modeling import *
>>> from pharmpy.tools import *
>>> model = load_example_model("pheno")
>>> results = load_example_modelfit_results("pheno")
>>> predict_outliers(model, results)     
    residual  outlier
ID
1  -0.281443    False
2   1.057392    False
3  -0.119105    False
4  -0.846849    False
5   0.600540    False
6   1.014008    False
7  -0.750734    False
8   0.247175    False
9   0.117002    False
10 -0.835389    False
11  3.529582     True
12 -0.035670    False
13  0.292333    False
14  0.303278    False
15 -0.565949    False
16 -0.078192    False
17 -0.291295    False
18  2.466421    False
19 -0.402343    False
20 -0.699996    False
21 -0.567987    False
22 -0.526776    False
23  0.303918    False
24 -0.177588    False
25  1.272142    False
26 -0.390000    False
27  0.775876    False
28 -0.501528    False
29 -0.700951    False
30 -0.352599    False
31  0.294196    False
32  0.744014    False
33 -0.215364    False
34  0.208691    False
35  1.713130    False
36  0.300293    False
37 -0.810736    False
38  0.459877    False
39 -0.675125    False
40 -0.563835    False
41 -0.526945    False
42  4.449199     True
43  0.720714    False
44 -0.792248    False
45 -0.860923    False
46 -0.731858    False
47 -0.247131    False
48  1.894190    False
49 -0.282737    False
50 -0.153398    False
51  1.200546    False
52  0.902774    False
53  0.586427    False
54  0.183329    False
55  1.036930    False
56 -0.639868    False
57 -0.765279    False
58 -0.209665    False
59 -0.225693    False