Various types of residual are available for the principal curve. In a
departure from the usual convention, which residuals are returned is
controlled via the which
argument. This is to allow users to
pass a type
argument to the residuals
method for the
function used to fit the individual smooth functions when which
= "smooths"
.
The types of residuals available are
"distance"
the default residual for a principal
curve. This residual is taken as the Euclidean distance between each
observations and the point on the principal curve to which it
projects, in full multivariate space.
"raw"
raw residuals are the basis for
"distance"
residuals, and are the difference between the
observed and fitted values (position on the curve) for each
observation in terms of each variable in the data set. These
residuals are in the form of a matrix with number of observation
rows and number of variables cols.
"smooths"
these residuals are the result of calling
residuals()
on each of the smooth models fitted to the
individual variables. See below for further details. A matrix of
the same dimensions as for which = "raw"
is returned.
"pca"
similar to the raw residuals, but expressed in
terms of the principal components of the input data. Hence these
residuals are the difference between each observation's location
in PCA space and their corresponding location on the curve.
For "smooths"
residuals, what is returned is governed by the
residuals
method available for the smooth model fitted to the
individual variables. For principal curves fitted using the
smoothSpline
plugin, see
smooth.spline
. For principal curves fitted via the
smoothGAM
plugin, see
residuals.gam
.
... can be used to pass additional arguments to these
residuals
methods. In particular, the type
argument is
commonly used to choose which type of residual is returned by the
specific methods.
In the case of principal curves fitted using the plugin
smoothSpline
, residuals for which = "smooths"
are
only available if the the additional argument keep.data
was
specified during fitting via prcurve
. See the examples
for an illustration of this usage.