From: Leslie Chavez <leslou_at_ctbp.ucsd.edu>

Date: Wed 09 Aug 2006 - 04:22:06 EST

*}
*

#x0=c(T0,I0,V0)

x0=c(2249,0,1)

#parms(lambda, beta, d, delta, p, c)

parms[5:6]=c(1.0,23)

R-help@stat.math.ethz.ch 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. Received on Wed Aug 09 04:39:51 2006

Date: Wed 09 Aug 2006 - 04:22:06 EST

Hi,

I have a system of ODE's I can solve with lsoda.

#parameter definitions

lambda=parms[1]; beta=parms[2];

d = parms[3]; delta = parms[4];

p=parms[5]; c=parms[6] xdot[1] = lambda - (d*x[1])- (beta*x[3]*x[1]) xdot[2] = (beta*x[3]*x[1]) - (delta*x[2]) xdot[3] = (p*x[2]) - (c*x[3])

return(list(xdot))

*}
*

Below is the function I've been using to run 'optim', at the course-grained time scale:

Modelfit=function(s) {

parms[1:4]=s[1:4]; times=c(0,7,12,14,17,20,25) out=lsoda(x0,times,Model,parms) mse=mean((log10(out[,4])-log10(i(times)))^2) # cat(times) return(mse)

#x0=c(T0,I0,V0)

x0=c(2249,0,1)

#parms(lambda, beta, d, delta, p, c)

parms[5:6]=c(1.0,23)

s0=c(49994,8456,6.16E-8,0.012) #initial values

fit=optim(s0,Modelfit)

Right now, lsoda is being run on too course-grained a time scale in the function Modelfit. Most examples of optim and nls I have found compare two data sets at the same times, and run lsoda on the time scale the data is available at, but I would like to run lsoda at a finer scale, and only compare the appropriate time points with the experiment. I have also tried using nls, but I have the same problem. Does anyone have suggestions?

Thank you very much,

Leslie

R-help@stat.math.ethz.ch 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. Received on Wed Aug 09 04:39:51 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Thu 10 Aug 2006 - 20:20:50 EST.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*