Aleksi Lehtonen <lehtonen.aleksi <at> gmail.com> writes:

> I am trying to estimate several non-linear models simultaneously. I don't
> want to use non-linear mixed model, but non-linear model with same form, but
> it should be estimated separately according to variable group (I have lots
> of groups that have lots of observations....). I would like to have unique
> parameters for each group.
> 
> e.g. something like this
> 
> mod <- nls(y ~ a*x^b, start=c(a=1, b=1), group=group)
> 
> but knowing that group option does not work. If someone has an idea (or has
> done it already) how to implement this either using just nls statement or by
> building a simple function in R, I would be very grateful for hints....

Why not nlsList from the nlme package.  It would look something like this:

 mod <- nlsList(y ~ a*x^b | group, start=c(a=1, b=1))

you might have to add a data argument, too, depending on where your data is.

HTH,

Ken

______________________________________________
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