R_Studio(学生成绩)使用主成分分析实现属性规约

Posted 1138720556gary

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了R_Studio(学生成绩)使用主成分分析实现属性规约相关的知识,希望对你有一定的参考价值。

 

 

  对11_1_4.csv成绩表进行主成分分析处理

 

  技术分享图片

 

技术分享图片
setwd(‘D:\\data‘)

list.files()

#读取数据
dat=read.csv(file="11_1_4.csv",header=TRUE)
dat=dat[,-c(1,2,10,11)]

#主成分分析
PCA=princomp(dat,cor=F)
names(PCA)#查看输出项

(PCA$sdev)^2#主成分特征根
summary(PCA)#主成分贡献率
PCA$loadings#主成分载荷      
PCA$scores#主成分得分
Gary.R

 

 

> summary(PCA)#主成分贡献率
Importance of components:
                          Comp.1    Comp.2     Comp.3     Comp.4     Comp.5     Comp.6     Comp.7
Standard deviation     21.923097 13.877129 11.2585833 9.08290162 7.12019143 5.87691397 5.25241336  #主成分的标准差
Proportion of Variance  0.482904  0.193489  0.1273575 0.08289078 0.05093782 0.03470209 0.02771882  #方差的贡献率
Cumulative Proportion   0.482904  0.676393  0.8037505 0.88664127 0.93757908 0.97228118 1.00000000  #方差的累积贡献率
 

 

> PCA$loadings#主成分载荷

Loadings:
                 Comp.1 Comp.2 Comp.3 Comp.4 Comp.5 Comp.6 Comp.7
JAVA程序设计      0.236  0.163                0.297  0.909       
电子商务技术      0.623 -0.756  0.124         0.118              
计算机维护与维修         0.104                0.190 -0.133  0.960
计算机组成原理    0.470  0.338  0.208 -0.306 -0.719              
数据库系统原理    0.365  0.314  0.335  0.761  0.131 -0.234       
算法设计与分析    0.372  0.153 -0.894  0.110        -0.105 -0.126
大学英语A_4       0.239  0.393  0.155 -0.553  0.572 -0.287 -0.221

               Comp.1 Comp.2 Comp.3 Comp.4 Comp.5 Comp.6 Comp.7
SS loadings     1.000  1.000  1.000  1.000  1.000  1.000  1.000
Proportion Var  0.143  0.143  0.143  0.143  0.143  0.143  0.143
Cumulative Var  0.143  0.286  0.429  0.571  0.714  0.857  1.000

 

 

> PCA$scores#主成分得分
           Comp.1      Comp.2       Comp.3      Comp.4      Comp.5      Comp.6       Comp.7
 [1,]  33.3196037  17.6874355  -0.25422380 -11.2669060   4.2917495  -1.7364204   4.97518007
 [2,]  31.1801767  14.1593983  -4.47470827  -7.0283584   6.4786703  -5.8908663   7.45630606
 [3,]  16.0593623   4.1733395   4.73087356   3.8211303   5.0571100  -2.4575435   3.28774257
 [4,]  18.4599795   6.8838756  -5.17888938  -3.5337153  -3.5324890   9.0664813 -10.53284043
 [5,]  22.6257727  -5.2588625   9.25342354  -0.7271976   9.8075163   8.4440318  -2.74254542
 [6,]  18.4583765   0.3841284  -5.83949272  -8.1471985 -13.7079196  -6.2410719  -3.88663198
 [7,]  20.7765859  13.6381355  -1.96535180   7.0825406  11.4998414   3.8088176  -6.24709551
 [8,]  22.4055982   1.2572326  -4.52725913   8.5461387  -5.8650063   3.1370173   5.43043952
 [9,]  10.6507844  10.4129351  15.42304832   4.4685204   1.1673139   8.1402877  -9.46484450
