[R] Changing state in ODE
Paul Hutson
prhutson at pharmacy.wisc.edu
Tue Jun 2 15:35:45 CEST 2009
I am trying to fit data from human and animal pharmacokinetic studies in
which drug concentrations have been determined over time over the course
of several doses. In this case, the data are expected to be fit by a
saturable (Michaelis-Menton) process. I can get the ode routine to run
with only one, initial dose. How can I modify the state at intermediate
time points to reflect additional input functions? My script follows,
with the doses and times noted.
Thanks in advance. Paul
# Script for running mixed order (Michaelis-Menton) fit of data
BB_sim1 <- read.table("BB_sim1.csv", sep=",", header=TRUE, na.strings=".")
Time <- BB_sim1$TIME
MM.1dose<-function(time, state, pars)
{
with(as.list(c(state,pars))
{
dA <- Vmax * CONC[1] /(Km + CONC)
return (list(c(dA)))
}
)
}
name.column(BB_sim1)
Doses<-c(0.2, 1, 5)
#if(Time==0) Dose=Doses[1]
#if(Time==10 ) Dose=Doses[2]
#if(Time==25) Dose=Doses[3]
state <- c(CONC=CONC+Dose/V)
parms <- c (
Vmax = 20
Km = 2
V = 0.07
)
require(deSolve)
MM1.out <- as.data.frame(ode(state, Time, MM.1dose, parms))
ylim <- reange(c(MM1.out$Conc)
plot(MM1.out$Time, MM1.out$Conc, xlab="Time", ylab="Conc", type="1",
ylim=ylim
--
Paul R. Hutson, Pharm.D.
Associate Professor
UW School of Pharmacy
777 Highland Avenue
Madison WI 53705-2222
Tel 608.263.2496
Fax 608.265.5421
Pager 608.265.7000, p7856
More information about the R-help
mailing list