【问题标题】:Principal component analysis (PCA) in R: why are the scores not orthogonal? (using Psych package)R中的主成分分析(PCA):为什么分数不正交? (使用心理包)
【发布时间】:2013-10-29 05:32:55
【问题描述】:

我使用“psych”包中的 principal() 函数在 R 中运行 PCA。我提出了参数“rotate="none"”,它要求使用正交旋转方法。据我了解,PC1 和 PC2 的分数应该是正交的(即(原始数据)(PC1 的加载)和(原始数据)(PC2 的加载)之间的相关性应该为零。但是,我得到了 90% 的相关性。这是为什么呢?

> #load the package
> library(psych)

> #calculate the correlation matrix
> corMat  <- cor(data)

> #run PCA
> pca.results <- principal(r = corMat,**rotate ="none"**, nfactors = 20,covar=FALSE,scores=TRUE)
> pca.results`enter code here`
Principal Components Analysis
Call: principal(r = corMat, nfactors = 20, rotate = "none", covar = FALSE,
    scores = TRUE)
Standardized loadings (pattern matrix) based upon correlation matrix
                                **PC1   PC2**   PC3   PC4   PC5   PC6   PC7   PC8   PC9
payroll.chg                   -0.30  0.85  0.21  0.35 -0.03  0.02  0.07 -0.11 -0.02
HH.empl.chg                   -0.26  0.62  0.64 -0.35  0.01 -0.06  0.06  0.00  0.01
pop.empl.ratio                -0.92 -0.34  0.13  0.04  0.06 -0.03 -0.04  0.03 -0.04
u.rate                         0.99  0.10  0.02  0.04  0.01  0.04  0.04  0.04  0.01
median.duration.unempl         0.88  0.44 -0.02  0.02 -0.04  0.06  0.02  0.13 -0.05
LT.unempl.unempl.ratio         0.86  0.49 -0.04  0.01 -0.07  0.02  0.00  0.08 -0.02
U4                             0.99  0.13  0.01  0.03  0.01  0.04  0.04  0.05  0.01
U6                             0.98  0.13 -0.05 -0.02  0.00  0.06  0.04  0.03  0.04
vacancy.rate                  -0.87  0.35 -0.18 -0.11 -0.01  0.22  0.10  0.03 -0.01
hires.rate                    -0.92  0.08  0.24  0.21 -0.16  0.06  0.00  0.05  0.09
unemployed.to.employed         0.89  0.17  0.21 -0.02  0.05  0.24 -0.25 -0.05  0.00
Layoff.rate..JOLT.             0.23 -0.86  0.19 -0.03 -0.40  0.09  0.03 -0.02 -0.05
Exhaustion.rate                0.95  0.19  0.14  0.14  0.00 -0.07  0.01  0.06 -0.04
Quits.rate..JOLT.             -0.98  0.01  0.04  0.04  0.01  0.02 -0.06  0.10  0.13
participation.rate            -0.67 -0.61  0.31  0.14  0.16 -0.01 -0.03  0.11 -0.08
insured.u.rate                 0.88 -0.40  0.17  0.08  0.12  0.05  0.09 -0.03  0.02
Initial.jobless.claims         0.78 -0.60  0.04 -0.06  0.06  0.05  0.07  0.02  0.07
Continuing.claims              0.86 -0.44  0.15  0.06  0.14  0.08  0.09 -0.05  0.03
Jobs.plentiful.jobs.hardtoget -0.98  0.00 -0.02  0.01  0.08  0.13  0.04 -0.02 -0.04
vacancy.unempl.ratio          -0.97  0.04 -0.05 -0.03  0.08  0.18  0.07  0.03 -0.03

                               PC10  PC11  PC12  PC13  PC14  PC15  PC16  PC17  PC18
payroll.chg                   -0.06  0.02 -0.02  0.00  0.03  0.00  0.00  0.00  0.00
HH.empl.chg                    0.01  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
pop.empl.ratio                -0.02  0.00 -0.01  0.01  0.00  0.00  0.00  0.01  0.01
u.rate                        -0.01  0.00  0.03 -0.03  0.02  0.00  0.00 -0.01 -0.01
median.duration.unempl         0.02  0.05 -0.06 -0.01 -0.03  0.01 -0.02  0.00  0.00
LT.unempl.unempl.ratio         0.01  0.02 -0.01  0.02  0.00  0.00  0.05  0.00  0.00
U4                            -0.01  0.00  0.04 -0.02  0.02  0.00 -0.01 -0.01  0.01
U6                            -0.01  0.01  0.03 -0.03  0.02 -0.02  0.00  0.03  0.00
vacancy.rate                  -0.08 -0.06  0.01  0.01 -0.01  0.04  0.00  0.00  0.00
hires.rate                     0.01  0.00  0.04  0.00 -0.06 -0.01  0.00  0.00  0.00
unemployed.to.employed        -0.01  0.00  0.00  0.01  0.00  0.00  0.00  0.00  0.00
Layoff.rate..JOLT.             0.01  0.00 -0.01 -0.01  0.03  0.00  0.00  0.00  0.00
Exhaustion.rate                0.05 -0.07  0.02  0.06  0.01 -0.01 -0.02  0.00  0.00
Quits.rate..JOLT.              0.04 -0.01 -0.04  0.00  0.05  0.02  0.00  0.00  0.00
participation.rate            -0.06  0.00  0.02 -0.02  0.01  0.01  0.01  0.00  0.00
insured.u.rate                 0.04 -0.02 -0.02  0.00 -0.02  0.02  0.01  0.00  0.02
Initial.jobless.claims        -0.09  0.06  0.00  0.06  0.01 -0.01 -0.01  0.00  0.00
Continuing.claims              0.05 -0.02 -0.02 -0.02 -0.01  0.01  0.01  0.01 -0.02
Jobs.plentiful.jobs.hardtoget  0.11  0.07  0.05  0.02  0.01  0.02  0.00  0.00  0.00
vacancy.unempl.ratio           0.03 -0.01 -0.03  0.00  0.01 -0.06  0.00  0.00  0.00

                               PC19  PC20 h2       u2
payroll.chg                    0.00  0.00  1  5.6e-16
HH.empl.chg                    0.00  0.00  1 -2.9e-15
pop.empl.ratio                 0.01  0.01  1 -1.6e-15
u.rate                        -0.01  0.01  1  1.1e-16
median.duration.unempl         0.00  0.00  1 -4.4e-16
LT.unempl.unempl.ratio         0.00  0.00  1 -6.7e-16
U4                             0.01  0.00  1 -4.4e-16
U6                             0.00  0.00  1  2.2e-16
vacancy.rate                   0.00  0.00  1  0.0e+00
hires.rate                     0.00  0.00  1  4.4e-16
unemployed.to.employed         0.00  0.00  1 -2.2e-16
Layoff.rate..JOLT.             0.00  0.00  1 -2.2e-15
Exhaustion.rate                0.00  0.00  1 -4.4e-16
Quits.rate..JOLT.              0.00  0.00  1  1.1e-16
participation.rate             0.00 -0.01  1  5.6e-16
insured.u.rate                -0.01  0.00  1 -6.7e-16
Initial.jobless.claims         0.00  0.00  1 -2.0e-15
Continuing.claims              0.01  0.00  1 -6.7e-16
Jobs.plentiful.jobs.hardtoget  0.00  0.00  1  2.2e-16
vacancy.unempl.ratio           0.00  0.00  1 -2.2e-16

                        PC1  PC2  PC3  PC4  PC5  PC6  PC7  PC8  PC9 PC10 PC11 PC12
SS loadings           14.23 3.73 0.83 0.37 0.28 0.20 0.12 0.07 0.05 0.05 0.02 0.02
Proportion Var         0.71 0.19 0.04 0.02 0.01 0.01 0.01 0.00 0.00 0.00 0.00 0.00
Cumulative Var         0.71 0.90 0.94 0.96 0.97 0.98 0.99 0.99 0.99 1.00 1.00 1.00
Proportion Explained   0.71 0.19 0.04 0.02 0.01 0.01 0.01 0.00 0.00 0.00 0.00 0.00
Cumulative Proportion  0.71 0.90 0.94 0.96 0.97 0.98 0.99 0.99 0.99 1.00 1.00 1.00

                      PC13 PC14 PC15 PC16 PC17 PC18 PC19 PC20
SS loadings           0.01 0.01 0.01    0    0    0    0    0
Proportion Var        0.00 0.00 0.00    0    0    0    0    0
Cumulative Var        1.00 1.00 1.00    1    1    1    1    1
Proportion Explained  0.00 0.00 0.00    0    0    0    0    0
Cumulative Proportion 1.00 1.00 1.00    1    1    1    1    1

Test of the hypothesis that 20 components are sufficient.

The degrees of freedom for the null model are  190  and the objective function was  68.46
The degrees of freedom for the model are -20  and the objective function was  0

Fit based upon off diagonal values = 1

【问题讨论】:

  • 'none' 指定不旋转。为正交分量选择另一种旋转方法,例如。最大变量
  • 我也尝试了 varimax,但仍然不是正交

标签: r pca principal orthogonal psych


【解决方案1】:

要查找组件分数,您可以跳过查找相关性的步骤。校长会为你做的。然后,您可以跳过 Hong Ooi 建议的步骤,直接查找分数。它们应该是正交的。

使用您的示例:

pca.results <- principal(data,nfactors=20,rotate='none')
#then correlate the scores
cor(pca.results$scores) #these should be orthogonal

比尔

【讨论】:

    【解决方案2】:

    您得到的不是 PCA 分数,而是 PCA 负载。要获得后者,请在您的模型上使用 predict 方法。您应该会发现预测的分数确实彼此不相关。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-24
      • 1970-01-01
      • 2016-01-18
      • 2012-10-24
      • 1970-01-01
      • 1970-01-01
      • 2015-07-29
      • 2013-04-07
      相关资源
      最近更新 更多