Thank you. Could you lastly help me with this error. I was trying to use a self starting function (Weibull).
model<-nls(Level~ SSweibull(Time,Asym,Drop,lrc,pwr)) Error in qr.default(.swts * attr(rhs, "gradient")) : NA/NaN/Inf in foreign function call (arg 1) On Thu, Aug 26, 2010 at 1:42 PM, David Winsemius <dwinsem...@comcast.net>wrote: > > On Aug 26, 2010, at 5:20 PM, Marlin Keith Cox wrote: > > The background you requested are energetic level (joules) in a group of > starved fish over a time period of 45 days. Weekly, fish (n=5) were removed > killed and measured for energy. This was done at three temperatures. I am > comparing the rates at which the fish consume stored body energy at each of > the three temperatures. Initial data looks like the colder fish > have different rates (as would be expected) than do warmer fish. In all > cases the slope is greatest at the beginning of the curve and flattens after > several weeks. This is what is interesting - where in time the line > starts to flatten out. > > By calculating a non-linear equation of a line, I was hoping to use the > first and second derivatives of the function to compare and explain > differences between the three temperature. > > The data originally posted was an example of one of the curves experienced. > > > You might be interest in what happens when you expand the plot a bit using > the fm1 model: > > plot(Level~Time, xlim=c(0,40), ylim=c(0,max(Level)) ) > lines(0:40, predict(fm1, data.frame(Time=0:40 ) ) , col="red", pch=4) > abline(h=0) > > And not forgetting that extrapolation beyond the limits of data is a > dangerous maneuver. In this instance any Weibull model would predict some > sort of decay to 0, which may or may not be scientifically plausible. > > -- > David. > > > kc > > On Thu, Aug 26, 2010 at 9:48 AM, David Winsemius > <dwinsem...@comcast.net>wrote: > >> >> On Aug 26, 2010, at 1:35 PM, Marlin Keith Cox wrote: >> >> I need the parameters estimated for a non-linear equation, an example of >>> the >>> data is below. >>> >>> >>> # rm(list=ls()) I really wish people would add comments to destructive >>> pieces of code. >>> >> >> Time<-c( 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, >>> 4, 4, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8) >>> Level<-c( 100, 110, 90, 95, 87, 60, 65, 61, 55, 57, 40, 41, >>> 50, >>> 47, >>> 44, 44, 42, 38, 40, 37, 37, 35, 40, 34, 32, 20, 22, 25, 27, >>> 29) >>> plot(Time,Level,pch=16) >>> >> >> You did not say what sort of "non-linear equation" would best suit, nor >> did you offer any background regarding the domain of study. There must be >> many ways to do this. After looking at the data, a first pass looks like >> this: >> >> > lm(log(Level) ~Time ) >> >> Call: >> lm(formula = log(Level) ~ Time) >> >> Coefficients: >> (Intercept) Time >> 4.4294 -0.1673 >> >> > exp(4.4294) >> [1] 83.88107 >> > points(unique(Time), exp(4.4294 -unique(Time)*0.1673), col="red", pch=4) >> >> Maybe a Weibull model would be more appropriate. >> >> >> -- >> >> David Winsemius, MD >> West Hartford, CT >> >> > > > -- > M. Keith Cox, Ph.D. > Alaska NOAA Fisheries, National Marine Fisheries Service > Auke Bay Laboratories > 17109 Pt. Lena Loop Rd. > Juneau, AK 99801 > keith....@noaa.gov > marlink...@gmail.com > U.S. (907) 789-6603 > > > David Winsemius, MD > West Hartford, CT > > -- M. Keith Cox, Ph.D. Alaska NOAA Fisheries, National Marine Fisheries Service Auke Bay Laboratories 17109 Pt. Lena Loop Rd. Juneau, AK 99801 keith....@noaa.gov marlink...@gmail.com U.S. (907) 789-6603 [[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.