| Title: | Principal Curves of Oriented Points |
|---|---|
| Description: | Principal curves generalize the notion of a first principal component to the case in which it is a nonlinear smooth curve. This package provides a function pcop(X) to compute principal curves with the algorithm defined in Delicado (2001) <doi:10.1006/jmva.2000.1917> from a data matrix X. |
| Authors: | Pedro Delicado [aut] (Original C++ author), Mario Huerta [aut] (Original C++ author), Kevin Michael Frick [trl, aut, cre] (Modern C++ fixes and Rcpp port, with permission from the original authors), Stephen L. Moshier [cph] (Author of eigens() for symmetric matrix eigendecomposition) |
| Maintainer: | Kevin Michael Frick <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.2.3 |
| Built: | 2026-06-24 18:38:34 UTC |
| Source: | https://github.com/cran/Rpcop |
Computes a principal curve as defined in Delicado and Huerta (2003) doi:10.1007/s001800300145.
pcop(x, Ch = 1.5, Cd = 0.3, plot.true = FALSE, ...)pcop(x, Ch = 1.5, Cd = 0.3, plot.true = FALSE, ...)
x |
A finite numeric matrix or data frame of |
Ch |
The smoothing parameter |
Cd |
The distance between two consecutive principal oriented points in a
PCOP is about |
plot.true |
If |
... |
Additional parameters passed to |
A list with two elements:
Data frame storing the principal curve of oriented points in
the original format, with columns param, dens,
span, orth.var, pop1, pop2, ...,
pr.dir1, pr.dir2, ...
List conforming to the format used in princurve; see that package for details.
List of algorithm parameters used for the fit.
Input row and column names, if present. Other input attributes are not used by the algorithm and are not propagated.
Matched function call.
n <- 500 p <- 3 x <- matrix(rnorm(n * p), ncol = p) %*% diag(p:1) pcop(x, plot.true = FALSE) x <- runif(100, -1, 1) x <- cbind(x, x ^ 2 + rnorm(100, sd = 0.1)) pcop(x, plot.true = FALSE) if (interactive()) { pcop(x, plot.true = TRUE, lwd = 4, col = 2) }n <- 500 p <- 3 x <- matrix(rnorm(n * p), ncol = p) %*% diag(p:1) pcop(x, plot.true = FALSE) x <- runif(100, -1, 1) x <- cbind(x, x ^ 2 + rnorm(100, sd = 0.1)) pcop(x, plot.true = FALSE) if (interactive()) { pcop(x, plot.true = TRUE, lwd = 4, col = 2) }
Print, summary, and plot methods for objects returned by pcop().
## S3 method for class 'pcop' print(x, ...) ## S3 method for class 'pcop' summary(object, ...) ## S3 method for class 'summary.pcop' print(x, ...) ## S3 method for class 'pcop' plot(x, ...)## S3 method for class 'pcop' print(x, ...) ## S3 method for class 'pcop' summary(object, ...) ## S3 method for class 'summary.pcop' print(x, ...) ## S3 method for class 'pcop' plot(x, ...)
x |
A |
object |
A |
... |
Additional arguments passed to methods. For |
print.pcop(), print.summary.pcop(), and plot.pcop() return
their input invisibly. summary.pcop() returns a compact summary object.
set.seed(1) x <- runif(100, -1, 1) x <- cbind(x, x ^ 2 + rnorm(100, sd = 0.1)) fit <- pcop(x, plot.true = FALSE) print(fit) summary(fit) if (interactive()) { plot(fit) }set.seed(1) x <- runif(100, -1, 1) x <- cbind(x, x ^ 2 + rnorm(100, sd = 0.1)) fit <- pcop(x, plot.true = FALSE) print(fit) summary(fit) if (interactive()) { plot(fit) }