Re: [R] bug in nls?

2008-06-27 Thread Petr PIKAL
Thank you both. Katharine approach seemed to me easier to implement so I used it successfully. However I still wonder why in linear model using lm I can use for (i in ) lm( data[,i]~data[,1]) but in nls the same construction fails. I understand that it is sometimes difficult to set

Re: [R] bug in nls?

2008-06-27 Thread Petr PIKAL
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

Re: [R] bug in nls?

2008-06-27 Thread Prof Brian Ripley
As has already been pointed out, the syntax of formulae in nls() is not the same as in linear models. So things which are valid for linear models are not necessarily valid for others. Since nls() is sparsely documented on the help page, you need to look at the references (and you can also

[R] bug in nls?

2008-06-26 Thread Petr PIKAL
Dear all Nobody responded to my previous post so far so I try with more offending subject. 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. Here is an example DF-data.frame(x=1:10,

Re: [R] bug in nls?

2008-06-26 Thread Katharine Mullen
Dear Petr, I think it's a feature. the formula interface also won't let you specify the slots of S4 objects in the model spec. How about coef(nls(y~a*x^b, data=list(x=DF[,1], y=DF[,2]), start=list(a=3, b=.7))) ? On Thu, 26 Jun 2008, Petr PIKAL wrote: Dear all Nobody responded to my

Re: [R] bug in nls?

2008-06-26 Thread Gabor Grothendieck
Try this and note, in particular, that the model: line in the output has the correct variables substituted: nm - names(DF) eqn - sprintf(%s ~ a * %s, nm[2], nm[1]) nls(eqn, DF, start = c(a = 1)) Nonlinear regression model model: y ~ a * x data: DF a 1.133 residual sum-of-squares:

Re: [R] bug in nls?

2008-06-26 Thread Berwin A Turlach
G'day Petr, On Thu, 26 Jun 2008 13:57:39 +0200 Petr PIKAL [EMAIL PROTECTED] 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