Re: [R] Problem with logarithmic nonlinear model using nls() from the `stats' package

2011-10-01 Thread Casper Ti. Vector
Ah, now I see... Thanks very much :) On Sat, Oct 01, 2011 at 09:27:34AM -0400, Gabor Grothendieck wrote: > On Sat, Oct 1, 2011 at 5:28 AM, Casper Ti. Vector > wrote: > Its linear given c so calculate the residual sum of squares using lm > (or lm.fit which is faster) given c and optimize over c: >

Re: [R] Problem with logarithmic nonlinear model using nls() from the `stats' package

2011-10-01 Thread Gabor Grothendieck
On Sat, Oct 1, 2011 at 9:27 AM, Gabor Grothendieck wrote: > On Sat, Oct 1, 2011 at 5:28 AM, Casper Ti. Vector > wrote: >> Example: >> >>> f <- function(x) { 1 + 2 * log(1 + 3 * x) + rnorm(1, sd = 0.5) } >>> y <- f(x <- c(1 : 10)); y >>  [1] 4.503841 5.623073 6.336423 6.861151 7.276430 7.620131 7.

Re: [R] Problem with logarithmic nonlinear model using nls() from the `stats' package

2011-10-01 Thread Gabor Grothendieck
On Sat, Oct 1, 2011 at 5:28 AM, Casper Ti. Vector wrote: > Example: > >> f <- function(x) { 1 + 2 * log(1 + 3 * x) + rnorm(1, sd = 0.5) } >> y <- f(x <- c(1 : 10)); y >  [1] 4.503841 5.623073 6.336423 6.861151 7.276430 7.620131 7.913338 8.169004 >  [9] 8.395662 8.599227 >> nls(x ~ a + b * log(1 +

[R] Problem with logarithmic nonlinear model using nls() from the `stats' package

2011-10-01 Thread Casper Ti. Vector
Example: > f <- function(x) { 1 + 2 * log(1 + 3 * x) + rnorm(1, sd = 0.5) } > y <- f(x <- c(1 : 10)); y [1] 4.503841 5.623073 6.336423 6.861151 7.276430 7.620131 7.913338 8.169004 [9] 8.395662 8.599227 > nls(x ~ a + b * log(1 + c * x), start = list(a = 1, b = 2, c = 3), trace = > TRUE) 37.22954