PKPD#
Running#
The code to initiate structsearch for a PKPD model in Python/R is stated below:
from pharmpy.modeling import read_model
from pharmpy.tools read_modelfit_results, run_structsearch
start_model = read_model('path/to/model')
start_model_results = read_modelfit_results('path/to/model')
res = run_structsearch(model=start_model,
                       results=start_model_results,
                       type='pkpd',
                       search_space="DIRECTEFFECT(*)",
                       b_init = 0.1,
                       emax_init = 0.1,
                       ec50_init = 0.7,
                       met_init = 0.3)
from pharmpy$tools read_modelfit_results, run_structsearch
start_model <- read_model('path/to/model')
start_model_results <- read_modelfit_results('path/to/model')
res <- run_structsearch(model=start_model,
                       results=start_model_results,
                       type='pkpd',
                       search_space="DIRECTEFFECT(*)",
                       b_init <- 0.1,
                       emax_init <- 0.1,
                       ec50_init <- 0.7,
                       met_init <- 0.3)
This will take an input model model with a search_space that includes all direct effect PKPD models.
Note
For PKPD models the input model has to be a PK model with a PKPD dataset.
Arguments#
The arguments of the structsearch tool for PKPD models are listed below.
Mandatory#
| Argument | Description | 
|---|---|
| 
 | PK start model | 
| 
 | ModelfitResults of the start model | 
| 
 | Type of model. In this case “pkpd”. | 
Optional#
| Argument | Description | 
|---|---|
| 
 | Initial estimate for baseline effect. Optional. Default is 0.1 | 
| 
 | Initial estimate for E max parameter. Default is 0.1 | 
| 
 | Initial estimate for EC 50 parameter. Default is 0.1 | 
| 
 | Initial estimate for mean equilibration time. Default is 0.1 | 
| 
 | Search space of models to test. Optional.
If  | 
| 
 | Strictness criteria for model selection. Default is “minimization_successful or (rounding_errors and sigdigs>= 0.1)”. | 
Models#
Currently implemented PKPD models are:
Structsearch workflow#
PKPD candidate models will be derived from the input PK model. Additionaly to the candidate models a baseline model is created, which serves as a reference model when the models are ranked.
Note : The figure above is only showing a subset of all candidate models created, indicated by “…”
Regarding DVID, DVID=1 is representing PK observations while DVID=2 is connected to PD observations.
Search space#
MFL support the following model features:
| Category | Options | Description | 
|---|---|---|
| DIRECTEFFECT | model | Direct effect PD models. | 
| EFFECTCOMP | model | Effect comprtment PD models. | 
| INDIRECTEFFECT | model, option | Indirect effect PD models. option can be either production or degradation. | 
The option model describes a PKPD model, such as E max. For more details check model types.
To test all direct effect models the search space looks as follows:
DIRECTEFFECT(*)
Search space for testing linear and emax models for direct effect and effect compartment models:
DIRECTEFFECT([linear, emax])
EFFECTCOMP([linear, emax])
Search space for testing linear indirect effect degradation models:
INDIRECTEFFECT(linear,DEGRADATION)
Results#
The results object contains various summary tables which can be accessed in the results object, as well as files in .csv/.json format. The name of the selected best model (based on the input selection criteria) is also included.
Below is an example for a PKPD run.
res = run_structsearch(model=start_model,
                       results=start_model_results
                       type='pkpd',
                       search_space="DIRECTEFFECT(emax);EFFECTCOMP([linear,emax])")
res <- run_structsearch(model=start_model,
                       results=start_model_results
                       type='pkpd',
                       search_space="DIRECTEFFECT(emax);EFFECTCOMP([linear,emax])")
The summary_tool table contains information such as which feature each model candidate has, the difference to the
start model (in this case comparing BIC), and final ranking:
| description | n_params | d_params | dbic | bic | rank | parent_model | |
|---|---|---|---|---|---|---|---|
| model | |||||||
| structsearch_run2 | EFFECTCOMP_LINEAR | 6 | 3 | 1.215004 | 27.745013 | 1 | baseline_model | 
| structsearch_run1 | DIRECT_EMAX | 6 | 3 | 1.212603 | 27.747413 | 2 | baseline_model | 
| baseline_model | baseline_model | 3 | 0 | 0.000000 | 28.960017 | 3 | baseline_model | 
| structsearch_run3 | EFFECTCOMP_EMAX | 7 | 4 | -0.984380 | 29.944396 | 4 | baseline_model | 
Examples#
Minimum required arguments to run structsearch for PKPD models:
from pharmpy.modeling import read_model
from pharmpy.tools read_modelfit_results, run_structsearch
start_model = read_model('path/to/model')
start_model_results = read_modelfit_results('path/to/model')
res = run_structsearch(model=start_model,
                       results=start_model_results,
                       type='pkpd')
from pharmpy$tools read_modelfit_results, run_structsearch
start_model <- read_model('path/to/model')
start_model_results <- read_modelfit_results('path/to/model')
res <- run_structsearch(model=start_model,
                       results=start_model_results,
                       type='pkpd')
Specifying initial parameters:
from pharmpy.modeling import read_model
from pharmpy.tools read_modelfit_results, run_structsearch
start_model = read_model('path/to/model')
start_model_results = read_modelfit_results('path/to/model')
res = run_structsearch(model=start_model,
                       results=start_model_results,
                       type='pkpd',
                       b_init=0.09,
                       e_max_init=3,
                       ec50_init=1.5)
from pharmpy$tools read_modelfit_results, run_structsearch
start_model <- read_model('path/to/model')
start_model_results <- read_modelfit_results('path/to/model')
res <- run_structsearch(model=start_model,
                       results=start_model_results,
                       type='pkpd',
                       b_init=0.09,
                       e_max_init=3,
                       ec50_init=1.5)
Run structsearch with initial estimates for all direct effect models and all indirect effect models with production:
from pharmpy.modeling import read_model
from pharmpy.tools read_modelfit_results, run_structsearch
start_model = read_model('path/to/model')
start_model_results = read_modelfit_results('path/to/model')
res = run_structsearch(model=start_model,
                       results=start_model_results,
                       type='pkpd',
                       search_space="DIRECTEFFECT(*);INDIRECTEFFECT(*,PRODUCTION)",
                       b_init=0.09,
                       e_max_init=3,
                       ec50_init=1.5)
from pharmpy$tools read_modelfit_results, run_structsearch
start_model <- read_model('path/to/model')
start_model_results <- read_modelfit_results('path/to/model')
res <- run_structsearch(model=start_model,
                       results=start_model_results,
                       type='pkpd',
                       search_space="DIRECTEFFECT(*);INDIRECTEFFECT(*,PRODUCTION)",
                       b_init=0.09,
                       e_max_init=3,
                       ec50_init=1.5)