Design evaluation and optimization 01"

backup_options <- options()
options(width = 3000)
knitr::opts_chunk$set(collapse = TRUE,
comment = "#>",echo = FALSE, warning = FALSE, message = FALSE,
cache = FALSE, tidy = FALSE, size = "small")
devtools::load_all()

Overview

Data for this example result from a PKPD population study on a non-steroidal molecule [@FloresMurrieta1998]. Single doses of 1, 3.2, 10, 31.6, 56.2, or 100mg/kg per os were given respectively to 6 groups, each of which contained at least 6 rats (weighing 200g on average), following a parallel design. Blood sampling and drug response (DI score) evaluation were conducted at 0, 15, 30, and 45 min and at 1, 1.25, 1.5, 2, 3 and 4 hours after administration.

Based on the evaluation results, we choose to optimize a design for 30 rats receiving a single dose of either 100mg/kg or 320 mg/kg, selecting only 3 from previously defined time points for blood sampling and response evaluation by using Fedorov-Wynn method.

Reports of the design evaluation and optimization are available at https://github.com/iame-researchCenter/PFIM

Design evaluation

Create two PFIM projects:

- MyProject_evaluation: project for the design evaluation named eval_PKPD_FloresMurrieta1998

- MyProject_optimization: project for the design optimization named opti_PKPD_FloresMurrieta1998

MyProject_evaluation = PFIMProject(name = "eval_PKPD_FloresMurrieta1998")
MyProject_optimization = PFIMProject(name = "opti_PKPD_FloresMurrieta1998")

Create the statistical model and set the parameters for the ode solver

MyStatisticalModel = StatisticalModel()
MyStatisticalModel = setParametersOdeSolver( MyStatisticalModel, list( atol=1e-8, rtol=1e-8, .relStep=1e-8 ) )

Define the model equations of the PKPD model

MyModelEquations  =  ModelODEquations( list(RespPK = expression( Cc ),
                                           RespPD = expression( E )) ,
                                      list("Deriv_Cc" = expression( dose_RespPK/V*ka*exp(-ka*t) - Cl/V*Cc ),
                                           "Deriv_E" = expression(Rin*(1-Imax*(Cc**gamma)/(Cc**gamma + IC50**gamma))-kout*E) ) )

Assign the PKPD model the statistical model

MyStatisticalModel = defineModelEquations( MyStatisticalModel, MyModelEquations )

Create the variables of the PKPD model

vCc  =  ModelVariable( "Cc" )
vE  =  ModelVariable( "E" )

Assign the model variables to the statistical model

MyStatisticalModel  =  defineVariable( MyStatisticalModel, vCc )
MyStatisticalModel  =  defineVariable( MyStatisticalModel, vE )

Set mu and omega for each parameter

pV = ModelParameter( "V", mu = 0.74, omega = 0.316, distribution = LogNormalDistribution() )
pCl = ModelParameter( "Cl", mu = 0.28, omega = 0.456, distribution = LogNormalDistribution() )
pka = ModelParameter( "ka", mu = 10, fixedMu = TRUE, omega = sqrt( 0 ), distribution = LogNormalDistribution() )
pkout = ModelParameter( "kout", mu = 6.14, omega = 0.947, distribution = LogNormalDistribution() )
pRin = ModelParameter( "Rin", mu = 614, fixedMu = TRUE, omega = sqrt( 0 ), distribution = LogNormalDistribution() )
pImax = ModelParameter( "Imax", mu = 0.76, omega = 0.439, distribution = LogNormalDistribution() )
pIC50 = ModelParameter( "IC50", mu = 9.22, omega = 0.452, distribution = LogNormalDistribution() )
pgamma = ModelParameter( "gamma", mu = 2.77, omega = 1.761, distribution = LogNormalDistribution() )

Assign the model parameters to the statistical model

MyStatisticalModel = defineParameter( MyStatisticalModel, pka )
MyStatisticalModel = defineParameter( MyStatisticalModel, pV )
MyStatisticalModel = defineParameter( MyStatisticalModel, pCl )
MyStatisticalModel = defineParameter( MyStatisticalModel, pkout )
MyStatisticalModel = defineParameter( MyStatisticalModel, pRin )
MyStatisticalModel = defineParameter( MyStatisticalModel, pImax )
MyStatisticalModel = defineParameter( MyStatisticalModel, pIC50 )
MyStatisticalModel = defineParameter( MyStatisticalModel, pgamma )

Create and add the error model to the responses PK and PD. Create and add the responses PK and PD to the statistical model

MyStatisticalModel = addResponse( MyStatisticalModel, Response( "RespPK", Proportional( sigma_slope = 0.21 ) ) )
MyStatisticalModel = addResponse( MyStatisticalModel, Response( "RespPD", Constant( sigma_inter = 9.6 ) ) )

Assign the statistical model to the PFIM projects

