Langkah-langkah simulasi farmakokinetika dengan R
#Memanggil paket
library(ggplot2)
library(ggpubr)
library(deSolve)
#Mendefinisikan persamaan
iv.2comp <-function(t, state, parameters) {
with(as.list(c(state, parameters)),{
# rate of change
dC1 <- k21*C2/V1 - (k12+ke)*C1
dC2 <- k12*C1/V2 - k21*C2
# return the rate of change
list(c(dC1, dC2))
}) # end with(as.list ...
}
#dose = 100
#V1 = 10
#C1 pada waktu nol = dose/V1
state <- c(C1 = 10, C2 = 0) #pada waktu ke nol
time <- seq(0, 100, .01) #Interval waktu pengamatan
#mendefinisikan parameter
parameters <- c(k12 = .23, k21 = .11, ke = 0.32, V1 = 10, V2 = .5)
#Simulasi farmakokinetika untuk dosis tunggal
out <- ode(y = state, times = time, func = iv.2comp, parms= parameters)
dat1 <- as.data.frame(out)
head(dat1)
## Plot simulasi farmakokinetika pada dosis tunggal
c1 <- ggplot(dat1, aes(y = C1, x = time)) + geom_line(colour = 'red', size=1 + scale_y_log10()
c2 <- ggplot(dat1, aes(y = C2, x = time)) + geom_line(colour = 'red', size=1) + scale_y_log10()
ggarrange(c1,c2, labels=c("C1", "C2"))
#Pengaturan dosis berulang; injeksi tiap 12 jam 100 mg
regiment.dose <- data.frame(var=c('C1'),
time = seq(from=12, to = 72, by = 12),
value = 100/10, method='add')
#Simulasi farmakokinetika dosis berulang
out <- ode(y = state, times = time, func = iv.2comp, parms= parameters,
method="impAdams", event = list(data=regiment.dose))
dat1 <- as.data.frame(out)
#Plot simulasi farmakokinetika dosis berulang
c1 <- ggplot(dat1, aes(y = C1, x = time)) + geom_line(colour = 'red', size=1) + scale_y_log10()
c2 <- ggplot(dat1, aes(y = C2, x = time)) + geom_line(colour = 'red', size=1) + scale_y_log10()
ggarrange(c1,c2, labels=c("A", "B"))
##Selesai##
Hasilnya silakan dicek di sini
Komentar
Posting Komentar