Description Usage Arguments Value Examples
Implements a weighted PCA
1 2 3 |
mat |
matrix of variables (columns) and observations (rows) |
matw |
corresponding weights |
npcs |
number of principal components to extract |
nstarts |
number of random starts to use |
smooth |
smoothing span |
em.tol |
desired EM algorithm tolerance |
em.maxiter |
maximum number of EM iterations |
seed |
random seed |
center |
whether mat should be centered (weighted centering) |
n.shuffles |
optional number of per-observation randomizations that should be performed in addition to the main calculations to determine the lambda1 (PC1 eigenvalue) magnitude under such randomizations (returned in $randvar) |
a list containing eigenvector matrix ($rotation), projections ($scores), variance (weighted) explained by each component ($var), total (weighted) variance of the dataset ($totalvar)
1 2 3 4 5 6 | set.seed(0)
mat <- matrix( c(rnorm(5*10,mean=0,sd=1), rnorm(5*10,mean=5,sd=1)), 10, 10) # random matrix
base.pca <- bwpca(mat) # non-weighted pca, equal weights set automatically
matw <- matrix( c(rnorm(5*10,mean=0,sd=1), rnorm(5*10,mean=5,sd=1)), 10, 10) # random weight matrix
matw <- abs(matw)/max(matw)
base.pca.weighted <- bwpca(mat, matw) # weighted pca
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.