MyProject_evaluation = defineStatisticalModel( MyProject_evaluation, MyStatisticalModel )
MyProject_optimization = defineStatisticalModel( MyProject_optimization, MyStatisticalModel )

Create a design called MyDesign

MyDesign =  Design( name = "MyDesign")

Define the arms and for each arm

- create and add the administration parameters for the response PK
- create and add the sampling times for the responses PK and PD
brasTest1 = Arm( name="0.2mg Arm", arm_size = 6, cond_init = list("Cc"=0,"E"=100) )
brasTest1 = addAdministration( brasTest1, Administration( outcome = "RespPK", time_dose = c(0), amount_dose = c(0.2) ) )
brasTest1 = addSampling( brasTest1, SamplingTimes( outcome = "RespPK", sample_time = c( 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4 ) ) )
brasTest1 = addSampling( brasTest1, SamplingTimes( outcome = "RespPD", sample_time = c( 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4 ) ) )

brasTest2 = Arm( name="0.64mg Arm", arm_size = 6, cond_init = list("Cc"=0,"E"=100) )
brasTest2 = addAdministration( brasTest2, Administration( outcome = "RespPK", time_dose = c(0), amount_dose = c(0.64) ) )
brasTest2 = addSampling( brasTest2, SamplingTimes( outcome = "RespPK", sample_time = c( 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4 ) ) )
brasTest2 = addSampling( brasTest2, SamplingTimes( outcome = "RespPD", sample_time = c( 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4 ) ) )

brasTest3 = Arm( name="2mg Arm", arm_size = 6, cond_init = list("Cc"=0,"E"=100) )
brasTest3 = addAdministration( brasTest3, Administration( outcome = "RespPK", time_dose = c(0), amount_dose = c(2) ) )
brasTest3 = addSampling( brasTest3, SamplingTimes( outcome = "RespPK", sample_time = c( 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4 ) ) )
brasTest3 = addSampling( brasTest3, SamplingTimes( outcome = "RespPD", sample_time = c( 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4 ) ) )

brasTest4 = Arm( name="6.24mg Arm", arm_size = 6, cond_init = list("Cc"=0,"E"=100) )
brasTest4 = addAdministration( brasTest4, Administration( outcome = "RespPK", time_dose = c(0), amount_dose = c(6.24) ) )
brasTest4 = addSampling( brasTest4, SamplingTimes( outcome = "RespPK", sample_time = c( 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4 ) ) )
brasTest4 = addSampling( brasTest4, SamplingTimes( outcome = "RespPD", sample_time = c( 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4 ) ) )

brasTest5 = Arm( name="11.24mg Arm", arm_size = 6, cond_init = list("Cc"=0,"E"=100) )
brasTest5 = addAdministration( brasTest5, Administration( outcome = "RespPK", time_dose = c(0), amount_dose = c(11.24) ) )
brasTest5 = addSampling( brasTest5, SamplingTimes( outcome = "RespPK", sample_time = c( 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4 ) ) )
brasTest5 = addSampling( brasTest5, SamplingTimes( outcome = "RespPD", sample_time = c( 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4 ) ) )

brasTest6 = Arm( name="20mg Arm", arm_size = 6, cond_init = list("Cc"=0,"E"=100) )
brasTest6 = addAdministration( brasTest6, Administration( outcome = "RespPK", time_dose = c(0), amount_dose = c(20) ) )
brasTest6 = addSampling( brasTest6, SamplingTimes( outcome = "RespPK", sample_time = c( 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4 ) ) )
brasTest6 = addSampling( brasTest6, SamplingTimes( outcome = "RespPD", sample_time = c( 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4 ) ) ) 

Add the arms to the design MyDesign

MyDesign  =  addArm( MyDesign, brasTest1 )
MyDesign  =  addArm( MyDesign, brasTest2 )
MyDesign  =  addArm( MyDesign, brasTest3 )
MyDesign  =  addArm( MyDesign, brasTest4 )
MyDesign  =  addArm( MyDesign, brasTest5 )
MyDesign  =  addArm( MyDesign, brasTest6 )

Add the design MyDesign to the PFIM project MyProject_evaluation

MyProject_evaluation  =  addDesign( MyProject_evaluation, MyDesign )

Evaluate the population FIM

evaluationPop  =  EvaluatePopulationFIM( MyProject_evaluation )

Display the results of the design evaluation

show( evaluationPop )

Create and save the report for the design evaluation

# set the path and name of the report to save the report
outputPath = "C:/Users/ADMIN Romain LEROUX/Documents/GIT PFIM/PFIM/PAGE2022"

plotOptions = list( unitTime=c("hour"), unitResponses= c("mcg/mL","DI%") )

evaluationPop = setNamePFIMProject( evaluationPop, "PKPD_FloresMurrieta1998_populationFIM" )

