Re: [R] bug in nls?

From: Petr PIKAL <petr.pikal_at_precheza.cz>
Date: Fri, 27 Jun 2008 11:49:14 +0200

Thank you Berwin.

Ok, I take your point. I normally do nls modelling interactively but this time I was given a set of data so I tried to use an approach which I use quite often in lm or in plotting to pdf file. I obviously was not successful and there is nothing about it in documentation or at least I did not find it :-).

I used Katharine's solution and will look on Gabor's too later.

Regards
Petr

Berwin A Turlach <berwin_at_maths.uwa.edu.au> napsal dne 26.06.2008 20:59:20:

> G'day Petr,
>
> On Thu, 26 Jun 2008 13:57:39 +0200
> Petr PIKAL <petr.pikal_at_precheza.cz> wrote:
>
> > I just encountered a strange problem with nls formula. I tried to use
> > nls in cycle but I was not successful. I traced the problem to some
> > parse command.
> >
> > [...]
> >
> >
> > I am not sure if this behaviour is a bug or feature. [...]
>
> It is definitely a feature.
>
> It is an error to believe that all modelling functions that use
> modelling formulae use the same syntax for their modelling formulae.
> This is, perhaps, easiest realised by observing how lm() and nls()
> interpret "*" and "/" in model formulae.
>
> In nls(), "[..]" can be used to index parameters, if the parameter is
> allowed to change between groups in the data. This seems to be a
> little known feature, though there is an example that uses that feature
> in MASS. The contributed documentation "An Introduction to R: Software
> for Statistical Modelling & Computing" by Petra Kuhnert and Bill
> Venables, available from CRAN, also has such an example on pages 134
> and 230.
>
> The fact that nls() allows you to use "[..]" to index parameters in the
> model formulae seems to conflict with the way you wanted to specify
> the observed values in the formula. I guess Gabor's solution is a fix
> for your problem.
>
> Cheers,
>
> Berwin
>
> =========================== Full address =============================
> Berwin A Turlach Tel.: +65 6515 4416 (secr)
> Dept of Statistics and Applied Probability +65 6515 6650 (self)
> Faculty of Science FAX : +65 6872 3919
> National University of Singapore
> 6 Science Drive 2, Blk S16, Level 7 e-mail: statba_at_nus.edu.sg
> Singapore 117546 http://www.stat.nus.edu.sg/~statba



R-help_at_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. Received on Fri 27 Jun 2008 - 09:54:43 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 27 Jun 2008 - 11:31:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive