prettyScree creates simple, crisp, publication-style scree plots and ``tests'' for SVD-based analyses.
prettyScree(
eigs,
retain.col = "mediumorchid4",
dismiss.col = "gray",
perc.exp = 1,
n.comps = NULL,
broken.stick = TRUE,
kaiser = TRUE,
main = ""
)
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 vector of positive eigenvalues.
a color for components that are kept.
a color for components that are dismissed.
a value between 0 and 1. Used to retain components that
explain perc.comp
* 100 variance. Note: perc.exp retains
cumsum(explained variance) < (perc.exp * 100)
+ 1 component.
a value between 1 and length(eigs)
. Used to retain
n.comps
number of components.
a boolean. If TRUE (default), the broken-stick test is performed (see details).
a boolean. If TRUE (default), all components with eigenvalues
greater than the mean(eigs)
are retained.
A title to be placed at the top of the graph.
Derek Beaton
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.
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
prcomp.res <- prcomp(USArrests, scale = TRUE)
prettyScree(prcomp.res$sdev^2)
##or
princomp.res <- princomp(USArrests, cor = TRUE)
prettyScree(princomp.res$sdev^2)
Run the code above in your browser using DataLab