用R (USArrests)提供的一个例子,我想问一下,有没有人能告诉我自动绘图中的缩放导致了什么?我熟悉Borcard等人所描述的距离和相关性双线图。(2011)。autoplot函数使biplot变得更好,但我找不到如何使用该函数简单地区分距离和相关类型的biplot。
# Distance biplot (scaling = 1)
biplot(prcomp(USArrests, scale = TRUE), scale=0)

# correlation biplot (scaling =2)
biplot(prcomp(USArrests, scale = TRUE), pc.biplot=TRUE)

# using autoplot there are several options:
library(ggfortify)
ggplot2::autoplot(stats::prcomp(USArrests, scale=TRUE), pc.biplot=TRUE, label = TRUE, loadings.label = TRUE)

# I assume this is equal to the correlation biplot
ggplot2::autoplot(stats::prcomp(USArrests, scale=TRUE), scale=0, label = TRUE, loadings.label = TRUE)

ggplot2::autoplot(stats::prcomp(USArrests, scale=TRUE), scale=1, label = TRUE, loadings.label = TRUE)

ggplot2::autoplot(stats::prcomp(USArrests, scale=TRUE), scale=2, label = TRUE, loadings.label = TRUE)

我可以使用autoplot简单地绘制一个距离(缩放= 1)吗?
发布于 2018-05-17 01:51:40
是,
ggplot2::autoplot(stats::prcomp(USArrests, scale = TRUE), scale = 0, label = TRUE, loadings.label = TRUE)和
biplot(prcomp(USArrests, scale = TRUE), scale = s)给出0 <= s <= 1的类似结果。请参阅stats:::biplot.prcomp和ggfortify:::autoplot.prcomp以说服自己。特别是,这两个函数都有(下面来自stats:::biplot.prcomp)
lam <- x$sdev[choices]
n <- NROW(scores)
lam <- lam * sqrt(n)
lam <- lam^scale
biplot.default(t(t(scores[, choices])/lam), t(t(x$rotation[,
choices]) * lam), ...)这就解释了scale的作用。另请参阅?ggbiplot和?autoplot.prcomp。
https://stackoverflow.com/questions/50375904
复制相似问题