我看着里面的stats:::biplot.princomp和stats:::biplot.default。
箭头的长度计算如下。
(1)指定选项biplot。
# Data generating process
set.seed(12345)
library(MASS)
n
mu
Sigma
X
pca
biplot(pca, choices = 1:2, scale = F)
# Calculates arrow lengths
lam
len
# Plot arrows in green and see if overlap the red ones
mapply(function(x,y) arrows(0, 0, x, y, col = "green",
length = .1), x=len[,1], y=len[,2])
(2)中指定的biplot的scale = 0.5选项。
scale
biplot(pca, choices = 1:2, scale = scale)
lam
len
mapply(function(x,y) arrows(0, 0, x, y, col = "green", length = .1),
len[,1], len[,2])