bootstrap.nls2 - Non-linear Regressions by Bootstraping Methods


On to:
DESCRIPTION
USAGE
REQUIRED-ARGUMENTS
OPTIONAL-ARGUMENTS
VALUE
SIDE-EFFECTS
DETAILS
CONSTRAINTS
NOTE
SEE-ALSO
REFERENCES
EXAMPLE-1
EXAMPLE-2
EXAMPLE-3



DESCRIPTION:

Carry on series of estimations based on pseudo-observations generated from an `nls2.object', and, if a function of parameters is provided, calculate the characteristics of the bootstrap distribution and a confidence interval for it.

Can be used also to calculate boostrap calibration confidence interval.


USAGE:
bootstrap.nls2(nls2.object, 
 method="param", 
 wanted=list(pStar=T,var.pStar=T, sigma2Star=T,
        psiStar=T, var.psiStar=T,
        tStar=T,conf.int=T,
        YStar=F,SStar=F), 
 n.loops=119, 
 conf.level=0.95,
 file=NULL, 
 pbispsi=c(nls2.object$model$gamf,nls2.object$model$gamv), 
 varpsi=NULL,
 ord=NULL)

REQUIRED ARGUMENTS:
nls2.object
object of class `nls2'.
Except if the argument `method' is "calib", this object must have been previously created in the current S-session. In the call to `nls2', argument `renls2' must be have been set to TRUE.

Sommaire

OPTIONAL ARGUMENTS:

method
method for the pseudo-observations generation. Character string, which valid values are:
"param", "residuals", "s.residuals", "wild.1", "wild.2" and "calib". See the paragraph `DETAILS'.
wanted
list that specifies the optional outputs required. Its components are logics that should be FALSE if the corresponding results are not requested. See the paragraph `VALUE'.
When the argument `file' is provided, the default value of "pStar" ,"var.pStar" and "sigma2Star" is FALSE.
When the argument `method' is "calib", the default value of all the components is FALSE.
n.loops
number of bootstrap estimations required.
conf.level
when a function of parameters is provided, level of the confidence interval if required.
file
when a function of parameters is provided, pathname of the file that contains its formal description.
pbispsi
when a function of parameters is provided, values of the second level parameters introduced by the `pbispsi' declaration in the formal description-file, if any.
varpsi
when a function of parameters is provided, values of the variables introduced by the `varpsi' declaration in the formal description-file, if any.
ord
When the argument `method' is "calib", observed values of the response that correspond to the unknown value of the independent variable. There may be replications, so ord is a vector of length m>=1.

Sommaire

VALUE:

A list with the following components:

message,code:
descriptions of how the estimation process terminated and associated codes, for each set of pseudo-observations. When several steps, they correspond to the first step when an error occured. They are scalars, equal to 0 and "OK", respectively, when no problem.
n.loops:
number of loops where convergence has correctly been reached.
conf.bounds:
only when the argument `method' is "calib" (see the paragraph `DETAILS').
According to the argument `wanted', the output includes:
pStar:
values of the active parameters, for each set of pseudo-observations.
var.pStar:
variances of the active parameters, for each set of pseudo-observations.
sigma2Star:
value of sigma2, for each set of pseudo-observations.
psiStar:
value of the function, at each value of pStar.
var.psiStar:
variance of the function, at each value of pStar.
tStar:
value of the tStar quantities, for each value of psiStar (see the paragraph `DETAILS').
conf.int:
lower and upper bounds of the bootstrap confidence interval for the function (see the paragraph `DETAILS').
YStar,SStar:
only when the argument `method' is "calib" (see the paragraph `DETAILS').

Sommaire


SIDE EFFECTS:

- The printed output are ruled by the argument control used in the first call to nls2. Use the value control=list(freq=0) when creating the nls2.object to suppress the default printed output of bootstrap.
- When the argument `method' is "param" or "wild.1", the side-effects of "rnorm()", and, when it is "wild.2", the side-effects of "rbinom()".
- If a function is provided and no program loaded to calculate it (see `loadnls2'), an operating-system file is created which contains the C-program that corresponds to its formal description. If this file already exists, it is replaced.


Sommaire

DETAILS:

- THE ARGUMENT method:
Pseudo-observations, YStar, are generated according to the argument `method':
Let response, variance, residuals and s.residuals be the last fitted values of the response, variance, residuals and standardized residuals in the `nls2.object'.
- if method="param", pseudo-errors, pse, are randomly generated as a sample of the centered normal distribution with standard deviation equal to 1.
Then, YStar=response + sqrt(variance)*pse
- if method="residuals", the pseudo-errors are randomly generated among "residuals - mean(residuals)".
Then, YStar=response + pse
- if method="s.residuals", the pseudo-errors are randomly generated among "s.residuals -mean(s.residuals)".
Then, YStar=response + sqrt(variance)*pse
- if method="wild.1", two samples Z1 and Z2 of the centered normal distribution with standard deviation equal to 1 are generated. The pseudo-errors are:
pse=residuals * (Z1/sqrt(2) + (Z2**2-1)/2))
Then, YStar=response + pse
- if method="wild.2", a sample Z of a binomial distribution with probability (5+sqrt(5))/10 of success is generated. The pseudo-errors are:
pse[Z==1] = residuals[Z==1] * (1-sqrt(5))/2
pse[Z==0] = residuals[Z==0] * (1+sqrt(5))/2
- if method="calib", see below.

