renls2 - Series of Non-linear Regressions
On to:
DESCRIPTION
USAGE
REQUIRED-ARGUMENTS
OPTIONAL-ARGUMENTS
VALUE
NOTES
SEE-ALSO
EXAMPLE
DESCRIPTION:
Intended to
process series of non-linear regressions when only the starting values of the
parameters or the response are modified.
USAGE:
renls2(nls2.object,
response=NULL, theta.start=NULL,beta.start=NULL,
sv.fitted=T, sv.as.var=F, sv.B.varZ.B=F,
sv.correlation=F, sv.data=T, sv.est.eq=T,
sv.estim=T, sv.deriv.fct=T,
sv.mu=F, sv.residuals=F, sv.num.res=T, sv.odes=T, sv.W=F, sv.Z=F,
sv.steps=seq(1, nls2.object$nb.steps))
REQUIRED ARGUMENTS:
- nls2.object
-
an object of class `nls2' which has been previously
created in the current S-session.
In the call to `nls2', argument `renls2' must be have been set to TRUE.
- response
-
a vector that contains the values of the response.
Its length should be equal to the total number of observations,
including replications and null-weighted observations, if any.
By default, the last fitted values of the regression function
contained in "nls2.object"
(see `nls2.object', component `response').
- theta.start
-
a vector that contains the starting values of the regression parameters.
By default, the last estimated values of the regression parameters
contained in "nls2.object"
(see `nls2.object', component `theta').
OPTIONAL ARGUMENTS:
- beta.start
-
a vector that contains the starting values of the variance parameters.
By default, the last estimated values of the variance parameters
contained in "nls2.object"
(see `nls2.object', component `beta').
- the components with prefix ".sv"
-
components for selecting optional results
: see
nls2.control.
- sv.steps
-
in case of estimation by several steps,
integer or vector of integers which
specifies the steps for which results should be returned.
By default, all results of all steps are returned.
VALUE:
An `nls2.object'.
NOTES:
- The input argument nls2.object should contain at least
the estimated values of the parameters,
the vector of the number of replications,
and the fitted values of the response .
- After a series of calls,
invoke `delnls2' to delete the internal data-structures created by the
C-package that carries out the calculations.
If this is not done, the system might run out of memory
if `nls2' is called again in the same S-session.
SEE ALSO:
EXAMPLE:
The following function calls renls2() the number of times
indicated by its "NbLoop" argument.
Nb: a "for" loop is used here for demonstration purposes
but the S-command "apply" would have been more efficient.
execrenls2 _ function(NbLoop)
{
# Create the inputs:
# --------------------
x <- c(9, 14, 21, 28, 42, 57, 63, 70, 79)
y <- c(8.93, 10.80, 18.59, 22.33, 39.35, 56.11,
61.73, 64.62, 67.08)
data <-data.frame(x,y)
# Call nls2 to create the nls2.object:
# -----------------------------------
renls2.out<- nls2(data,"weibull",c(70,62,0.0001,2.5),
control=list(freq=0), renls2=TRUE)
# Loop of estimations by calling "renls2":
# ---------------------------------------
# The starting values of the parameters are the values
# estimated at the previous iteration.
# The response values are not changed.
for (i in seq(1:NbLoop))
{
renls2.out <- renls2(renls2.out, data$y)
if (renls2.out$code !=0) break
}
# Delete the internal structures that are no more useful:
# -------------------------------------------------------
delnls2()
return(renls2.out)
}
- Mon Sep 30 1996 -