[R] non linear modelling with nls: starting values

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Sep 18 17:55:24 CEST 2006

```"Gabor Grothendieck" <ggrothendieck at gmail.com> writes:

> Here are some approaches:
>
> - we only have 4 parameters so just use grid search to get
> starting values as in:
>
> https://stat.ethz.ch/pipermail/r-help/2005-September/079617.html
>
> - there are singularities near beta_1 = beta_2 and near alpha_1 = 0
> and near alpha_2 = 0 so reparameterize and use the upper and
> lower bounds to avoid those regions.  You could try a separate
> reduced model for those.

Or just use SSbiexp and reparametrize (it is exactly the same model)

>
> On 9/18/06, Sebastian P. Luque <spluque at gmail.com> wrote:
> > Hi,
> >
> > I'm trying to fit the following model to data using 'nls':
> >
> >
> > y = alpha_1 * beta_1 * exp(-beta_1 * x) +
> >    alpha_2 * beta_2 * exp(-beta_2 * x)
> >
> >
> > and the call I've been using is:
> >
> >
> > nls(y ~ alpha_1 * beta_1 * exp(-beta_1 * x) +
> >        alpha_2 * beta_2 * exp(-beta_2 * x),
> >    start=list(alpha_1=4, alpha_2=2, beta_1=3.5, beta_2=2.5),
> >    trace=TRUE, control=nls.control(maxiter = 200))
> >
> >
> > So the model has 4 parameters (alpha_1, alpha_2, beta_1, beta_2), but
> > providing appropriate starting values is proving difficult.  Although the
> > data could reasonably be fit with this model, the procedure is exiting
> > with "singular gradient matrix at initial parameter estimates".  How can
> > one obtain appropriate starting values, assuming that is really the
> > problem?  The archives show some suggestions to use 'optim', but that
> > requires starting values too, so I'm not sure how to proceed.
> >
> > Searching for self-starting functions, I found that there's one for a
> > bi-exponential model, which is very similar to the one I'm trying to fit.
> > Would it be reasonable to create a modified version of this function, so
> > that it returns a value that can be used for the model above?  I would
> > greatly appreciate any comments and suggestions.
> >
> >
> > --
> > Seb
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help