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 > <caspervec...@gmail.com> 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: > > set.seed(123) # for reproducibility > x <- 1:10 > y <- 1 + 2 * log(1 + 3 * x) + rnorm(1, sd = 0.5) > fitc <- function(c) lm.fit(cbind(1, log(1 + c * x)), y) > rssvals <- function(c) sum(resid(fitc(c))^2) > out <- optimize(rssvals, c(0.01, 10)) > > which gives: > 0.7197666 2.0000007 2.9999899
-- Using GPG/PGP? Please get my current public key (ID: 0xAEF6A134, valid from 2010 to 2013) from a key server.
signature.asc
Description: Digital signature
______________________________________________ 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.