getInitial
Get Initial Parameter Estimates for Nonlinear Least Squares Models.
Description
Used by nls to construct initial parameter
estimates for a nonlinear regression model.
Usage
# Generic function
getInitial(object, data, ...)
## Default S3 method:
getInitial(object, data, mCall, LHS = NULL, ...)
## S3 method for class 'formula':
getInitial(object, data,...)
## S3 method for class 'selfStart':
getInitial(object, data, mCall, LHS = NULL, ...)
Arguments
object |
a formula or a selfStart model that defines a nonlinear regression model
|
data |
an environment, or something that can be used as an environment such as
a list or data.frame, in which the expressions in the formula or
arguments to the selfStart model can be evaluated.
|
mCall |
a named list of name objects: the names of the list are the names of the
arguments of the objective function. The name objects are the names used
in the call to the objective funcion.
Often this is the result of as.list(match.call(ObjectiveFunc, RHS)),
where RHS is the call to ObjectiveFunc on the right hand side of the model formula.
See the description of the argument initial from the function selfStart.
|
LHS |
the expression from the left hand side of the model formula.
See the description of argument initial from the function selfStart.
|
... |
optional additional arguments.
|
Details
If object is a formula and if data has an
attribute called "parameters" then that attribute is returned.
Otherwise the formula is examined to see if its right hand side
is a call to a selfStart object whose initial attribute can be
evaluated with the given data.
If object is a selfStart function, then you must also
supply the call to it as mCall and the response as LHS.
The initial attribute of object is called with
those arguments.
Any other class of object causes an error.
This function is intended to be used by nls but can be used
to test functions created with selfStart.
Value
returns a named numeric vector, or a list of starting estimates for the
parameters, suitable for use as the start argument to nls.
The construction of some selfStart models is such
that these starting estimates are, in fact, the converged parameter
estimates. For others, they are estimates based on a heuristic analysis
of the objective function.
See Also
Examples
PurTrt <- Sdatasets::Puromycin[ Sdatasets::Puromycin$state == "treated", ]
getInitial(rate ~ SSmicmen( conc, Vmax, K ), data=PurTrt )
getInitial(SSmicmen, data=PurTrt,
mCall=list(input=quote(conc), Vm=quote(Vmax), K=quote(K)),
LHS=quote(rate)) # gives same result as previous call
nls(rate ~ SSmicmen( conc, Vmax, K ), data=PurTrt, trace=TRUE)