reportPFIMProject( evaluationPop,
                   outputPath = outputPath, plotOptions = plotOptions )

Evaluate the individual and Bayesian FIMs

evaluationInd = EvaluateIndividualFIM( MyProject_evaluation )
evaluationBay = EvaluateBayesianFIM( MyProject_evaluation )

Display the results of the design evaluation

show( evaluationInd )
show( evaluationBay )

Reports for the design evaluation

evaluationInd = setNamePFIMProject( evaluationInd, "PKPD_FloresMurrieta1998_IndividualFIM" )
reportPFIMProject( evaluationInd,
                   outputPath = outputPath, plotOptions = plotOptions )

evaluationBay = setNamePFIMProject( evaluationBay, "PKPD_FloresMurrieta1998_BayesianFIM" )
reportPFIMProject( evaluationBay,
                   outputPath = outputPath, plotOptions = plotOptions )

Design optimization

Define the arm and

- create and add the administration parameters for the response PK
- create and add the sampling times for the responses PK and PD
brasTest = Arm( name="20mg Arm", arm_size = 30, cond_init = list( "Cc" = 0,"E"= expression( Rin/kout ) ) )
brasTest = addAdministration( brasTest, Administration( outcome = "RespPK", time_dose = c(0), amount_dose = c(20) ) )
brasTest = addSampling( brasTest, SamplingTimes( outcome = "RespPK", sample_time = c( 0.25, 1, 4 ) ) )
brasTest = addSampling( brasTest, SamplingTimes( outcome = "RespPD", sample_time = c( 1.5, 2, 6 ) ) )

Create and add the design MyDesign2 to the project MyProject_optimization

MyDesign2= Design( name = "MyDesign2")
MyDesign2 = addArm( MyDesign2, brasTest )
MyProject_optimization = addDesign( MyProject_optimization, MyDesign2 )

Create a sampling constraint for the responses PK and PD

samplingRespPK = SamplingConstraint( response = "RespPK" )
samplingRespPD = SamplingConstraint( response = "RespPD" )

Define the vector of allowed sampling times for the responses PK and PD

samplingRespPK = allowedDiscretSamplingTimes( samplingRespPK, list( c( 0.25, 0.75, 1, 1.5, 2, 4, 6 ) ) )
samplingRespPD = allowedDiscretSamplingTimes( samplingRespPD, list( c( 0.25, 0.75, 1.5, 2, 3, 6, 8, 12 ) ) )

Set the initial vectors for the FedorovWynn algorithm

initialElementaryProtocols = list( c( 0.25, 1, 4 ), c( 1.5, 2, 6 ) )

Set the number of optimisable sampling times

samplingRespPK = numberOfSamplingTimesIsOptimisable( samplingRespPK, c(3) )
samplingRespPD = numberOfSamplingTimesIsOptimisable( samplingRespPD, c(3) ) 

Fix certain time values

samplingRespPK = FixTimeValues( samplingRespPK, c( 0.25, 4 ) )
samplingRespPD = FixTimeValues( samplingRespPD, c( 2, 6 ) )

Create a design constraint and add the sampling constraints to the design

Constr = DesignConstraint()
Constr = addSamplingConstraint( Constr, samplingRespPK )
Constr = addSamplingConstraint( Constr, samplingRespPD )

Create an administration for response PK

administrationResp = AdministrationConstraint( response = "RespPK" )

Define the vector of allowed amount of doses for the response PK

administrationResp  =  AllowedDoses( administrationResp, c(20,64) )
Constr = addAdministrationConstraint( Constr, administrationResp )

Define the total number of individuals to be considered

Constr = setTotalNumberOfIndividuals( Constr, 30 )

Add the design to the project

MyProject_optimization = setConstraint( MyProject_optimization, Constr )

Set the vector of initial proportions or numbers of subjects for each elementary design

numberOfSubjects = c(30)
proportionsOfSubjects = c(30)/30

Set the the parameters of the FedorovWynn algorithm and run the algorithm for the design optimization with a population FIM

optimizer  =  FedorovWynnAlgorithm( initialElementaryProtocols,numberOfSubjects, proportionsOfSubjects, showProcess = T )
optimization_populationFIM  =  OptimizeDesign( MyProject_optimization , optimizer, PopulationFim() )

Display the results of the design optimization

show( optimization_populationFIM )

Reports for the design optimization

# set the path and name of the report to save the report
outputPath = "C:/Users/ADMIN Romain LEROUX/Documents/GIT PFIM/PFIM/PAGE2022"

plotOptions = list( unitTime=c("hour"), unitResponses= c("mcg/mL","DI%") )

reportPFIMProject( optimization_populationFIM, outputPath = outputPath, plotOptions = plotOptions  )

References

options(backup_options)


Try the PFIM package in your browser

Any scripts or data that you put into this service are public.

PFIM documentation built on June 24, 2022, 9:06 a.m.