Skip to contents
add_covariates_to_model()
Wrapper function to add covariates to a pharmpy model
add_default_output_tables()
Add one or more default output tables to a model, if they don't already exist in the model.
add_metabolite_compartment()
Add a metabolite compartment, if requested
add_table_to_model()
Add new $TABLE record to output variables
attach_fit_info()
Attach fit info and tables to a fit object, e.g. from model fit or Pharmpy grid search final results
basic_gof_plot()
Create basic goodness of fit plots based on nlmixr2 fit
calc_condition_number()
Calculate the condition number given a matrix
calc_pk_variables()
Calculate some basic PK variables from simulated or observed data
call_nmfe()
Call nmfe
call_pharmpy_fit()
Run model with pharmpy
call_pharmpy_tool()
Generic function for running a pharmpy tool, like bootstrap, or modelsearch. A separate function is available for fit()
call_psn()
Call PsN
change_nonmem_dataset()
Change $DATA in NONMEM model code
check_errors_nm_output()
Detect any errors in the output from NONMEM.
clean_modelfit_data()
Clean / check the dataset before passing to model fitting tool
clean_nonmem_folder()
Remove temporary files from NONMEM run
clean_pharmpy_runfolders()
Clean pharmpy run folders like modelfit1 etc
combine_info_columns()
Combine columns with run info into a data.frame and make sure that rows match (e.g. parameters)
combine_regimens()
Combine several regimens into a single data.frame, which can be passed into run_sim() as regimen argument.
compare_nlme_fit()
Compare fit of two or more NLME fits
compare_nlme_runs()
Compare NLME output from last n runs
create_covariate_search_space()
Create covariate search space definition for pharmpy covsearch
create_dosing_records()
Create dosing records, given a specified regimen as a data frame with potentially multiple regimens and varying dosing times / doses
create_model()
Create model
create_model_nlmixr()
Temporary function that returns a hardcoded nlmixr2 model
create_modelfit_info_table()
Create a data.frame with basic model fit info
create_modelfit_parameter_table()
Create a data.frame with parameter estimates
create_obs_records()
Create observation records, given a specified t_obs vector
create_pharmpy_model_from_list()
Create a model object from the model code and dataset stored as a list object.
create_pkmodel_search_space()
Create PK mmodel search space definition for pharmpy modelsearch
create_regimen()
Create a single regimen
create_run_folder()
Create a folder for a run
create_vpc_data()
Run a simulation based on supplied parameters estimates, and combine into proper format for VPC
detect_nmfe_version()
get nmfe file name from a NONMEM installation folder
estimation_options_defaults
List of default options for estimation method.
export_pharmpy_model()
Export a pharmpy model object.
export_pharmpy_results()
Export a pharmpy model object
extract()
Helper function for read_ini
find_pk_parameter()
Find / match PK parameter based on generic name.
fit_model()
Fit model using NONMEM or nlmixr2
fit_model_nlmixr()
Fit model using nlmixr2
fit_model_nonmem()
Fit model using NONMEM
get_advan()
Get ADVAN number for model
get_compartment_scale()
Get compartment scale definition
get_condition_number_for_fit()
Calculate the condition number for a model fit object Performs some safety checks
get_cov_matrix()
Create a covariance block matrix
get_defined_pk_parameters()
Get all parameters that are defined (from a predefined vector of possible parameters)
get_estimation_options()
Helper function to combine default estimation options with user-specified, and ensure correct format.
get_final_results_from_search()
For a Pharmpy grid search, fetch the fit info and attach to object
get_fit_info()
Get fit info from NONMEM run
get_initial_estimates_from_data()
Get a very crude estimate for V to serve as initial estimate for CL and V, without performing an NCA. The calculation is based on the assumption that often in clinical trial data, there is at least a peak and a trough (and likely other samples) taken, hence it's possible to get a crude estimate for CL and V from that. For 2-compartment models we just set Q and V to half and twice the size of CL and V, which is often a good starting point. In most scenarios this is sufficiently close to the final estimates that estimation methods will be able to find the global minimum.
get_initial_estimates_from_individual_data()
Core function to get parameter estimates from individual data
get_new_run_number()
Get new run number for model fit
get_nmfe_location()
Helper function to determine nmfe location from various sources The order is as follows:
get_nmfe_output()
Get output from NMFE
get_nmtran_from_nmfe()
Get the location of NM-TRAN based on the location of nmfe It's usually up one folder from nmfe, then in tr/NMTRAN.exe
get_obs_compartment()
Get observation compartment number from model
get_ode_size()
Get size of ODE system in $DES
get_parameters_with_iiv()
Get a character vector with all parameters on which IIV is present
get_pharmpy_conf()
Get pharmpy configuration, as an R object (list)
get_pharmpy_runfolders()
Find last pharmpy run folder
get_route_from_data()
Get route from data. If dose and observation events all happen in the same compartment, then assume IV administration, else oral absorption (or sc, im, etc).
get_shrinkage_summary()
Parses a NONMEM output file and extracts shrinkage
get_shrinkage_values()
Get shrinkage values from a single line in NONMEM output
get_tables_from_fit()
Read tables created in model run and return as a list of data.frames
get_tables_from_folder()
Get tables from a folder, by table_names
get_tables_in_model_code()
extract FILE names from $TABLE using simple regex. For some reason the tables are not (yet?) available in pharmpy
get_tool_from_model()
Get estimation/simulation engine from pharmpy model
import_pharmpy_model()
Import a pharmpy model stored using export_pharmpy_model
import_pharmpy_results()
Import pharmpy model results object
is_ltbs_model()
Is the residual error model "log-transform both-sides"?
is_maxeval_zero()
Does the last estimation method in a model have maxeval=0?
nlmixr2_pk_1cmt_iv_linear()
nlmixr2 model: 2-cmt linear model (iv)
nlmixr2_pk_1cmt_oral_linear()
nlmixr2 model: 1-cmt linear model (oral) Linear absorption without lagtime
nlmixr2_pk_1cmt_oral_linear_lag()
nlmixr2 model: 1-cmt linear model (oral) Linear absorption with lagtime
nlmixr2_pk_1cmt_oral_linear_transit()
nlmixr2 model: 1-cmt linear model (oral) Transit compartment absorption model
nlmixr2_pk_2cmt_iv_linear()
nlmixr2 model: 2-cmt linear model (iv)
nlmixr2_pk_2cmt_oral_linear()
nlmixr2 model: 2-cmt linear model (oral)
nlmixr2_pk_2cmt_oral_linear_lag()
nlmixr2 model: 2-cmt linear model (oral) Linear absorption with lagtime
nlmixr2_pk_2cmt_oral_linear_transit()
nlmixr2 model: 2-cmt linear model (oral) Transit compartment absorption model
nm_read_model()
Parse NONMEM model file into a list containing blocks of code
nm_save_dataset()
Save an R data.frame to a NONMEM-style dataset as CSV
nm_save_model()
Write a NONMEM model object to file
nm_update_dataset()
Update $DATA in NONMEM model with new dataset
parse_psn_args()
Parse tool options specified in YAML into PsN commandline args
prepare_run_folder()
Create a folder for running model, with the model and dataset
print(<pharmpy.workflows.results.ModelfitResults> )
Print function that provides basic run information for a pharmpy modelfit
print_nmfe_output()
Print nmfe output (stdout and stderr) from a run folder
read_ini()
Read ini file core function
read_table_nm()
NONMEM output table import function
remove_data_section()
Remove $DATA from a NONMEM model
remove_table_from_model()
Remove all $TABLE records from a model
remove_table_sections()
Function to remove all $TABLE sections
remove_tables_from_model()
Remove all $TABLE records from a model
run_nlme()
Run model in NONMEM
run_psn()
Run a PsN tool
run_sim()
Run simulations
run_simulation()
Run simulation from a fitted object
save_model_code()
Save model code to a markdown file
scale_initial_estimates_pk()
Only applies to PK parameters, not all parameters
set_compartment_scale()
Set scaling for certain compartments, e.g. dose and observation compartments.
set_covariance()
Function to set covariance between parameters in the omega block
set_iiv()
Set inter-individual variability on parameters
set_residual_error()
Logic to set the residual error model structure for the model
stack_encounters()
Stack encounters when data from multiple encounters is available for the same ID, and TIME is starting at 0 for each encounter.
update_estimation_method()
Wrapper around pharmr's functions to set/add estimation methods
update_parameters()
Update parameter estimates (and fix)
update_pk_tables()
Updates PK parameter tables (patab)
validate_model()
Validate the specified model, ensure it's valid Pharmpy model