Description Usage Arguments Details Value Note Author(s) References See Also Examples
prettyScree creates simple, crisp, publication-style scree plots and “tests” for SVD-based analyses.
1 2 3 | prettyScree(eigs, retain.col = "mediumorchid4", dismiss.col = "gray",
perc.exp = 1, n.comps = NULL, broken.stick = TRUE, kaiser = TRUE,
main = "")
|
eigs |
a vector of positive eigenvalues. |
retain.col |
a color for components that are kept. |
dismiss.col |
a color for components that are dismissed. |
perc.exp |
a value between 0 and 1. Used to retain components that explain |
n.comps |
a value between 1 and |
broken.stick |
a boolean. If TRUE (default), the broken-stick test is performed (see details). |
kaiser |
a boolean. If TRUE (default), all components with eigenvalues greater than the |
main |
A title to be placed at the top of the graph. |
prettyScree visualizes the distribution of eigenvalues/explained variance from SVD-based analyses. Further, prettyScree performs several rudimentary “tests”. Two rudimentary criteria are implemented: 1) user selected explained variance, and 2) user selected number of components. Additionally, two rudimentary “tests” are implemented: 1) the “broken-stick” distribution of variance model, and 2) the “Kaiser criterion” where all components that explain more variance than the mean are kept.
prettyScree colors components that “pass” all selected tests with retain.col
. Any components that do not pass tests are colored by a more transparent version of retain.col
. Components that do not meet any criteria for retention are colored by dismiss.col
.
prettyScree should be considered “under development” as of 12.09.2013. The function works, but we will be adding more features in the near future.
comps.tests |
a matrix with boolean values. Rows indicate which criteria are used, and columns correspond to components. If TRUE, a component is considered “retained” by that test/criteria. If FALSE, the component is “dismissed” according to that test/criteria. |
A private function (add.alpha
) was copied from http://lamages.blogspot.com/2013/04/how-to-change-alpha-value-of-colours-in.html
Derek Beaton
Cangelosi, R., & Goriely, A. (2007). Component retention in principal component analysis with application to cDNA microarray data. Biology direct, 2(2), 1–21.
Peres-Neto, P. R., Jackson, D. A., & Somers, K. M. (2005). How many principal components? Stopping rules for determining the number of non-trivial axes revisited. Computational Statistics & Data Analysis, 49(4), 974–997.
Also see (some of) the other packages that perform a wide array of SVD-based analyses: ExPosition
, FactoMineR
, ca
, ade4
1 2 3 4 5 | prcomp.res <- prcomp(USArrests, scale = TRUE)
prettyScree(prcomp.res$sdev^2)
##or
princomp.res <- princomp(USArrests, cor = TRUE)
prettyScree(princomp.res$sdev^2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.