
## S3 method for class 'prcurve':
residuals(object, which = c("distance", "raw", "smooths", "pca"),
...)
"prcurve"
, the result of a
call to prcurve
.which = "distance"
) or a matrix
of residuals (for the other options).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
[object Object],[object Object],[object Object],[object Object]
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.
prcurve
for fitting a principal curve.## Load Abernethy Forest data set
data(abernethy)
## Remove the Depth and Age variables
abernethy2 <- abernethy[, -(37:38)]
## Fit the principal curve, preserving the data in the smooth.spline
## smooth functions fitted via keep.data = TRUE
aber.pc <- prcurve(abernethy2, method = "ca", keep.data = TRUE)
## default "distance" residuals
resid(aber.pc)
## residuals from the underlying smooth models, also illustrates
## how to select specific types of residual from the individual
## method using argument 'type'
resid(aber.pc, which = "smooths", type = "deviance")
Run the code above in your browser using DataLab