| biplot.princomp.BData | R Documentation |
Creates a biplot that simultaneously displays the principal component scores (observations) and loadings (variables/coefficients) in the same plot. This visualization helps understand relationships between observations and the underlying coefficient structure.
## S3 method for class 'princomp.BData'
biplot(
x,
choices = 1:2,
scale = 0,
pc.biplot = FALSE,
main = NULL,
col = c("black", "red"),
cex = c(0.8, 0.8),
xlabs = NULL,
ylabs = NULL,
expand = 1,
arrow.len = 0.1,
...
)
x |
An object of class 'princomp.BData' as returned by
|
choices |
Integer vector of length 2 specifying which principal components to display. Default is 'c(1, 2)' for the first two components. |
scale |
Numeric scaling factor controlling the relative scaling of scores and loadings:
|
pc.biplot |
Logical. If ‘TRUE', use Gabriel’s (1971) biplot scaling, which sets 'scale=1'. Default is 'FALSE'. |
main |
Character string for plot title. Default is '"Biplot"'. |
col |
Vector of two colors: first for observation labels, second for loading arrows. Default is 'c("black", "red")'. |
cex |
Vector of two character expansion factors: first for observation labels, second for loading labels. Default is 'c(0.8, 0.8)'. |
xlabs |
Character vector of labels for observations. Default uses observation numbers (1, 2, 3, ...). |
ylabs |
Character vector of labels for loading arrows (coefficients). Default uses '"C1"', '"C2"', etc. |
expand |
Numeric expansion factor for loading arrows. Increase this if the arrows are too short to see clearly. Default is 1. |
arrow.len |
Length of arrow heads. Default is 0.1. |
... |
Additional graphical parameters passed to the underlying plot. |
## Biplot Interpretation
In a biplot:
Observations (numbers/text) represent individual distributions. Observations close together have similar distribution shapes.
Loading arrows (red arrows labeled C1, C2, etc.) represent spline basis coefficients. The direction and length indicate how each coefficient contributes to the principal components.
Projecting an observation onto a loading arrow approximates that observation's value on that coefficient (relative to the mean).
Arrow angles: Arrows pointing in similar directions indicate positively correlated coefficients; opposite directions indicate negative correlation; perpendicular arrows indicate uncorrelated coefficients.
## Note on Coefficient Interpretation
Unlike PCA on raw data where variables have direct meaning, the "variables"
here are spline basis coefficients. These are abstract and their individual
interpretation may not be intuitive. For understanding how distributions
vary, the plot.princomp.BData function with 'type="eigenfunctions"'
provides a more interpretable visualization showing how distribution shapes
change along each PC direction.
## Why Biplot Works for ZB-Splines
The biplot is meaningful for the default ZB-spline basis because ZB-splines have **local support**: each basis function is non-zero only in a specific region of the domain. This means coefficient i primarily reflects the behavior of the distribution near knot region i. When a loading arrow for coefficient Ci points strongly in a PC direction, it indicates that variation in that region of the domain is associated with that principal component.
**Important:** If orthonormal splines were used instead, the biplot would lose this interpretability because orthonormal basis functions have global support (they are non-zero across the entire domain), so each coefficient would mix information from everywhere rather than representing a local region.
Invisibly returns a list containing the scaled 'scores' and 'loadings' matrices as plotted.
Matthias Templ
Gabriel, K. R. (1971). The biplot graphic display of matrices with application to principal component analysis. Biometrika, 58(3), 453-467.
princomp.BData for performing the PCA.
plot.princomp.BData for other visualization options, especially
'type="loadings"' for functional interpretation.
biplot for the generic biplot function.
Other PCA:
plot.princomp.BData(),
plot.princomp.BData.grouped(),
plot.princomp.BData.multivariate(),
predict.princomp.BData(),
princomp.BData(),
screeplot.princomp.BData(),
summary.princomp.BData()
## Create example PCA result
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)))
## Basic biplot
biplot(pcaResult)
## Biplot of PC2 vs PC3
biplot(pcaResult, choices = c(2, 3))
## Correlation biplot (scale=1)
biplot(pcaResult, scale = 1)
## Customized biplot
biplot(pcaResult,
col = c("blue", "darkgreen"),
cex = c(1, 0.7),
expand = 1.5,
main = "PCA Biplot of Distributional Data")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.