[R] nls fits by groups

Christian Ritz ritz at life.ku.dk
Mon Sep 24 07:33:39 CEST 2007


Dear Aleksi,

there are other approaches you could consider: using nls or gnls (in the package nlme):

m1 <- nls(y ~ a[group]*x^b[group], start=list(a=c(1, ..., 1), b=c(1, ..., 1)))


or


m2 <- gnls(rate ~ a*x^b, params=list(a~group-1, b~group-1),
start=list(a=c(1, ..., 1), b=c(1, ..., 1)))


In both cases there should be specified as many initial values of a and b as there are 
groups (levels in the factor group).

Both approaches can also be used to specified simplified models where some parameter is 
assumed to be in common for all groups.


Christian



More information about the R-help mailing list