pca_jg | R Documentation |
pca_jg
performs a crude PCA given a matrix and the rank of the matrix.
pca_jg(mat, rank = 1, true_pattern = NULL, cov_method = "complete.obs")
mat |
The matrix to perform PCA upon. |
rank |
The rank of the given matrix. |
true_pattern |
The pattern the matrix was simulated from (optional). |
cov_method |
The method with which to calculate the covariance matrix. Only relevant when |
List containing: "fitted_mat", "scores", "pattern"
.
"fitted_mat"
The recovered matrix (after regressing rows on patterns to estimate scores).
"scores"
The estimated scores (estimated by regressing rows on patterns).
"pattern"
The estimated pattern (if none was provided).
If true_pattern
is left NULL
then the pattern is estimated via an
eigen decomposition on the covariance matrix of mat
.
The scores are estimated by regressing rows on the pattern provided/estimated.
The fitted values are then estimated by multiplying the estimated scores by the provided/estimated patterns.
# simulate a matrix: pattern <- t(cbind(c(1,1,1,0,0), c(0,0,0,1,1))) scores <- matrix(rnorm(10), 5, 2) mat <- scores %*% pattern # run PCA: pca_jg(mat, rank = 2, true_pattern = pattern)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.