pharmpy.parameter_sampling module¶
- pharmpy.parameter_sampling.sample_from_covariance_matrix(model, modelfit_results=None, parameters=None, force_posdef_samples=None, force_posdef_covmatrix=False, n=1, seed=None)[source]¶
Sample parameter vectors using the covariance matrix
If modelfit_results is not provided the results from the model will be used
- Parameters
parameters – Use to only sample a subset of the parameters. None means all
force_posdef_samples – Set to how many iterations to do before forcing all samples to be positive definite. None is default and means never and 0 means always
- Returns
A dataframe with one sample per row
- pharmpy.parameter_sampling.sample_from_function(model, samplingfn, parameters=None, force_posdef_samples=None, n=1)[source]¶
Sample parameter vectors using a general function
The sampling function will be given three arguments:
lower - lower bounds of parameters
upper - upper bounds of parameters
n - number of samples
- pharmpy.parameter_sampling.sample_individual_estimates(model, parameters=None, samples_per_id=100, seed=None)[source]¶
Sample individual estimates given their covariance.
- Parameters
parameters – A list of a subset of parameters to sample. Default is None, which means all.
- Returns
Pool of samples in a DataFrame
- pharmpy.parameter_sampling.sample_uniformly(model, fraction=0.1, parameters=None, force_posdef_samples=None, n=1, seed=None)[source]¶
Sample parameter vectors using uniform sampling
Each parameter value will be randomly sampled from a uniform distriution with lower bound estimate - estimate * fraction and upper bound estimate + estimate * fraction