Parameters#

class pharmpy.Parameters(params=None)[source]#

Bases: Sequence

An immutable collection of parameters

Class representing a group of parameters. Usually all parameters in a model. This class give a ways of displaying, summarizing and manipulating more than one parameter at a time.

Specific parameters can be found using indexing on the parameter name

Example

>>> from pharmpy import Parameters, Parameter
>>> par1 = Parameter("x", 0)
>>> par2 = Parameter("y", 1)
>>> pset = Parameters([par1, par2])
>>> pset["x"]
Parameter("x", 0, lower=-oo, upper=oo, fix=False)
>>> "x" in pset
True

Attributes Summary

fix

Fixedness of parameters as dict

fixed

All fixed parameters

inits

Initial estimates of parameters as dict

lower

Lower bounds of all parameters as a dictionary

names

List of all parameter names

nonfixed

All non-fixed parameters

symbols

List of all parameter symbols

upper

Upper bounds of all parameters as a dictionary

Methods Summary

set_fix(fix)

Create a new Parameters with changed fix state

set_initial_estimates(inits)

Create a new Parameters with changed initial estimates

to_dataframe()

Create a dataframe with a summary of all Parameters

Attributes Documentation

fix#

Fixedness of parameters as dict

fixed#

All fixed parameters

inits#

Initial estimates of parameters as dict

lower#

Lower bounds of all parameters as a dictionary

names#

List of all parameter names

nonfixed#

All non-fixed parameters

symbols#

List of all parameter symbols

upper#

Upper bounds of all parameters as a dictionary

Methods Documentation

set_fix(fix)[source]#

Create a new Parameters with changed fix state

Parameters:

fix (dict) – A dictionary of parameter names to boolean fix state

Returns:

Parameters – An update Parameters object

set_initial_estimates(inits)[source]#

Create a new Parameters with changed initial estimates

Parameters:

inits (dict) – A dictionary of parameter names to initial estimates

Returns:

Parameters – An update Parameters object

to_dataframe()[source]#

Create a dataframe with a summary of all Parameters

Returns:

DataFrame – A dataframe with one row per parameter. The columns are value, lower, upper and fix Row Index is the names

Example

>>> from pharmpy import Parameters, Parameter
>>> par1 = Parameter("CL", 1, lower=0, upper=10)
>>> par2 = Parameter("V", 10, lower=0, upper=100)
>>> pset = Parameters([par1, par2])
>>> pset.to_dataframe()
    value  lower  upper    fix
CL      1      0     10  False
V      10      0    100  False