rank_models#

pharmpy.modeling.rank_models(base_model, models, errors_allowed=None, rank_type='ofv', cutoff=None, bic_type='mixed') DataFrame[source]#

Ranks a list of models

Ranks a list of models with a given ranking function

Parameters:
  • base_model (Model) – Base model to compare to

  • models (list) – List of models

  • errors_allowed (list or None) – List of errors that are allowed for ranking. Currently available is: rounding_errors and maxevals_exceeded. Default is None

  • rank_type (str) – Name of ranking type. Available options are ‘ofv’, ‘aic’, ‘bic’, ‘lrt’ (OFV with LRT)

  • cutoff (float or None) – Value to use as cutoff. If using LRT, cutoff denotes p-value. Default is None

  • bic_type (str) – Type of BIC to calculate. Default is the mixed effects.

Returns:

pd.DataFrame – DataFrame of the ranked models

Examples

>>> from pharmpy.modeling import load_example_model, summarize_modelfit_results
>>> model_1 = load_example_model("pheno")
>>> model_2 = load_example_model("pheno_linear")
>>> rank_models(model_1, [model_2],
...             errors_allowed=['rounding_errors'],
...             rank_type='lrt')