Rev 30449 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{nlsModel}\alias{nlsModel}\alias{nlsModel.plinear}\title{Create an nlsModel Object}\usage{nlsModel(form, data, start)}\arguments{\item{form}{a nonlinear model formula}\item{data}{a data frame or a list in which to evaluate the variablesfrom the model formula}\item{start}{a named list or named numeric vector of startingestimates for the parameters in the model}}\description{This is the constructor for \code{nlsModel} objects, which arefunction closures for several functions in a list. The closureincludes a nonlinear model formula, data values for the formula, aswell as parameters and their values.}\details{An \code{nlsModel} object is primarily used within the \code{nls}function. It encapsulates the model, the data, and the parameters inan environment and provides several methods to access characteristicsof the model. It forms an important component of the object returnedby the \code{nls} function.See \code{\link{nls}} for where elements of the formula \code{form}are looked for. In normal use all the variables will be in \code{data}.}\value{The value is a list of functions that share a common environment.\item{resid}{returns the residual vector evaluated at the currentparameter values}\item{fitted}{returns the fitted responses and their gradient at thecurrent parameter values}\item{formula}{returns the model formula}\item{deviance}{returns the residual sum-of-squares at the currentparameter values}\item{gradient}{returns the gradient of the model function at thecurrent parameter values}\item{conv}{returns the relative-offset convergence criterionevaluated at the current parmeter values}\item{incr}{returns the parameter increment calculated according tothe Gauss-Newton formula}\item{setPars}{a function with one argument, \code{pars}. It sets theparameter values for the \code{nlsModel} object and returns alogical value denoting a singular gradient array.}\item{getPars}{returns the current value of the model parameters as anumeric vector}\item{getAllPars}{returns the current value of the model parameters as anumeric vector}\item{getEnv}{returns the environment shared by these functions,which contains copies of all the variables in \code{data} and hasas parent the environment of \code{form}.}\item{trace}{the function that is called at each iteration iftracing is enabled}\item{Rmat}{the upper triangular factor of the gradient array at thecurrent parameter values}\item{predict}{takes as argument \code{newdata},a \code{data.frame} andreturns the predicted response for \code{newdata}.}}\references{Bates, D.M. and Watts, D.G. (1988), \emph{Nonlinear Regression Analysisand Its Applications}, Wiley}\author{Douglas M. Bates and Saikat DebRoy}\seealso{\code{\link{nls}}}\examples{DNase1 <- DNase[ DNase$Run == 1, ]mod <-nlsModel(density ~ SSlogis( log(conc), Asym, xmid, scal ),DNase1, list( Asym = 3, xmid = 0, scal = 1 ))mod$getPars() # returns the parameters as a listmod$deviance() # returns the residual sum-of-squaresmod$resid() # returns the residual vector and the gradientmod$incr() # returns the suggested incrementmod$setPars( unlist(mod$getPars()) + mod$incr() ) # set new parameter valuesmod$getPars() # check the parameters have changedmod$deviance() # see if the parameter increment was successfulmod$trace() # check the tracingmod$Rmat() # R matrix from the QR decomposition of the gradient}\keyword{nonlinear}\keyword{models}