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(type='pkpd',
                        search_space="DIRECTEFFECT(*)",
                        model=start_model,
                        b_init = 0.1,
                        emax_init = 0.1,
                        ec50_init = 0.7,
                        met_init = 0.3,
                        results=start_model_results)

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

type

Type of model. In this case “pkpd”.

model

PK start model

results

ModelfitResults of the start model

Optional#

Argument

Description

b_init

Initial estimate for baseline effect. Optional. Default is 0.1

emax_init

Initial estimate for E max parameter. Default is 0.1

ec50_init

Initial estimate for EC 50 parameter. Default is 0.1

met_init

Initial estimate for mean equilibration time. Default is 0.1

search_space

Search space of models to test. Optional. If None all implemented models are used.

strictness

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.

digraph BST { node [fontname="Arial"] base [label="Base model"] s1 [label="Baseline";shape = rect;] s2 [label="direct effect linear"] s3 [label="direct effect emax"] s4 [label="direct effect sigmoid"] s5 [label="effect compartment linear"] s6 [label="..."] base -> s1 base -> s2 base -> s3 base -> s4 base -> s5 base -> s6 }

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(type='pkpd',
                        search_space="DIRECTEFFECT(emax);EFFECTCOMP([linear,emax])",
                        model=start_model,
                        results=start_model_results)

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(type='pkpd',
                        model=start_model,
                        results=start_model_results)

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(type='pkpd',
                        model=start_model,
                        results=start_model_results,
                        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(type='pkpd',
                        model=start_model,
                        results=start_model_results,
                        b_init = 0.09, e_max_init = 3, ec50_init = 1.5,
                        search_space = "DIRECTEFFECT(*);INDIRECTEFFECT(*,PRODUCTION)")