Andras,

What do you want your code to do?  Give us a little explanation with your 
code.

When I try to run your code, I get
        Error: could not find function "genoud".
Either supply the code for the functions included in your code, or tell us 
what packages we need to run it.

Jean



Andras Farkas <motyoc...@yahoo.com> wrote on 11/26/2012 02:43:25 PM:
> 
> Dear All,
>  
> I could use a bit of help here, this function 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((PKindex$conc[gift]-out[gift])^2)
>  }        
> gen<-genoud
> 
(objfun,nvars=2,max=FALSE,pop.size=30,max.generations=100,wait.generations=100,starting.value=c
> (0.7,
> 60),BFGS=FALSE,print.level=0,boundary.enforcement=2,Domains=matrix(c
> (0.01,0.01,100,100),2,2),MemoryMatrix=TRUE)
>  
> but get the following:
>  Error in lsoda(((Dose/Tinf) * (1/(kel * Vd))) * (1 - exp(-kel * time)), 
 : 
>   The number of derivatives returned by func() (1must equal the 
> length of the initial conditions vector (7)
>  
> i figured that having the "time" parameter in the equation screws 
> things up, but do not now how to fix it bc I do not understand the 
> warning message.
>  
>  
> your help is greatly apreciated,
>  
> Sincerely,
>  
> Andras

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to