scores.prcurve {analogue} | R Documentation |
scores
method for principal curve objects of
class "prcurve"
.A scores
method to extract the position on the
curve to which each observation projects (display = "curve"
) or
the coordinates of the curve in the dimensions of the input data
(display = "dimensions"
).
## S3 method for class 'prcurve' scores(x, display = c("curve", "dimensions"), ...)
x |
an object of class |
display |
character; which type of scores to
extract. |
... |
Arguments passed to other methods. Not used. |
If display = "curve"
a 1-column matrix is returned with a row
for each observation in the input data. If display =
"dimensions"
, a matrix of coordinates for the principal curve is
returned. The dimensions of this matrix relate to the dimensions of
the input data; if there were n samples (rows) and m
variables columns then the matrix returned by scores.prcurve
will have n rows and m columns.
Gavin L. Simpson
prcurve
for fitting principal curves to data.
## Load the Abernethy Forest data set data(abernethy) ## Remove the Depth and Age variables abernethy2 <- abernethy[, -(37:38)] ## Fit the principal curve using varying complexity of smoothers ## for each species aber.pc <- prcurve(abernethy2, method = "ca", trace = TRUE, vary = TRUE, penalty = 1.4) ## Extract position on the curve pos <- scores(aber.pc, display = "curve") head(pos) ## Extract the coordinates of the curve coord <- scores(aber.pc, display = "dimensions") dim(coord) all.equal(dim(coord), dim(abernethy2))