easy.mrgsim: Simulate from a model object

Description Usage Arguments Value Examples

View source: R/PK.R

Description

Extended version of mrgsim function from mrgsolve package to compute predictions of PK models following mrgsolve model specifications.

Usage

1
2
3
easy.mrgsim(model, dosing_schedule = NULL, parameters = NULL,
  variability = NULL, precision = 0.1, tend, scale = 1,
  scale.x = 1, missing_times = NULL, ...)

Arguments

model

Structural PK model definition (mrgsolve model specification)

dosing_schedule

Dosing schedule to simulate the PK model

parameters

Estimates of the pharmacokinetic parameters of the model.

variability

variability terms for the specified PK parameters.

precision

number: increment of the sequence to simulate from 0 to tend.

tend

Final time for the simulation of the PK model.

scale

scaling parameter for y axis

scale.x

scaling parameter for x axis

missing_times

numeric vector to indicate the times where the patient missed some of the doses specified in the dosing_schedule argument.

...

additional arguments for the mrgsim function from mrgsolve package

Value

This function computes predictions of PK models following mrgsolve model specifications.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## Not run: 
# mrgsolve model specification for a one compartment model and intravenuos administration:
 code_iv <- '$PARAM @annotated
 TVCL   :  8 : Clearance (volume/time)
 TVV    : 80 : Central volume (volume)
 
 $CMT  @annotated
CENT : Central compartment


$MAIN
double CL = exp(log(TVCL) + ETA1);
double V = exp(log(TVV)  + ETA2);

$OMEGA @labels ETA1 ETA2
0 0

$GLOBAL
#define CP (CENT)

$PKMODEL ncmt = 1, depot = FALSE

$CAPTURE @annotated
CP : Plasma concentration (mass/volume)'

library(mrgsolve)

#Read the code:
cmt1_iv<- mcode("mymodel", code_iv)%>% Req(CP) 

#Specify dosing schedule: 150mg once a day for a month (30 days). The dose is given at time 0.
d1 <- ev(amt = 150, ii = 1, addl = 30, time=0)

#Define or change the parameters for the model. Use a list:
newpar <- list(TVCL=7.14*24,TVV=155)
# * TVCL: Typical value for the clearance (volume/time) 
# * TVV: Typical value for the volumen of distribution
# To see the names of the parameters in the model:
param(cmt1_iv)

#Simulate the model with easy.mrgsim function 
easy.mrgsim(model=cmt1_iv,dosing_schedule=d1,tend=30,delta=0.1,parameters = newpar) %>% plot

#Now simulate another dosign schedule: 1600mg once a week for 45 days. The dose is given at day 2.
d2 <- ev(amt = 1600, ii = 7, addl = 30, time=2)

easy.mrgsim(model=cmt1_iv,dosing_schedule=d2,tend=45,delta=0.1,parameters = newpar) %>% plot

#Save the results as a data.frame
Simulation2<-as.data.frame(
easy.mrgsim(model=cmt1_iv,dosing_schedule=d2,tend=45,delta=0.1,parameters = newpar))

## End(Not run)

Michorlab/ACESO documentation built on June 4, 2021, 4:57 p.m.