Learn R Programming

pksensi (version 1.0.0)

solve_mcsim: Solve PK Model Through MCSim

Description

The solve_mcsim can solve the differential equations of time-dependent quantity/concentration in different tissues/compartments through MCSim.

Usage

solve_mcsim(x, mName, infile.name, outfile.name, n = NULL,
  setpoint.name = NULL, params = NULL, vars = NULL, time = NULL,
  condition = NULL)

generate_infile(infile.name, outfile.name, params, vars, time, condition, rtol = 1e-06, atol = 1e-09, n = NULL, dist = NULL, q.arg = NULL)

Arguments

x

a list of storing information in the defined sensitivity function.

mName

a string giving the name of the model or C file (without extension).

infile.name

a character to assign the name of input file.

outfile.name

a character to assign the name of output file.

n

a numeric to define the sample number.

setpoint.name

a character to assign the name of file for parameter matrix.

params

a character to assign the testing parameters.

vars

a character or a vector to assign the selected output(s).

time

a numeric to define the given time point(s).

condition

a character to set the specific parameter value in the input file.

rtol

an argument passed to the integrator (default 1e-6).

atol

an argument passed to the integrator (default 1e-9).

dist

a vector of distribution names corresponding to <distribution-name> in MCSim.

q.arg

a list of shape parameters in the sampling distribution (dist).

Value

The output result is the 4-dimension array with c(model evaluations, replications, time-points, output variables).

Functions

  • solve_mcsim: Numerical analysis for the PK model by MCSim.

  • generate_infile: Generate the MCSim input file.

Details

This function allows users to use external data file that assigned in setpoint.name as parameter matrix. If you want to use it, be sure to define n and setpoint.name.

Examples

Run this code
# NOT RUN {
url <- "https://raw.githubusercontent.com/nanhung/pksensi/master/tests/1cpt.model"
destfile <- paste0(getwd(),"/1cpt.model")
download.file(url, destfile)
mName <- "1cpt"
compile_model(mName)

q <- "qunif"
q.arg <- list(list(min = 0.6, max = 1.0),
   list(min = 0.5, max = 1.5),
   list(min = 0.02, max = 0.3),
   list(min = 20, max = 60))

params <- c("Fgutabs","k_a","k_e","V_dist")

set.seed(1234)
x <- rfast99(params = params, n = 200, q = q, q.arg = q.arg, rep = 20)

infile.name <- "example.in"
outfile.name <- "example.csv"
vars <- "C_rest"

t <- seq(from = 0.25, to = 12.25, by = 0.5)

y <- solve_mcsim(x, mName = mName, infile.name = infile.name,
setpoint.name = "setpoint.dat",
outfile.name = outfile.name, params = params, vars = vars, time = t,
condition = "IngDose = 1")

pksim(y)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab