pharmpy.methods.frem.results module¶
-
class
pharmpy.methods.frem.results.
FREMResults
(coefficients=None, parameter_variability=None, covariate_effects=None, individual_effects=None, unexplained_variability=None, covariate_statistics=None, covariate_effects_plot=None, individual_effects_plot=None, unexplained_variability_plot=None, covariate_baselines=None, parameter_inits_and_estimates=None, base_parameter_change=None, estimated_covariates=None, ofv=None)[source]¶ Bases:
pharmpy.results.Results
FREM Results class
What follows is a description on how the FREM results are stored. See
pharmpy.methods.frem
for a description of how the results are calculated.-
covariate_baselines
¶ DataFrame with the baseline covariate values used in the analysis for each indiviual. Index is ID. One column for each covariate.
WGT APGR ID 1.0 1.4 7.0 2.0 1.5 9.0 3.0 1.5 6.0 4.0 0.9 6.0 5.0 1.4 7.0 6.0 1.2 5.0 7.0 1.0 5.0 8.0 1.2 7.0 9.0 1.4 8.0 ... ... ...
-
covariate_effects
¶ DataFrame with covariate effects. Index is parameter, covariate and condition where condition can be either 5th or 95th. Columns are p5, mean and p95 for the 5th percentile of the effect, the estimated effect and the 95th percentile of the effect respectively. Effect sizes are in fractions. Example:
p5 mean p95 parameter covariate condition ETA(1) WGT 5th 0.901869 0.972920 1.051093 95th 0.903849 1.064605 1.233111 APGR 5th 1.084238 1.248766 1.413923 95th 0.848297 0.901919 0.962312 ETA(2) WGT 5th 0.942450 1.004400 1.068390 95th 0.874409 0.995763 1.127777 APGR 5th 0.832008 0.924457 1.021307 95th 0.990035 1.039444 1.091288
-
covariate_effects_plot
¶ Plot of the covariate effects generated by
plot_covariate_effects()
-
covariate_statistics
¶ DataFrame with summary statistics of the covariate baselines. Index is covariates. Columns are p5 with 95th percentile, mean, p95 with 95th percentile, stdev, ref with the used reference value, categorical and other with the non-reference value for categorical covariates. Example:
-
individual_effects
¶ DataFrame with individual covariate effects. Index is ID and parameter. Columns are observed, p5 and p95 for the observed individual effect, 5th and 95th percentiles of the estimated individual effects respectively. Example:
observed p5 p95 ID parameter 1.0 ETA(1) 0.973309 0.946282 0.982391 ETA(2) 1.009411 0.995276 1.024539 2.0 ETA(1) 0.911492 0.832168 0.941760 ETA(2) 1.036200 0.990081 1.091438 3.0 ETA(1) 1.013772 1.007555 1.028463 ... ... ... ... 57.0 ETA(2) 0.987500 0.942709 1.031111 58.0 ETA(1) 0.939409 0.883782 0.956792 ETA(2) 1.023321 0.993543 1.057408 59.0 ETA(1) 0.992578 0.952785 1.027261 ETA(2) 0.999220 0.968931 1.033819
-
individual_effects_plot
¶ Plot of the individual effects generated by
plot_individual_effects()
-
unexplained_variability
¶ DataFrame with remaining unexplained variability. Index is parameter and covariate. Covariate is none for no covariates and all for all covariates. Example:
sd_observed sd_5th sd_95th parameter covariate ETA(1) none 0.195327 0.221382 0.298465 WGT 0.194527 0.218385 0.292261 APGR 0.182497 0.202192 0.279766 all 0.178956 0.197282 0.268090 ETA(2) none 0.158316 0.152510 0.210044 WGT 0.158313 0.148041 0.207276 APGR 0.155757 0.149037 0.203477 all 0.155551 0.144767 0.201658
-
unexplained_variability_plot
¶ Plot of the unexplained variability generated by
plot_unexplained_variability()
-
parameter_inits_and_estimates
¶ Initial parameter estimates and estimates after fitting for all intermediate models and the final model.
-
base_parameter_change
¶ The relative change in parameter estimates from base model to the FREM model.
-
covariate_estimates
¶ Model estimates of covariate statistics
-
parameter_variability
¶ Conditioned parameter variability
-
coefficients
¶ Parameter covariate coefficients. Calculated one at a time or all together.
-
rst_path
= PosixPath('/home/runner/work/pharmpy/pharmpy/pharmpy/.tox/docs/lib/python3.9/site-packages/pharmpy/methods/frem/report.rst')¶
-
-
pharmpy.methods.frem.results.
add_parameter_inits_and_estimates
(res, frem_model, intermediate_models)[source]¶
-
pharmpy.methods.frem.results.
calculate_results
(frem_model, continuous, categorical, method=None, intermediate_models=None, seed=None, **kwargs)[source]¶ Calculate FREM results
- Parameters
method – Either ‘cov_sampling’ or ‘bipp’
-
pharmpy.methods.frem.results.
calculate_results_from_samples
(frem_model, continuous, categorical, parvecs, rescale=True)[source]¶ Calculate the FREM results given samples of parameter estimates
-
pharmpy.methods.frem.results.
calculate_results_using_bipp
(frem_model, continuous, categorical, rescale=True, samples=2000, seed=None)[source]¶ Estimate a covariance matrix for the frem model using the BIPP method
Bootstrap on the individual parameter posteriors Only the individual estimates, individual unvertainties and the parameter estimates are needed.
-
pharmpy.methods.frem.results.
calculate_results_using_cov_sampling
(frem_model, continuous, categorical, cov_model=None, force_posdef_samples=500, force_posdef_covmatrix=False, samples=1000, rescale=True, seed=None)[source]¶ Calculate the FREM results using covariance matrix for uncertainty
- Parameters
cov_model – Take the parameter uncertainty covariance matrix from this model instead of the frem model.
force_posdef_samples – The number of sampling tries before stopping to use rejection sampling and instead starting to shift values so that the frem matrix becomes positive definite. Set to 0 to always force positive definiteness.
force_posdef_covmatrix – Set to force the covariance matrix of the frem movdel or the cov model to be positive definite. Default is to raise in this case.
samples – The number of parameter vector samples to use.
-
pharmpy.methods.frem.results.
psn_frem_results
(path, force_posdef_covmatrix=False, force_posdef_samples=500, method=None)[source]¶ Create frem results from a PsN FREM run
- Parameters
path – Path to PsN frem run directory
- Returns
A
FREMResults
object
-
pharmpy.methods.frem.results.
psn_reorder_base_model_inits
(model, path)[source]¶ Reorder omega inits from base model in PsN
If base model was reordered PsN writes the omega inits dict to m1/model_1.inits