Methods of user's choice can be added by modifying the function "generbootnls2": see comments included in the source of the function bootstrap.nls2.

Sommaire

- THE QUANTITY tStar AND THE CONFIDENCE INTERVAL conf.int:
Let pact be the last estimated values of the parameters in the `nls2.object', psi the value of the function of parameters at pact, and var.psi its variance.

The quantity tStar:
For each value of "psiStar", the variance var.psiStar is calculated and then:
tStar= (psiStar-psi)/sqrt(var.psiStar)

The confidence interval:
Let b1, b2, the smallest integers such as b1/n.loops is greater or equal to "(1-conf.level)/2" and b2/n.loops is greater or equal to "(1+conf.level)/2". Let tStar0 be the ascending ordered values of "tStar". Then, the bounds of the confidence interval are:
psi-sqrt(var.psi)*tStar0[b1], and
psi-sqrt(var.psi)*tStar0[b2]

Note that the loops where the convergence has not been correctly reached are not taken into account.

- THE METHOD calib AND THE QUANTITIES YStar, SStar, conf.bounds:
A function must be provided and it is assumed that it describes the regression model. An additional "pbispsi" must be declared which represents the independent variable to be calibrated.

Sommaire

At each loop, (n+m) pseudo-observations YStar are generated: the n first ones are generated with method="residuals" and the m last ones are equal to:
ZStar=mean(ord)+pse,
pse being randomly generated among
"residuals - mean(residuals)".
The value of the independent variable for these m observations is the value of the additional "pbispsi".
(In general, this value is the estimator of the independent variable returned by the function `calib.nls2': see the paragraph `EXAMPLE-3')

Estimation is carried on with these (n+m) observations and the residuals, called here residualsStar, are calculated. Then, the quantities SStar are calculated so:
S=sum(residualsStar^2)
A= sqrt(S) * sqrt(1/m + var.psiStar/sigma2Star)
SStar=(sqrt(n+m) * (mean(ZStar)- f(pbispsi, pStar)))/A

At the end of the iterative process, the values of SStar are sorted. SStar[b1] and SStar[b2] are returned in the component `conf.bounds', b1 and b2 been calculated as above.

Note that the loops where the convergence has not been correctly reached are not taken into account.
For statistical explanations about the method "calib", see the paragraph `REFERENCES'.


Sommaire

CONSTRAINTS:

- Do not invoke functions `loadnls2' nor `delnls2' between the "nls2.object" creation and a call to "bootstrap".
- When functions of parameters are provided, only one function and at most one value of the variables "varpsi" are allowed and the function `loadnls2', argument `psi' not NULL, should have been previously called.
- When the argument `method' is "calib", the data frame containing the observations, (its name is nls2.object$call$data), must be available. It is then assumed that this data frame has been neither deleted nor modified since the nls2.object was created.
It must not include curves and have a single independent variable.
- When the argument `method' is "calib", the model is assumed to be described in the file whose name appears in `nls2.object', component `model'. The variance must be constant.


Sommaire

NOTE:

This function is a method for the generic function `bootstrap' for class `nls2'. It can be invoked by calling `bootstrap' for an object of the appropriate class, or directly by calling `bootstrap.nls2' regardless of the class of the object.


SEE ALSO:

REFERENCES:

"Calibration with a nonlinear standard curve: how to do it.?", Gruet, M.A and Jolivet, E., Computational Statistics, Härdle, Berlin ,Germany, 1994.


Sommaire

EXAMPLE-1:

No function of parameters is provided: only the values of "pStar" and "var.pStar" are calculated.
# Creation of the nls2.object with option renls2=T:
r_nls2(data,model,stat.ctx,control=list(freq=0),renls2=T)
# remark: "freq=0" prevents the intermediary results from
# being printed at each estimation.
z_ bootstrap(r)




EXAMPLE-2:

A function of parameters is provided. It is described in a file called "Func.d".
r_nls2(data,model,stat.ctx,control=list(freq=0),renls2=T)
z_bootstrap(r, file="Func.d", method="residuals", n.loops=30)

Sommaire




EXAMPLE-3:

Use of method "calib": A function is provided that describes the regression function, the independent variable been considered as an additional "pbispsi". It is described in the following file "Calib.d":
model cortisol with variance constant
The original model description file has been modified:
"resp" has been replaced by "psi",
"parresp" by "ppsi",
"pbisresp" by "pbispsi",
"varind"-list placed at the end of "pbispsi" and then removed. psi f; ppsi n,d,a,b,g; pbispsi minf,pinf, x; aux a1, a2; subroutine; begin a1= 1+exp(a+b*x); a2= if x==minf then d else
if x==pinf then n else
n+(d-n)*exp(-g*log(a1))
fi fi; f=a2; end

Function "bootstrap" is invoked:
out_bootstrap(nls2.out.cst,
method="calib",
ord=c(1500,1600),
file="Calib.d",
pbispsi=c(-5,5, calib.out$x))





Sommaire


- Mon Sep 30 1996 -