我正在为数据集进行PCA分析。我在变量上获得了92倍的PCA。我想用前两个PCA组合来绘制它。 PCA1和PCA2。
有人可以帮我吗?
双标图只显示两个?或者我对解释感到困惑。如果是这样,它只适用于2个组件,那么我如何绘制PCA3和PCA4。
请在下面找到我的代码。
prin_comp <- prcomp(data_wide.pwy_idx, scale. = T)
names(prin_comp)
prin_comp$center
prin_comp$scale
prin_comp$rotation[1:5,1:92]
biplot(prin_comp, scale = 0)
答案 0 :(得分:2)
是的,您只看到前两个主要组件在x标签和y标签上注意到它们。假设您想要绘制任何其他主要组件对,您必须使用选项参数。
biplot(prin_comp, choices = 3:4,scale = 0)
# to plot the third and fourth components
答案 1 :(得分:1)
查看?biplot.princomp
...
使用biplot(prin_comp, scale = 0, choices=c(3,4))
绘制第3和第4个组件。