scores.prcurve {analogue} | R Documentation |
scores
method for principal curve objects of
class "prcurve"
.
Description
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"
).
Usage
## S3 method for class 'prcurve'
scores(x, display = c("curve", "dimensions"), ...)
Arguments
x |
an object of class |
display |
character; which type of scores to
extract. |
... |
Arguments passed to other methods. Not used. |
Value
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 samples (rows) and
variables columns then the matrix returned by
scores.prcurve
will have rows and
columns.
Author(s)
Gavin L. Simpson
See Also
prcurve
for fitting principal curves to data.
Examples
## 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))