【题8-7】

> library(psych)
> library(broom)
> library(tidyr)

> ex8_7=read.csv("/Users/y/Desktop/R/R87.csv")
> ex8_7
     x1    x2   x3   x4   x5
1 75.20 0.140 1.86 0.91 5.21
2 75.15 0.160 2.11 0.74 4.93
3 72.19 0.130 1.52 0.69 4.65
4 72.35 0.130 1.37 0.83 4.87
5 72.74 0.100 1.41 0.72 4.99
6 73.29 0.033 1.07 0.17 3.15
7 73.72 0.033 0.77 0.28 2.78


> #评估数据是否适合做因子分析
> KMO(ex8_7)
Kaiser-Meyer-Olkin factor adequacy
Call: KMO(r = ex8_7)
Overall MSA =  0.35
MSA for each item = 
  x1   x2   x3   x4   x5 
0.09 0.40 0.38 0.38 0.39 
> #结果Overall MSA =  0.35,小于0.5,不太适合做因子分析


> #bartlett检验
> #H0:原始变量的相关系数矩阵是单位矩阵
> cortest.bartlett(ex8_7)
R was not square, finding R from data
$chisq
[1] 38.01037

$p.value
[1] 3.779435e-05

$df
[1] 10

> #从结果p值很小很小,显然可以拒绝原假设
> 
> 
> #碎石图,确定因子个数
> par(family='STKaiti')#显示中文
> scree(ex8_7,factors = FALSE)
> #因子个数取2,图在下面
> 
> 
> #估计因子载荷
> #principal() 主成分法估计因子载荷
> 
> #不旋转
> pri_ex8_7=principal(ex8_7,nfactors = 2,rotate = "none")
> pri_ex8_7
Principal Components Analysis
Call: principal(r = ex8_7, nfactors = 2, rotate = "none")
Standardized loadings (pattern matrix) based upon correlation matrix
    PC1   PC2   h2    u2 com
x1 0.35  0.93 0.98 0.016 1.3
x2 0.98 -0.10 0.96 0.038 1.0
x3 0.94  0.24 0.94 0.061 1.1
x4 0.94 -0.23 0.94 0.062 1.1
x5 0.95 -0.24 0.97 0.029 1.1

                       PC1  PC2
SS loadings           3.75 1.04
Proportion Var        0.75 0.21
Cumulative Var        0.75 0.96
Proportion Explained  0.78 0.22
Cumulative Proportion 0.78 1.00

Mean item complexity =  1.1
Test of the hypothesis that 2 components are sufficient.

The root mean square of the residuals (RMSR) is  0.03 
 with the empirical chi square  0.11  with prob <  0.74 

Fit based upon off diagonal values = 1> 


> #用方差最大化旋转
> pri_varimax_ex8_7=principal(ex8_7,nfactors = 2,rotate = "varimax")
> pri_varimax_ex8_7
Principal Components Analysis
Call: principal(r = ex8_7, nfactors = 2, rotate = "varimax")
Standardized loadings (pattern matrix) based upon correlation matrix
    RC1  RC2   h2    u2 com
x1 0.08 0.99 0.98 0.016 1.0
x2 0.96 0.18 0.96 0.038 1.1
x3 0.84 0.49 0.94 0.061 1.6
x4 0.97 0.03 0.94 0.062 1.0
x5 0.98 0.03 0.97 0.029 1.0

                       RC1  RC2
SS loadings           3.55 1.25
Proportion Var        0.71 0.25
Cumulative Var        0.71 0.96
Proportion Explained  0.74 0.26
Cumulative Proportion 0.74 1.00

Mean item complexity =  1.1
Test of the hypothesis that 2 components are sufficient.

The root mean square of the residuals (RMSR) is  0.03 
 with the empirical chi square  0.11  with prob <  0.74 

Fit based upon off diagonal values = 1

     PC1   PC2   h2    u2 com
x1 0.35  0.93 0.98 0.016 1.3
x2 0.98 -0.10 0.96 0.038 1.0
x3 0.94  0.24 0.94 0.061 1.1
x4 0.94 -0.23 0.94 0.062 1.1
x5 0.95 -0.24 0.97 0.029 1.1

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值