开始使用免费开始使用

选择主成分(PC)的数量

PCA 的一大挑战是如何选择主成分的数量。常用方法是查看累积方差占比。我们将用这一方法,选择能解释 state.x77 数据中 95% 变异的主成分数量。每个主成分所解释的方差占比已为您预载为对象 pca.pvar

本练习是课程的一部分

R 中的多元概率分布

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Proportion of variance explained by each principal component


# Cumulative variance explained plot
plot(___, xlab = "Principal component", ylab = "Cumulative Proportion of variance explained", ylim = c(0,1), type = 'b')
grid()
编辑并运行代码