Thank you all for your help.

Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA
http://www.fws.gov/redbluff/rbdd_jsmp.aspx



>________________________________
>From: Gabor Grothendieck <ggrothendi...@gmail.com>
>To: Felipe Carrillo <mazatlanmex...@yahoo.com> 
>Cc: "r-help@r-project.org" <r-help@r-project.org> 
>Sent: Thursday, July 12, 2012 1:03 PM
>Subject: Re: [R] nls question
>
>On Thu, Jul 12, 2012 at 3:40 PM, Felipe Carrillo
><mazatlanmex...@yahoo.com> wrote:
>> I get a different error now:
>>>  nls(weight ~ cbind(1, exp(gamma*week)), weightData, start = list(gamma=
>>> 0.2), alg = "plinear")
>> Error in nls(weight ~ cbind(1, exp(gamma * week)), weightData, start =
>> list(gamma = 0.2),  :
>>  step factor 0.000488281 reduced below 'minFactor' of 0.000976562
>> The help file says: ........When start is missing, a very cheap guess for
>> start is tried (if algorithm != "plinear").
>
>
>Please give a reproducible example by setting the seed.  This
>reproducible example converges:
>
>> set.seed(123)
>> weight_random <- runif(50,1,24)
>> weight <- sort(weight_random)
>> weightData <- data.frame(weight,week=1:50)
>> nls(weight ~ cbind(1, exp(gamma*week)), weightData, start = list(gamma = 
>> 0.2), alg = "plinear")
>Nonlinear regression model
>  model:  weight ~ cbind(1, exp(gamma * week))
>  data:  weightData
>    gamma      .lin1      .lin2
>1.136e-03 -3.949e+02  3.962e+02
>residual sum-of-squares: 9.17
>
>Number of iterations to convergence: 8
>Achieved convergence tolerance: 9.581e-06
>
>as does nls with Gauss Newton:
>
>> nls(weight ~ alpha + beta*exp(gamma*week), weightData, start =
>+ c(alpha = 0.0, beta = 1, gamma = 0.2)
>+ )
>Nonlinear regression model
>  model:  weight ~ alpha + beta * exp(gamma * week)
>  data:  weightData
>    alpha      beta      gamma
>-3.949e+02  3.961e+02  1.136e-03
>residual sum-of-squares: 9.17
>
>Number of iterations to convergence: 48
>Achieved convergence tolerance: 2.906e-06
>
>>
>> So I removed  'plinear' from the call and got the following:
>>  nls(weight ~ cbind(1, exp(gamma*week)), weightData,start =
>> list(gamma=0.2),trace=TRUE)
>
>It cannot be specified as if it were a plinear model but then use
>Gauss-Newton.  See ?nls
>
>
>-- 
>Statistics & Software Consulting
>GKX Group, GKX Associates Inc.
>tel: 1-877-GKX-GROUP
>email: ggrothendieck at gmail.com
>
>
>
        [[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