

   nls {nls}                                    R Documentation

   NNoonnlliinneeaarr LLeeaasstt SSqquuaarreess

   DDeessccrriippttiioonn::

        Determine the nonlinear least squares estimates of the
        parameters.

   UUssaaggee::

        nls(formula, data, start, control=nls.control(),
            algorithm="default", trace=F, subset, na.action)

   AArrgguummeennttss::

    formula: a nonlinear model formula including variables and
             parameters

       data: an optional data frame in which to evaluate the
             variables in `formula'

      start: a named list or named numeric vector of starting
             estimates

    control: an optional list of control settings.  See
             `nlsControl' for the names of the settable control
             values and their effect.

   algorithm: character string specifying the algorithm to use.
             The default algorithm is a Gauss-Newton algorithm.
             The other alternative is "plinear", the Golub-
             Pereyra algorithm for partially linear least-
             squares models.

     subset: an optional vector specifying a subset of observa-
             tions to be used in the fitting process.

   na.action: a function which indicates what should happen
             when the data contain `NA's.

   DDeettaaiillss::

        An `nls' object is a type of fitted model object.  It
        has methods for the generic functions `coef', `for-
        mula', `resid', `print', `summary', and `fitted'.

   VVaalluuee::

        A list of

          m: an `nlsModel' object incorporating the model

       data: the expression that was passed to `nls' as the
             data argument.  The actual data values are present
             in the environment of the `m' component.

   AAuutthhoorr((ss))::

        Douglas M. Bates and Saikat DebRoy

   RReeffeerreenncceess::

        Bates, D.M. and Watts, D.G. (1988), Nonlinear Regres-
        sion Analysis and Its Applications, Wiley

   SSeeee AAllssoo::

        `nlsModel'

   EExxaammpplleess::

        library( nls )
        data( DNase )
        DNase1 <- DNase[ DNase$Run == 1, ]
        ## using a selfStart model
        fm1DNase1 <- nls( density ~ SSlogis( log(conc), Asym, xmid, scal ), DNase1 )
        summary( fm1DNase1 )
        ## using conditional linearity
        fm2DNase1 <- nls( density ~ 1/(1 + exp(( xmid - log(conc) )/scal ) ),
                          data = DNase1,
                          start = list( xmid = 0, scal = 1 ),
                          alg = "plinear", trace = TRUE )
        summary( fm2DNase1 )
        ## without conditional linearity
        fm3DNase1 <- nls( density ~ Asym/(1 + exp(( xmid - log(conc) )/scal ) ),
                          data = DNase1,
                          start = list( Asym = 3, xmid = 0, scal = 1 ),
                          trace = TRUE )
        summary( fm3DNase1 )

