| Type: | Package |
| Title: | Principal Curves of Oriented Points |
| Version: | 1.2.3 |
| Date: | 2026-06-10 |
| Maintainer: | Kevin Michael Frick <kmfrick@proton.me> |
| 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. |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| Depends: | R (≥ 3.5.0) |
| Imports: | Rcpp (≥ 1.0.7), princurve |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
| LinkingTo: | Rcpp |
| VignetteBuilder: | knitr |
| Encoding: | UTF-8 |
| URL: | https://github.com/kmfrick/Rpcop |
| BugReports: | https://github.com/kmfrick/Rpcop/issues |
| Config/testthat/edition: | 3 |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | yes |
| Packaged: | 2026-06-16 18:25:06 UTC; kmfrick |
| Author: | 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) |
| Repository: | CRAN |
| Date/Publication: | 2026-06-24 15:10:14 UTC |
Principal Curves of Oriented Points
Description
Core package documentation generated by roxygen2.
Author(s)
Maintainer: Kevin Michael Frick kmfrick@proton.me (Modern C++ fixes and Rcpp port, with permission from the original authors) [translator]
Authors:
Pedro Delicado pedro.delicado@upc.edu (Original C++ author)
Mario Huerta mario.huerta@uab.es (Original C++ author)
Other contributors:
Stephen L. Moshier steve@moshier.net (Author of eigens() for symmetric matrix eigendecomposition) [copyright holder]
Principal Curve of Oriented Points
Description
Computes a principal curve as defined in Delicado and Huerta (2003) doi:10.1007/s001800300145.
Usage
pcop(x, Ch = 1.5, Cd = 0.3, plot.true = FALSE, ...)
Arguments
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 |
Value
A list with two elements:
- pcop.f1
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, ...- pcop.f2
List conforming to the format used in princurve; see that package for details.
- parameters
List of algorithm parameters used for the fit.
- input_names
Input row and column names, if present. Other input attributes are not used by the algorithm and are not propagated.
- call
Matched function call.
Examples
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)
}
Methods for pcop objects
Description
Print, summary, and plot methods for objects returned by pcop().
Usage
## 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, ...)
Arguments
x |
A |
object |
A |
... |
Additional arguments passed to methods. For |
Value
print.pcop(), print.summary.pcop(), and plot.pcop() return
their input invisibly. summary.pcop() returns a compact summary object.
Examples
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)
}
pcop_backend
Description
Internal backend used by pcop() to compute the principal curve defined in Delicado and Huerta (2003) doi:10.1007/s001800300145.
Usage
pcop_backend(x, c_d, c_h)
Arguments
x |
Numeric matrix of input points; see |
c_d |
Distance scaling parameter passed from |
c_h |
Bandwidth scaling parameter passed from |
Value
Numeric matrix consumed by pcop().