troppca.poly | R Documentation |
Approximates the principal component as a tropical polytope for a given data matrix
via MCMC and return the results as an object of class troppca
.
troppca.poly(x, pcs = 2, nsample = 1000, ncores = 2)
x |
a data matrix, of size n x e, with each row an observation vector. e is the dimension of the tropical space#' |
pcs |
a numeric value indicating the order of principal component. (default: 2) |
nsample |
a numeric value indicating the number of samples of MCMC. (default: 1000) |
ncores |
a numeric value indicating the number of threads utilized for multi-cored CPUs. (default: 2) |
A list of S3 class "troppca"
, including:
pc |
The principal component as a tropical linear space |
obj |
The tropical PCA objective, the sum of tropical distance from each point to the projection. |
projection |
The projections of all data points. |
type |
The geometry of principal component. |
library(Rfast) n <- 50 e <- 50 s <- 5 x <- rbind( rmvnorm(n, mu = c(5, -5, rep(0, e - 2)), sigma = diag(s, e)), rmvnorm(n, mu = c(-5, 5, rep(0, e - 2)), sigma = diag(s, e)) ) troppca_fit <- troppca.poly(x) plot(troppca_fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.