| screeplot.princomp.BData | R Documentation |
Creates a screeplot showing the variance (or eigenvalue) associated with each principal component. This is a standard tool for deciding how many principal components to retain based on the "elbow" criterion.
## S3 method for class 'princomp.BData'
screeplot(
x,
npcs = min(10, length(x$sdev)),
type = c("barplot", "lines"),
main = "Screeplot",
...
)
x |
A 'princomp.BData' object. |
npcs |
Number of principal components to include in the plot. Default is 'min(10, length(x$sdev))'. |
type |
Character string specifying the plot type:
|
main |
Plot title. Default is '"Screeplot"'. |
... |
Additional graphical parameters. |
The screeplot displays the eigenvalues (variances) of the principal components in decreasing order. The name comes from the plot's resemblance to a scree slope at the base of a mountain.
## How to Use
Look for an "elbow" in the plot where the variance drops off sharply. Components before the elbow are typically considered important and retained, while those after the elbow contribute little to the overall structure.
Alternative criteria for choosing components include:
Retain components explaining a target percentage of variance (see 'plot(x, type="variance")').
Kaiser criterion: retain components with variance > 1 (when using correlation matrix, 'cor=TRUE').
Invisibly returns the variance values for each component.
Matthias Templ
princomp.BData for the PCA analysis.
plot.princomp.BData for additional plot types including
cumulative variance plots.
Other PCA:
biplot.princomp.BData(),
plot.princomp.BData(),
plot.princomp.BData.grouped(),
plot.princomp.BData.multivariate(),
predict.princomp.BData(),
princomp.BData(),
summary.princomp.BData()
meanDist <- BDataPDFs(list(dunif), basis = B2Unif01Basis7)
gaussProc <- B2GaussianDistribution(meanDist, function(x,y) exp(-4*abs(x-y)^1.7))
pcaResult <- princomp(as.BDataSplines(simulate(gaussProc, 25, seed = 42)))
# Standard barplot screeplot
screeplot(pcaResult)
# Line plot version
screeplot(pcaResult, type = "lines")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.