我最近对我的硕士论文进行了主成分分析,其中我有25个网络数据集,被格式化为图形,并对每个图形进行5次测量。测量值格式化为表格,其中行是数据集,列是结果,如下所示:
然后我按比例缩放结果以确保它们居中以均值为零(根据统计学习导论,G。James,2013年,具有以下功能:
dat <- data.frame(lapply(measures, function(x) scale(x, center = FALSE, scale = max(x, na.rm = TRUE)/100)))
此比例功能通过每个度量的标准偏差应用。然后,我在R princomp(dat, cor = T, scores = T)
中使用princomp函数应用了PCA,该函数返回了这些加载结果:
Loadings:
Comp.1 Comp.2 Comp.3 Comp.4 Comp.5
Transitivity 0.585 0.412 0.246 0.136 0.640
Reciprocity 0.540 -0.145 -0.336 -0.750 -0.111
centralization -0.600 0.280 -0.582 0.469
density 0.327 -0.893 0.261 0.146
assortativity 0.790 0.159 -0.111 -0.581
Comp.1 Comp.2 Comp.3 Comp.4 Comp.5
SS loadings 1.0 1.0 1.0 1.0 1.0
Proportion Var 0.2 0.2 0.2 0.2 0.2
Cumulative Var 0.2 0.4 0.6 0.8 1.0
我想问问是什么导致SS加载和比例变量具有完全相同的结果?我不确定这是否与我的数据不一致,我使用的缩放方法还是我应该担心的问题。我看到有人在此query中有类似的结果,但没有讨论,所以这也许是正常的吗?任何对此影响的解释将不胜感激。
Biplot:
Screeplot也没有多大意义,因为我预期会有指数下降,所以我认为这是加载结果的反映。方向图:
我想您要回答的第一个问题是SS负荷是多少。这些是荷载平方的总和-在几何上,它们是每个荷载矢量的长度的平方(矢量的长度是平方分量之和的平方根)。从技术角度来看,特征向量(或载荷)构成R5的基础,并且这些载荷中的每一个都已进行了归一化,因此元素的平方和(每个元素的长度)等于1。您可以将其视为我认为是最佳实践。
简而言之,我不会对此感到困扰。
我建议从以下第一项原则中取得成果。
#original data
df <- data.frame('transitivity'=c(34,8,8,37,15,29), 'reciprocity'=c(20, 34, 34, 25, 20, 7), 'centralization'=c(100, 99,99,100,99,99), 'density'=c(34, 7,7,2,3,0.7), 'assortativity'=c(-48, -53, -53, -33, 14, -45))
#scale according to the OP's procedure.
dat <- data.frame(lapply(df, function(x) scale(x, center = FALSE, scale = max(x, na.rm = TRUE)/100)))
#calculate correlation matrix.
cormat <- cor(dat)
#diagonalise
pca <- eigen(cormat)
#show that result is normalised.
apply(pca$vectors, 2, function(x) sum(x^2)) #Result will sum to 1 regardless of whether we use margin 1 or 2. Neat excercise to prove why.
#calculate % of var explained by each component. (divide by five since sum of eigenvalues will equal dimension of basis.)
pc_var <- pca$values/5*100
barplot(pc_var)
我将把结果的解释留给您!