[10,]  17.1639629  -2.9525391 -10.01258904 -25.4490785  -5.4754708 -13.5277187  -7.95516018
[11,]  17.7945634   8.4024604  -0.35035882   2.3099044 -10.0253564   6.9582191   2.35849100
[12,]  12.8598877  -0.5588604  12.91817330  -2.2976186   5.7661594   0.3122876   1.63729804
[13,]  17.8084340  -3.0194490  -6.51371177   2.1379239  -4.3093249  -0.2923455  -2.14479586
[14,]  10.4585027   1.0417386 -19.73650352  14.2034399   1.8029565   6.4274103  -8.10728416
[15,]  10.3192625  -4.8219566  -3.60217599  -4.0807410   9.1303336   2.1788406  -0.47648506
[16,]  19.4722336  -9.0230062  13.96055565  -3.0505762  16.4767485  -0.0768518   1.97413948
[17,]  12.4466032   3.6624606  11.86842261  -2.2940459  -5.3363913   2.9385003  12.01728038
[18,]  10.9412050  -5.2512180  12.77385227   0.1711016   5.8379586   1.8466416  -7.84034045
[19,]  20.2156694 -11.9257596  -4.89824057   4.2539217   1.2212099  -1.3598156   0.69586378
[20,]   7.5757204   1.4629122  12.45201823   1.3380320 -11.4475596  -3.0560369  -0.33679014
[21,]   2.7560708   9.2670628  12.12499946   8.2058762  -6.6679381  -1.8767783   1.75044570
[22,]   6.9386608  21.9442175  16.71159245   2.4286736  -0.8955840  -6.6829971  -4.72743757
[23,]  -9.9243741   0.4757100   0.01573284   1.4254642   2.4706595  -3.8905899   2.61108720
[24,]   6.5950893   3.7321278  -8.91241929  -0.5066062   6.3637581   1.2706868   1.10666607
[25,]  16.2275862  -4.7775620 -13.76590352 -22.8140031   5.2334105   9.4658474   3.59374787
[26,]  -1.6370774  16.7224036  11.47807300   1.3839942   0.1871615  -3.8104935  -2.65749127
[27,]  -4.9984010   6.7262848   9.33017015   9.4159721 -11.9826050  -1.9271300  -2.70926180
[28,]  -0.9466044  -4.9963382 -13.44043198   6.8435895   7.0608288  -2.0568204  -6.36663646
[29,]  -6.9405262   9.3086749  -4.25783374  13.8646433   0.9253015 -12.7755734  -0.51105509
[30,]   1.7219892  -5.6298414 -10.69930010  13.6120593  -5.2090180 -10.0628742  -4.78383632
[31,]  -0.3541851  12.2312177  -6.08951913  10.4920885  -7.2794460   3.1028452   4.27513314
[32,]  -4.3581531  -5.9643460  -7.16475122   6.4932550  -5.1895961  -1.7878238   2.16402149
[33,] -14.4453722  -0.1044177   1.61962685   9.0343576  -2.1145786   7.1296350   6.88736228
[34,]  -3.8559156 -20.4106594   2.79158832   0.3726180  -4.4280421  -0.6170102   4.28772644
[35,]  13.6221594  -7.3733618  -4.65438509  -6.9531488 -10.0671883  -0.5898709  -0.36369030
[36,] -14.2113823 -16.6100486   9.07203345 -13.4515467  -2.0797826  -3.1567749   2.94481184
[37,] -10.3241338 -21.8739290  -0.25448952  -4.2178114  -5.8253442  -2.2815638   2.57099401
[38,]  -1.6878990 -13.9744770 -32.25639847   1.7264204  -6.8524217  11.0633408   4.89836794
[39,] -21.9957957 -24.0405721  22.38147318  12.4602238   0.9192234   7.6823693   0.90812105
[40,] -27.3899348 -15.4321304  13.48446066   5.0113346  -2.4836177  -4.2459026   6.84884606
[41,] -36.8582514 -10.8359097   4.53814047  -4.9203118  12.2050066  -4.2598492  -1.97133591
[42,] -29.1632178  -5.8974902  17.50675815 -13.0108622  -1.3726696   7.3525642  -1.22636356
[43,] -39.0671787  22.1658349  -3.46728792  -2.2345130   5.9431736  -8.7253538  -0.08618077
[44,] -13.5103452 -28.6644930  -6.58252140 -11.1545147   2.1688582  -4.5438992   0.97442827
[45,] -52.4375907  51.4437648 -10.05342584  -9.6192156   1.9129401   5.2524403   9.21448312
[46,] -31.0312852 -12.0406147 -21.53204798  15.8935480  14.8361158  -4.9785873   2.95657858
[47,] -73.7162166   4.2544914  -3.95079643 -10.2388023  -6.6166558   7.3302988 -12.68745922

 

以上是关于R_Studio(学生成绩)使用主成分分析实现属性规约的主要内容,如果未能解决你的问题,请参考以下文章

R_Studio(学生成绩)对两个班级学生成绩进行集合,重新计算学生综合测评成绩并对学生按综合测评成绩进行排名

主成分分析PCA

R_Studio中xls数据进行统计求和

因子分析(R实例)

PCA主成分分析

机器学习主成分分析PCA(Principal components analysis)