update_inits#

pharmpy.modeling.update_inits(model, parameter_estimates, move_est_close_to_bounds=False)[source]#

Update initial parameter estimate for a model

Updates initial estimates of population parameters for a model. If the new initial estimates are out of bounds or NaN this function will raise.

Parameters:
  • model (Model) – Pharmpy model to update initial estimates

  • parameter_estimates (pd.Series) – Parameter estimates to update

  • move_est_close_to_bounds (bool) – Move estimates that are close to bounds. If correlation >0.99 the correlation will be set to 0.9, if variance is <0.001 the variance will be set to 0.01.

Returns:

Model – Pharmpy model object

Example

>>> from pharmpy.modeling import load_example_model, update_inits
>>> from pharmpy.tools import load_example_modelfit_results
>>> model = load_example_model("pheno")
>>> results = load_example_modelfit_results("pheno")
>>> model.parameters.inits  
{'PTVCL': 0.00469307, 'PTVV': 1.00916, 'THETA_3': 0.1, 'IVCL': 0.0309626, 'IVV': 0.031128, 'SIGMA_1_1': 0.013241}
>>> model = update_inits(model, results.parameter_estimates)
>>> model.parameters.inits  
{'PTVCL': 0.00469555, 'PTVV': 0.984258, 'THETA_3': 0.15892, 'IVCL': 0.0293508, 'IVV': 0.027906, ...}