[LONGITUDINAL] input = {V, k} EQUATION: Cc = pkmodel(V, k) [INDIVIDUAL] input = {V_pop, k_pop, omega_V, omega_k} DEFINITION: V = {distribution=lognormal, reference=V_pop, sd=omega_V} k = {distribution=lognormal, reference=k_pop, sd=omega_k}
#------------------------------------------------------------------------- # This application is governed by the CeCILL-B license. # You can use, modify and/ or redistribute this code under the terms # of the CeCILL license: http://www.cecill.info/index.en.html # # Marc Lavielle, Inria Saclay # April 29th, 2015 #------------------------------------------------------------------------- shinyUI(fluidPage( # titlePanel( # list(HTML('<p style="color:#4C0B5F; font-size:24px" fontsize=14> # PK model with inter individual variability</p>' )), # windowTitle="PK model with IIV"), navbarPage("PK model with inter individual variability", selected="Plot", id="nav", inverse="FALSE", tabPanel("Plot", tabsetPanel( id="tabs", type="pills", tabPanel("dosage"), tabPanel("parameters"), tabPanel("outputs"), tabPanel("settings") ), fluidRow( column(3, br(), br(), conditionalPanel(condition="input.tabs=='dosage'", sliderInput("tfd", "Time of first dose:", value=0, min=0, max = 20, step=1), sliderInput("nd", "Number of doses:", value=6, min=1, max = 10, step=1), sliderInput("ii", "Interdose interval:", value = 3, min = 0.5, max = 10, step=0.5), sliderInput("tinf", "Infusion time:", value = 1, min = 0, max = 5, step=0.5), sliderInput("amt", "Amount:", value = 5, min = 0, max = 20, step=1), br() ), conditionalPanel(condition="input.tabs=='parameters'", sliderInput("V_pop", "V_pop :", value = 10, min = 1, max = 20, step=1), sliderInput("k_pop", "k_pop :", value = 0.2, min = 0, max = 1, step=0.05), sliderInput("omega_V", "omega_V :", value = 0.3, min = 0, max = 2, step=0.1), sliderInput("omega_k", "omega_k :", value = 0.2, min = 0, max = 2, step=0.1), br() ), conditionalPanel(condition="input.tabs=='outputs'", br(), selectInput("output","",c("concentration (Cc)" = "Cc","amount (Ac)" = "Ac")), br(), sliderInput("range", "time range", min = -5, max = 50, value = c(0,20), step=5), br(), sliderInput("ngp", "grid size", min = 11, max = 501, value = 101, step=10), br() ), conditionalPanel(condition="input.tabs=='settings'", sliderInput("level", "level (%)", min = 5, max = 95, value = 80, step=5), sliderInput("nband", "number of bands", min = 1, max = 20, value = 8, step=1), sliderInput("nbsim", "number of simulations", min = 500, max = 5000, value = 1000, step=500), br() ) ), column(9, plotOutput("plot1", height="500px")) )), tabPanel("Table", tableOutput("table")), navbarMenu("Codes", tabPanel("Mlxtran", pre(includeText("pkiiv1_model.txt"))), tabPanel("Simulx", verbatimTextOutput("simulx")), tabPanel("ui.R", pre(includeText("ui.R"))), tabPanel("server.R", pre(includeText("server.R"))) ), tabPanel("ReadMe", withMathJax(), includeMarkdown("readMe.Rmd")), tabPanel("About", includeMarkdown("../../about/about.Rmd")) ) ))
#------------------------------------------------------------------------- # This application is governed by the CeCILL-B license. # You can use, modify and/ or redistribute this code under the terms # of the CeCILL license: http://www.cecill.info/index.en.html # # Marc Lavielle, Inria Saclay # April 30th, 2015 #------------------------------------------------------------------------- library(mlxR) shinyServer(function(input, output, session) { r <- reactive({ if (input$tinf>input$ii) stop("The infusion time should not exceed the interdose interval") param.value=c(input$V_pop,input$k_pop,input$omega_V,input$omega_k) t.value=seq(input$range[1],input$range[2],length.out=input$ngp) t1=input$tfd t2=input$ii*(input$nd-1)+t1 if (t2>=t1){ t.dose=seq(t1,t2,by=input$ii) adm <- list(time=t.dose, amount=input$amt, rate=input$amt/input$tinf) }else{ adm <- list(time=t1, amount=0) } f <- list(name=input$output,time=t.value) p <- list(name=c('V_pop','k_pop','omega_V','omega_k'), value=param.value) g <- list(size=input$nbsim,level='individual') res <- simulx( model = 'pkiiv1_model.txt', treatment = adm, group = g, parameter = p, output = f) ro <- res[[input$output]] }) t <- reactive({ time1=input$tfd time2=input$ii*(input$nd-1)+time1 t1 <- paste0("adm <- list(time=seq(",time1,",",time2,",by=",input$ii,"), amount=",input$amt,", rate=",input$amt/input$tinf,")\n") t2 <- paste0("Cc <- list(name='Cc', time=seq(from=",input$range[1],", to=",input$range[2],", length.out=",input$ngp,"))\n") t3 <- paste0("p <- c(V_pop=",input$V_pop,",k_pop=",input$k_pop,",omega_V=",input$omega_V,",omega_k=",input$omega_k,")\n") t4 <- paste0("g <- list(size=",input$nbsim,", level='individual')\n") t5 <- "res <- simulx(model='pkiiv1_model.txt', parameter=p, output=Cc, treatment=adm, group=g)\n\n" t6 <- paste0("prctilemlx(res$Cc, band=list(number=",input$nband,", level=",input$level,"))") txt <-paste0(t1, t2, t3, t4, t5, t6) return(txt) }) output$plot1 <- renderPlot({ withProgress(message = 'Creating plot', detail='Wait...', value = 0.1, expr={ r=r() qr <- prctilemlx(r,band=list(level=input$level,number=input$nband)) print(qr) }) }) output$table <- renderTable({ r=r() rq <- prctilemlx(r,band=list(level=input$level,number=input$nband),plot=FALSE) y=rq$y }) output$simulx <- renderText(t()) })
The amount \(A_c\) in the central compartment is solution of the ODE \(\ \ \dot{A_c}(t) = - k \, A_c(t)\)
The concentration \(C_c\) in the central compartment is defined by \(\ \ C_c(t) = A_c(t)/V\)
\(V\) and \(k\) are both log-normally distributed: \[ \begin{aligned} \log(V) & \sim {\cal N}(\log(V_{\rm pop}), \omega^2_V) \\ \log(k) & \sim {\cal N}(\log(k_{\rm pop}), \omega^2_k) \end{aligned} \]
By default a 80% prediction interval decomposed in 8 bands is used. Then, the 10th, 20th, 30th, …, 70th and 90th percentiles are displayed.
This application is governed by the CeCILL-B license.
You can use, modify and/or redistribute these codes under the terms of the
CeCILL license.
This Shiny application requires the mlxR package.
Marc Lavielle
Inria Saclay, Popix team
April 29th, 2015