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").
an object of class
character; which type of scores to
Arguments passed to other methods. Not used.
display = "curve" a 1-column matrix is returned with a row
for each observation in the input data. If
"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
will have n rows and m columns.
Gavin L. Simpson
prcurve for fitting principal curves to data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
## 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.