search for: modfun

Displaying 2 results from an estimated 2 matches for "modfun".

2005 Jul 19
2
Michaelis-menten equation
...<-data.frame(time=c(0,1,2,4,6,8,10,12,16,20,24), conc=c(8.57,8.30,8.01,7.44,6.88,6.32,5.76,5.20,4.08,2.98,1.89)) mm.model <- function(time, y, parms) { dCpdt <- -(parms["Vm"]/parms["Vd"])*y[1]/(parms["Km"]+y[1]) list(dCpdt)} Dose<-300 modfun <- function(time,Vm,Km,Vd) { out <- lsoda(Dose/Vd,time,mm.model,parms=c(Vm=Vm,Km=Km,Vd=Vd), rtol=1e-8,atol=1e-8) out[,2] } objfun <- function(par) { out <- modfun(PKindex$time,par[1],par[2],par[3]) sum((PKindex$conc-out)^2) } fit <- optim(c(1...
2012 Nov 26
1
Help on function please
...unction is hard to figure out (for me at least) I have the following so far:   PKindex<-data.frame(Subject=c(1),time=c(1,2,3,4,6,10,12),conc=c(32,28,25,22,18,14,11)) Dose<-200 Tinf <-0.5   defun<- function(time, y, parms) {  dCpdt <- -parms["kel"] * y[1]  list(dCpdt)  } modfun <- function(time,kel, Vd) {   out <- lsoda(((Dose/Tinf)*(1/(kel*Vd)))*(1-exp(-kel*time)),c(0,time),defun,parms=c(kel=kel,Vd=Vd),rtol=1e-3,atol=1e-5)  out[-1,2]  } objfun <- function(par) {  out <- modfun(PKindex$time, par[1], par[2])  gift <- which( PKindex$conc != 0 )  sum((PKinde...