This function is useful for generating the smooths enhancing
residual plots.
It generates a smooth for a single x
variable and multiple y's.
It is also used to draw smooths from simulated residuals.
NA's in either x
or any column of y
cause dropping the
observation (equivalent to na.omit
).
The smoothing function used to produce the smooth is
smoothRegr
, which relies loess
, by default.
This may be changed via ploptions(smooth.function = func)
where
func
is a smoothing function with the same arguments as
smoothRegr
.
The result of the smoothing function may carry an attribute
xtrim
. This regulates if the fitted values corresponding to
extreme x values will be suppressed when plotting:
The number of extreme x values corresponding to
ploptions("smooth.xtrim")
will be multiplied by
this attribute to obtain the number of extreme points suppressed at
each end. If the smoothing function is smoothLm
, which fits a
straight line, then trimming is suppressed since this function returns
0 as the xtrim
attribute.
If band
is TRUE
, a vector of "low" and a vector of
"high" smooth values will be calculated for the first column of
y
in the following way:
Residuals are calculated as the diference
between the observations and the respective smoothed values hat.$s_i$.
Then a smooth is calculated for the square roots of the positive residuals,
and the squared fitted values are added to the hat.$s_i$.
(The transformation by square roots makes the distribution of the residuals
more symmetric.)
This defines the ``high'' smooth values.
The construction of the ``low'' one is analogous.
The resulting values of the two are stored in the list component
yband
, and ybandindex
contains the information to which
group ("low" or "high") the value belongs.