Hello R-Community, we are running aprogram to fit Non-linear differential equations to Aphid population Data and to estimate the birth and death parameters, here is the code:
dat<-data.frame(Time=c(0:60),Cur=c(5,6.2,59,39,38,44,20.4,19.4,34.2,35.4,38.2,48.2,55.4,113.2, 97,112,115,126,136.6,140.6,147.2,151.6,157.8,170,202,210.4,221.2,224.4,248.2,266, 277,291.4,392,461.2,470,418,410.8,395.6,365.2,189.4,43.4,33.2,32,29,26,26,25.6,24.6, 24,23.4,18.4,17.6,15.8,13.6,10.6,8.4,6.4,5.4,4.2,3.6,2.7)) times<-c(0:60) f <- function(t,xx,pars){ Cur<- xx[1] Cum<- xx[2] a <- pars[1] b <- pars[2] dCur <- a*Cur-b*Cur*Cum^2 dCum <- Cur list(c(dCur,dCum)) } require(nls) fit <- nls(Cur ~ lsoda(c(Cur=1,Cum=1), times, f, c(a=a, b=b))[,2], data=dat, start=list(a=2.5, b=.01), trace=T ) print(coef(fit)) It runs the first iterations and shows the output, after the intial eveluation it send the following error message: 92 : 2.50 0.01 Error in numericDeriv(form[[3]], names(ind), env) : Missing value or an infinity produced when evaluating the model In addition: There were 50 or more warnings (use warnings() to see the first 50) > print(coef(fit)) Error in coef(fit) : object "fit" not found Looking forward to hear soon Thanks Raj [[alternative HTML version deleted]] ______________________________________________ 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