From bkerin at fastmail.fm  Fri Jun 22 21:42:57 2007
From: bkerin at fastmail.fm (bkerin at fastmail.fm)
Date: Fri, 22 Jun 2007 21:42:57 +0200 (CEST)
Subject: [Rd] nonlinear fitting documentation error (PR#9749)
Message-ID: <20070622194257.3DDBD659A2@slim.kubism.ku.dk>

Full_Name: Britton Kerin
Version: docs on web
OS: linux
Submission from: (NULL) (216.67.49.115)


This section from the introduction to R confused me (reason below):

   11.7.1 Least squares

   One way to fit a nonlinear model is by minimizing the sum of the squared
errors    
   (SSE) or residuals. This method makes sense if the observed errors could have

   plausibly arisen from a normal distribution.

   Here is an example from Bates & Watts (1988), page 51. The data are:

        > x <- c(0.02, 0.02, 0.06, 0.06, 0.11, 0.11, 0.22, 0.22, 0.56, 0.56,
              1.10, 1.10)
        > y <- c(76, 47, 97, 107, 123, 139, 159, 152, 191, 201, 207, 200)

   The model to be fitted is:

        > fn <- function(p) sum((y - (p[1] * x)/(p[2] + x))^2)

   In order to do the fit we need initial estimates of the parameters. One way
to 
   find sensible starting values is to plot the data, guess some parameter
values, 
   and superimpose the model curve using those values.

The problem is that fn is not the model to be fitted.  The model is y = p1*x/(p2
+ x).  The function fn is the function to be minimized.  So I think the
sendtence 'The model to be fitted is:' should be changed to 'The function to be
minimized is:" or something like that.



[Rd] nonlinear fitting documentation error (PR#9749)
bkerin at fastmail.fm