plot_individual_predictions#

pharmpy.modeling.plot_individual_predictions(model, predictions, individuals=None)[source]#

Plot DV and predictions grouped on individuals

The predictions would normally be taken from the modelfit results, but any data frame of appropriate format can be used. It should have one column per type of prediction where the column name is the type (e.g. “PRED” or “IPRED”), one row for each record of the dataset in the model. A predictions table containing only some of the individuals is ok to use, but then care needs to be taken to get match the row index of the original dataset.

Parameters:
  • model (Model) – Pharmpy model

  • predictions (pd.DataFrame) – One column for each type of prediction

  • individuals (list) – A list of individuals to include. None for all individuals

Returns:

alt.Chart – Plot

Examples

from pharmpy.modeling import load_example_model, plot_individual_predictions
from pharmpy.tools import load_example_modelfit_results

model = load_example_model("pheno")
res = load_example_modelfit_results("pheno")
plot_individual_predictions(model, res.predictions, individuals=[1, 2, 3, 4, 5])