This data are kilojoules of energy that are consumed in starving fish over a time period (Days). The KJ reach a lower asymptote and level off and I would like to use a non-linear plot to show this leveling off. The data are noisy and the sample sizes not the largest. I have tried selfstarting weibull curves and tried the following, both end with errors. Days<-c(12, 12, 12, 12, 22, 22, 22, 22, 32, 32, 32, 32, 37, 38, 38, 39, 39, 39, 39, 39, 39, 39, 1, 1, 1, 1) Joules<-c(8.782010, 8.540524, 8.507526, 11.296904, 4.232690, 13.026588, 10.213342, 4.771482, 4.560359, 6.146684, 9.651727, 8.064329, 9.419335, 7.129264, 6.079012, 7.095888, 17.996794, 7.028287, 8.028352, 5.497564, 11.607090, 9.987215, 11.065307, 21.433094, 20.366385, 22.475717) X11() par(cex=1.6) plot(Joules~Days,xlab="Days after fasting was initiated",ylab="Mean energy per fish (KJ)") model<-nls(joules~a+b*exp(-c*Days),start=list(a=8,b=9,c=-.229), control=list(minFactor=1e-12),trace=TRUE) summary(model) init <- nls(Joules~ SSweibull(Days,Asym,Drop,lrc,pwr), control=list(minFactor=1e-12),data=.GlobalEnv) init Data here is reproducible. As always, thank you...keith -- M. Keith Cox, Ph.D. Alaska NOAA Fisheries, National Marine Fisheries Service Auke Bay Laboratories 17109 Pt. Lena Loop Rd. Juneau, AK 99801 Keith.Cox@noaa.gov marlinkcox@gmail.com U.S. (907) 789-6603 [[alternative HTML version deleted]]
On Thu, Sep 2, 2010 at 7:39 PM, Marlin Keith Cox <marlinkcox at gmail.com> wrote:> This data are kilojoules of energy that are consumed in starving fish over a > time period (Days). ?The KJ reach a lower asymptote and level off and I > would like to use a non-linear plot to show this leveling off. ?The data are > noisy and the sample sizes not the largest. ?I have tried selfstarting > weibull curves and tried the following, both end with errors. > > Days<-c(12, 12, 12, 12, 22, 22, 22, 22, 32, 32, 32, 32, 37, 38, 38, 39, 39, > 39, 39, 39, 39, 39, ?1, ?1, ?1, ?1) > Joules<-c(8.782010, ?8.540524, ?8.507526, 11.296904, ?4.232690, 13.026588, > 10.213342, ?4.771482, ?4.560359, ?6.146684, 9.651727, ?8.064329, ?9.419335, > 7.129264, ?6.079012, ?7.095888, 17.996794, ?7.028287, ?8.028352, ?5.497564, > 11.607090, ?9.987215, 11.065307, 21.433094, 20.366385, 22.475717) > X11() > par(cex=1.6) > plot(Joules~Days,xlab="Days after fasting was initiated",ylab="Mean energy > per fish (KJ)") > model<-nls(joules~a+b*exp(-c*Days),start=list(a=8,b=9,c=-.229), > control=list(minFactor=1e-12),trace=TRUE) > summary(model)Note that Joules is defined above but joules is used as well. We have assumed they are the same. Also note that the formula is linear in log(joules) if a=0 so lets assume a=0 and use lm to solve. Also switch to the "plinear" algorithm which only requires starting values for the nonlinear parameters -- in this case only c (which we get from the lm).> joules <- Joules > coef(lm(log(joules) ~ Days))(Intercept) Days 2.61442015 -0.01614845> > # so use 0.016 as starting value of c > fm <- nls(joules~cbind(1, exp(-c*Days)), start = list(c = 0.016), alg = "plinear"); fmNonlinear regression model model: joules ~ cbind(1, exp(-c * Days)) data: parent.frame() c .lin1 .lin2 0.2314 8.3630 13.2039 residual sum-of-squares: 290.3 -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
Seemingly Similar Threads
- Centos 7 Kernel 3.10.0-693.11.6.el7.x86_64 does not boot PV
- Bug#784810: Xen domU try ton access to dom0 LVM Volume group
- Nouveau: kernel hang on Optimus+Intel+NVidia GeForce 1060m
- masqing a zone connected _via_ a tun.
- Bug#810379: [Xen-devel] [BUG] pci-passthrough generates "xen:events: Failed to obtain physical IRQ" for some devices