calculate_bic#
- pharmpy.modeling.calculate_bic(model, likelihood, type='mixed')[source]#
Calculate BIC
Different variations of the BIC can be calculated:
- mixed (default)BIC = -2LL + n_random_parameters * log(n_individuals) +n_fixed_parameters * log(n_observations)
- fixedBIC = -2LL + n_estimated_parameters * log(n_observations)
- randomBIC = -2LL + n_estimated_parameters * log(n_individuals)
- iivBIC = -2LL + n_estimated_iiv_omega_parameters * log(n_individuals)
- Parameters:
model (Model) – Pharmpy model object
likelihood (float) – -2LL to use
type ({‘mixed’, ‘fixed’, ‘random’, ‘iiv’}) – Type of BIC to calculate. Default is the mixed effects.
- Returns:
float – BIC of model fit
Examples
>>> from pharmpy.modeling import * >>> from pharmpy.tools import load_example_modelfit_results >>> model = load_example_model("pheno") >>> results = load_example_modelfit_results("pheno") >>> ofv = results.ofv >>> calculate_bic(model, ofv) 611.7071686216575 >>> calculate_bic(model, ofv, type='fixed') 616.5366069867251 >>> calculate_bic(model, ofv, type='random') 610.741280948644 >>> calculate_bic(model, ofv, type='iiv') 594.4311311730211