setwd("D:\\Rdownload\\lianxi\\seventh") #设定工作路径
case7.1<-read.csv("case7.1.csv",header=T) #读入数据
data<-case7.1[,-1]
name<-case7.1[,1]
da<-scale(data)
da
## x1 x2 x3 x4 x5
## [1,] -0.031866321 0.16707031 0.17028963 -0.364330015 -0.96353615
## [2,] -0.710190348 -0.58277282 -0.32970970 0.891528229 1.26198298
## [3,] -0.005776935 0.48279374 -0.06884049 0.268589661 -0.17521040
## [4,] 0.180575819 1.19317144 0.88767997 0.012016471 -0.40764060
## [5,] -0.512656428 -0.93796167 -1.35144747 -1.411759238 -1.05069748
## [6,] -0.367301279 -0.58277282 -0.54710072 0.176998316 0.03397678
## [7,] 0.381836794 -0.26704940 -1.04710005 0.052528028 0.18408794
## [8,] 1.634127306 0.28546660 0.67028896 0.229839477 -0.61682778
## [9,] -0.620741026 -0.81956539 -0.28623150 0.802872505 1.61450211
## [10,] -1.265521557 -0.46437654 -0.89492634 -0.296810755 -1.03326521
## [11,] 0.046401836 -0.34598025 -0.43840521 0.329063433 0.49980563
## [12,] -0.803366725 -0.26704940 0.17028963 0.559803167 1.09928184
## [13,] -0.579743420 -0.42491111 -0.24275330 0.302642853 0.82617636
## [14,] -0.471658822 -0.74063453 -0.67753533 0.003796735 0.06690439
## [15,] 0.568189549 1.62729115 1.56159212 -0.177037458 -0.60326935
## [16,] -0.743733844 -0.46437654 -0.59057892 2.101003678 3.77997678
## [17,] -0.065409817 -0.85903082 -0.69927443 -0.856339931 -0.42023057
## [18,] 2.152187963 0.36439745 0.23550693 -0.078987749 -0.53644567
## [19,] -0.646830411 0.52225916 0.47463705 -0.431262152 -0.63232312
## [20,] -0.639376301 -1.41154681 -1.54709938 0.897399469 1.07507036
## [21,] -0.177221470 0.60119002 0.80072357 -0.136525902 0.54144937
## [22,] -0.948721874 -1.17475424 -1.30796927 0.129441272 0.45428805
## [23,] 0.806721075 -0.89849624 -0.54710072 -0.386053603 -1.10589965
## [24,] 0.366928574 -0.93796167 -0.43840521 0.502852139 -0.27593015
## [25,] 0.348293298 2.65339227 2.69202539 -0.208742154 -0.84635259
## [26,] 0.519737833 1.31156772 1.49637481 0.050179532 -0.36502840
## [27,] -0.173494415 -0.06972226 -0.22101420 0.293835993 0.56566085
## [28,] 0.676274147 0.24600117 0.86594087 -0.290939515 -0.82214112
## [29,] -0.248035516 -0.18811854 0.17028963 -0.458856980 -0.12388207
## [30,] -0.475385877 0.00920860 -0.22101420 0.199896153 0.10273738
## [31,] -1.213342786 -0.85903082 -0.76449173 -0.164707854 -0.48511733
## [32,] 3.754821653 2.10087628 1.60507032 -0.219897510 -0.82892033
## [33,] -0.084045092 -0.54330739 0.08333322 0.394821322 -0.18876883
## [34,] 0.176848764 0.60119002 0.06159412 0.213987129 0.60633613
## [35,] 0.691182367 0.75905173 1.19202739 -0.120086430 -0.29433088
## [36,] -0.695282128 -0.03025683 -0.26449240 0.545712191 0.98694058
## [37,] -0.385936555 0.99584430 0.30072424 0.583875251 0.78646954
## [38,] -1.485417807 -2.39818251 -2.17753332 -4.639767013 -2.05983191
## [39,] 1.294965292 1.46942944 1.36594021 -0.145332762 -1.39934277
## [40,] 1.343417008 1.78515286 1.71376583 -0.135938778 -0.59164784
## [41,] -0.363574224 0.48279374 0.49637615 0.416544910 0.76322652
## [42,] -0.352393059 0.24600117 0.84420177 0.337870294 -0.37180761
## [43,] 0.016585395 -0.74063453 -0.76449173 1.316606008 0.01267067
## [44,] -0.184675580 0.16707031 0.60507166 -0.154726746 -0.08223832
## [45,] 0.374382684 -0.89849624 -1.39492567 1.773975607 2.78440077
## [46,] -0.210764966 -1.17475424 -1.06883915 0.165842960 -0.38827142
## [47,] -0.400844775 0.40386288 0.84420177 -0.354936031 -0.80470885
## [48,] -0.862999607 -2.08245908 -2.19927243 -4.130730501 -0.84054184
## [49,] -0.154859139 -0.14865311 -0.65579623 1.065316935 1.82175237
## [50,] -0.762369119 1.39049858 0.58333255 0.703648548 1.17869549
## [51,] -0.415752996 -0.46437654 -0.54710072 -0.357284527 -0.69043067
## [52,] -1.157436959 -0.34598025 -0.59057892 0.473495938 0.88041007
## [53,] -0.546199924 -0.34598025 -0.41666611 -0.316772971 -0.74175901
## [54,] 3.415659640 2.17980714 1.62680942 -0.091317353 -1.00808527
## [55,] 1.634127306 0.28546660 0.67028896 0.229839477 -0.61682778
## [56,] -0.825729056 -0.70116910 -0.22101420 0.531621215 0.13760190
## [57,] -0.389663610 0.44332831 -0.26449240 -0.226355874 0.59471462
## [58,] -0.818274946 -0.81956539 -0.63405712 0.069554624 -0.20910647
## [59,] 0.799266965 0.75905173 1.80072223 -0.019101101 -0.26140327
## [60,] -0.385936555 -0.54330739 -0.56883982 -0.452398616 -0.81729882
## x6 x7 x8 x9 x10
## [1,] -0.624655604 -0.803001413 -0.628790505 -0.75113243 -0.67137652
## [2,] 1.091604205 0.988306983 0.269833283 0.18778311 0.10993446
## [3,] 0.156422810 0.514698793 0.659502005 0.09230017 0.12495967
## [4,] -0.177259853 0.373380220 1.063939512 -0.41694215 -0.37087229
## [5,] -1.597119977 -2.273478456 -2.620304411 -1.06940888 -0.95685553
## [6,] 0.050166320 -0.056304630 0.219846624 -0.46468362 -0.40092272
## [7,] -0.120092619 0.109840179 0.467507795 1.62002715 1.22180009
## [8,] 0.001698447 0.547163871 0.774244107 0.09230017 0.12495967
## [9,] 0.881576756 0.535705608 0.315275699 -0.19414864 -0.14549413
## [10,] -0.553196560 -0.732342127 -0.628790505 -0.76704625 -0.71645215
## [11,] 0.225396322 0.275984988 -0.089161808 -0.40102833 -0.37087229
## [12,] 0.636751859 0.791606808 0.941244987 0.41057663 0.35033784
## [13,] 0.198055471 0.180499466 -0.151645131 -0.49651127 -0.46102356
## [14,] -0.156754215 -0.350400038 -0.407258724 -0.57608038 -0.55117483
## [15,] -0.405928792 -0.508906005 0.032396656 0.23552458 0.20008573
## [16,] 4.124574562 3.010690344 1.354770978 1.81099302 1.79275811
## [17,] -1.047817417 -1.385463099 -1.725088805 -1.30811622 -1.33248581
## [18,] -0.308993046 -0.300747566 -0.217536635 -0.54425274 -0.52112441
## [19,] -0.642054327 -0.753348942 -0.794655325 -0.83070154 -0.76152778
## [20,] 1.056185375 0.222513095 -0.124379681 -0.67156332 -0.61127567
## [21,] -0.359325068 -0.283560172 -0.069848781 1.06304336 1.07154797
## [22,] 0.127217810 -0.233907701 -0.424299630 -0.49651127 -0.52112441
## [23,] -0.650132306 -0.887028673 -0.738988365 -0.78296008 -0.71645215
## [24,] 0.381984835 0.293172382 0.236887531 0.36283516 0.35033784
## [25,] -0.450046984 0.123208152 0.953741652 0.25143840 0.30526221
## [26,] -0.141219640 -0.062033761 0.632236555 1.09487100 1.29692614
## [27,] 0.235338450 0.352373405 0.140322395 0.39466280 0.38038826
## [28,] -0.561274539 -0.879389831 -0.943479240 -0.25780393 -0.88172947
## [29,] -0.693007732 -0.990153037 -0.892356521 -0.87844301 -0.80660342
## [30,] 0.034010362 0.237790779 -0.056216056 0.01273106 0.01978319
## [31,] -0.397229430 -0.799181992 -0.610613538 -0.73521861 -0.65635131
## [32,] -0.464338793 -0.564287608 0.366398418 -0.22597628 -0.16051934
## [33,] 0.288156004 0.205325701 0.007403327 -0.16232099 -0.28072103
## [34,] 0.122868129 0.631191130 0.150546939 -0.63973567 -0.55117483
## [35,] -0.335091132 -0.350400038 1.284335233 0.42649045 0.41043868
## [36,] 0.576477709 0.720947521 0.628828374 0.02864488 0.06485883
## [37,] 0.627431114 1.624240561 1.099157385 -0.19414864 -0.13046892
## [38,] -1.830138597 -2.283027008 -3.540513346 -1.27628858 -1.66304045
## [39,] -0.381073473 -0.140331889 -0.366360549 -0.24189010 -0.43097314
## [40,] -0.358082302 0.077375102 0.125553610 -0.03501041 0.23013615
## [41,] 0.322953451 0.948203064 0.674270790 1.25400923 0.86119502
## [42,] 0.280699408 0.480324005 0.501589607 0.01273106 0.04983362
## [43,] 1.378061762 1.532574460 0.998048008 3.13184030 2.64919514
## [44,] -0.355596770 -0.512725426 -0.069848781 -0.21006246 -0.08539328
## [45,] 3.103642315 1.767468845 1.792154238 3.95935908 4.51232133
## [46,] -0.063546767 -0.411510772 -0.385673576 -0.52833891 -0.49107398
## [47,] -0.617199008 -0.741890679 -0.462925684 -0.49651127 -0.58122525
## [48,] -3.032514676 -2.300214402 -2.656658344 -1.02166742 -0.91177990
## [49,] 1.484318253 1.723545505 1.054851029 0.07638635 0.07988404
## [50,] 0.869770479 2.397673291 1.992100871 1.34949216 1.37205220
## [51,] -0.620927306 -0.789633440 -0.795791386 -0.86252919 -0.77655300
## [52,] 0.519310475 0.596816342 0.811734100 0.23552458 0.42546390
## [53,] -0.573702199 -0.730432416 -0.571987484 -0.71930479 -0.59625046
## [54,] -0.311478578 -0.002832737 0.902618933 2.38389064 2.19843881
## [55,] 0.001698447 0.547163871 0.774244107 0.09230017 0.12495967
## [56,] 0.564671433 0.340915143 0.068750589 -0.24189010 -0.14549413
## [57,] -0.438862091 -0.741890679 -0.494735376 -0.71930479 -0.65635131
## [58,] -0.109529108 -0.274011620 -0.113019077 -0.36920069 -0.32579666
## [59,] -0.234427088 -0.102137680 0.315275699 -0.19414864 -0.20559497
## [60,] -0.728426562 -0.906125777 -1.028683771 -0.79887390 -0.88172947
## x11 x12
## [1,] -0.60999466 -0.54917188
## [2,] -0.20848799 0.08887014
## [3,] 0.19823306 -0.25893472
## [4,] -0.75599709 -0.97613232
## [5,] -1.52250984 -1.27356545
## [6,] -0.66735276 -0.72427363
## [7,] 0.56323913 1.39133937
## [8,] 0.30773488 -0.34768493
## [9,] -0.08334305 -0.46761764
## [10,] -0.77685458 -0.78903730
## [11,] -0.35970479 -0.41244859
## [12,] 0.28687739 -0.17018452
## [13,] -0.48484973 -0.51079341
## [14,] -0.59956592 -0.42444186
## [15,] 0.58931099 0.58059425
## [16,] 1.09510511 0.87562871
## [17,] -0.97500073 -0.22535356
## [18,] -0.28148920 -0.62592881
## [19,] -0.98542948 -0.68349651
## [20,] -0.79771207 -0.94494982
## [21,] 1.11074823 2.37478759
## [22,] -0.40663414 -0.21815760
## [23,] -0.71949649 -0.44123244
## [24,] 0.30773488 0.50383731
## [25,] 0.40680795 -0.29011722
## [26,] 1.80947413 1.57843439
## [27,] 0.43809419 1.00755469
## [28,] -0.02598496 1.79191462
## [29,] -0.77685458 -0.64511805
## [30,] 0.74052779 0.48224943
## [31,] -0.53699345 -0.44363109
## [32,] 0.23994804 -0.45802302
## [33,] -0.49527847 -0.33329300
## [34,] -0.88635640 -0.92096328
## [35,] 0.75617090 -0.35727954
## [36,] 0.08351686 -0.32129973
## [37,] -0.42749163 -0.75785479
## [38,] -1.31393494 -0.86339558
## [39,] -0.13027240 -0.10302220
## [40,] -0.68821025 0.56140501
## [41,] 1.26717940 0.65015522
## [42,] 0.40159358 -0.26373203
## [43,] 4.00472491 2.11093562
## [44,] 0.33380674 0.23278939
## [45,] 2.67505995 4.44242750
## [46,] -0.61520904 -0.27812395
## [47,] -0.23977422 -0.43163782
## [48,] -1.59551105 -1.30954526
## [49,] -0.36491916 -0.53477995
## [50,] 0.83438649 0.40309384
## [51,] -0.82378393 -0.96653771
## [52,] 0.47459479 0.36231672
## [53,] -0.57349406 -0.12940739
## [54,] 2.46127068 1.72475230
## [55,] 0.30773488 -0.34768493
## [56,] 0.34423548 -0.07183969
## [57,] -0.59435155 -0.74346287
## [58,] -0.32841856 -0.31890108
## [59,] -0.34927604 -0.44842840
## [60,] -1.03757320 0.21839746
## attr(,"scaled:center")
## x1 x2 x3 x4 x5 x6 x7
## 4.7355000 0.6676667 1.1716667 8.8953333 24.8791667 12.8226667 5.6948333
## x8 x9 x10 x11 x12
## 7.9448333 0.5820000 0.5368333 2.0398333 5.8995000
## attr(,"scaled:scale")
## x1 x2 x3 x4 x5 x6 x7
## 2.6830835 0.2533863 0.4600006 17.0321771 10.3256807 16.0931345 5.2363959
## x8 x9 x10 x11 x12
## 8.8023488 0.6283845 0.6655481 1.9177763 4.1690044
dat<-cor(da)
dat
## x1 x2 x3 x4 x5 x6
## x1 1.00000000 0.608661931 0.58947060 0.09053822 -0.2843693 -0.069306629
## x2 0.60866193 1.000000000 0.92147919 0.24088930 -0.1316852 0.007508128
## x3 0.58947060 0.921479190 1.00000000 0.21192221 -0.2129252 -0.039329247
## x4 0.09053822 0.240889296 0.21192221 1.00000000 0.6776357 0.855226472
## x5 -0.28436926 -0.131685164 -0.21292519 0.67763574 1.0000000 0.851567015
## x6 -0.06930663 0.007508128 -0.03932925 0.85522647 0.8515670 1.000000000
## x7 0.01364721 0.236915648 0.15475471 0.82195700 0.7697468 0.896056873
## x8 0.26189269 0.506892663 0.44369218 0.82052037 0.5694569 0.732129001
## x9 0.24549351 0.238633994 0.15593649 0.52917899 0.4828813 0.637953909
## x10 0.23735981 0.244965246 0.15212406 0.55578193 0.5226647 0.660032176
## x11 0.29673784 0.305663291 0.27768545 0.51170635 0.3286049 0.539324412
## x12 0.20859956 0.149535772 0.12208860 0.38518366 0.3278747 0.455056527
## x7 x8 x9 x10 x11 x12
## x1 0.01364721 0.2618927 0.2454935 0.2373598 0.2967378 0.2085996
## x2 0.23691565 0.5068927 0.2386340 0.2449652 0.3056633 0.1495358
## x3 0.15475471 0.4436922 0.1559365 0.1521241 0.2776855 0.1220886
## x4 0.82195700 0.8205204 0.5291790 0.5557819 0.5117063 0.3851837
## x5 0.76974677 0.5694569 0.4828813 0.5226647 0.3286049 0.3278747
## x6 0.89605687 0.7321290 0.6379539 0.6600322 0.5393244 0.4550565
## x7 1.00000000 0.8738672 0.6546178 0.6649649 0.5690159 0.3808832
## x8 0.87386720 1.0000000 0.6796509 0.7062190 0.6517245 0.4093588
## x9 0.65461779 0.6796509 1.0000000 0.9847536 0.9230638 0.8459829
## x10 0.66496486 0.7062190 0.9847536 1.0000000 0.8954067 0.8291282
## x11 0.56901593 0.6517245 0.9230638 0.8954067 1.0000000 0.8004992
## x12 0.38088318 0.4093588 0.8459829 0.8291282 0.8004992 1.0000000
##从样本数据各变量的相关系数上可以看出,x2和x3, x4、x5、x6、x7和x8, x9、x10、x11和x12之间存在较强的相关性。
factanal(da,factors=3,rotation="none")
##
## Call:
## factanal(x = da, factors = 3, rotation = "none")
##
## Uniquenesses:
## x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12
## 0.538 0.079 0.080 0.196 0.213 0.077 0.077 0.103 0.005 0.025 0.131 0.245
##
## Loadings:
## Factor1 Factor2 Factor3
## x1 0.244 0.587 -0.241
## x2 0.267 0.922
## x3 0.183 0.941
## x4 0.591 0.103 0.667
## x5 0.528 -0.326 0.634
## x6 0.688 -0.188 0.644
## x7 0.708 0.648
## x8 0.733 0.338 0.495
## x9 0.994
## x10 0.987
## x11 0.919 -0.124
## x12 0.829 -0.251
##
## Factor1 Factor2 Factor3
## SS loadings 5.799 2.364 2.071
## Proportion Var 0.483 0.197 0.173
## Cumulative Var 0.483 0.680 0.853
##
## Test of the hypothesis that 3 factors are sufficient.
## The chi square statistic is 91.48 on 33 degrees of freedom.
## The p-value is 2.12e-07
library(psych) #加载psych包
fa=principal(da,3,rotate="none",method="pc")
fa
## Principal Components Analysis
## Call: principal(r = da, nfactors = 3, rotate = "none", method = "pc")
## Standardized loadings (pattern matrix) based upon correlation matrix
## PC1 PC2 PC3 h2 u2 com
## x1 0.24 0.78 -0.07 0.67 0.333 1.2
## x2 0.36 0.83 0.29 0.91 0.090 1.6
## x3 0.29 0.85 0.30 0.90 0.097 1.5
## x4 0.81 -0.15 0.40 0.85 0.155 1.5
## x5 0.67 -0.59 0.25 0.86 0.142 2.3
## x6 0.84 -0.41 0.23 0.93 0.070 1.6
## x7 0.87 -0.22 0.34 0.93 0.075 1.4
## x8 0.89 0.13 0.33 0.92 0.081 1.3
## x9 0.90 0.03 -0.41 0.97 0.029 1.4
## x10 0.91 0.01 -0.37 0.96 0.043 1.3
## x11 0.84 0.16 -0.40 0.90 0.099 1.5
## x12 0.72 0.05 -0.59 0.87 0.133 1.9
##
## PC1 PC2 PC3
## SS loadings 6.50 2.65 1.50
## Proportion Var 0.54 0.22 0.12
## Cumulative Var 0.54 0.76 0.89
## Proportion Explained 0.61 0.25 0.14
## Cumulative Proportion 0.61 0.86 1.00
##
## Mean item complexity = 1.6
## Test of the hypothesis that 3 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.03
## with the empirical chi square 9.42 with prob < 1
##
## Fit based upon off diagonal values = 1
library(psych) #加载psych包
fac=principal(da,3,rotate="none")
fac
## Principal Components Analysis
## Call: principal(r = da, nfactors = 3, rotate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
## PC1 PC2 PC3 h2 u2 com
## x1 0.24 0.78 -0.07 0.67 0.333 1.2
## x2 0.36 0.83 0.29 0.91 0.090 1.6
## x3 0.29 0.85 0.30 0.90 0.097 1.5
## x4 0.81 -0.15 0.40 0.85 0.155 1.5
## x5 0.67 -0.59 0.25 0.86 0.142 2.3
## x6 0.84 -0.41 0.23 0.93 0.070 1.6
## x7 0.87 -0.22 0.34 0.93 0.075 1.4
## x8 0.89 0.13 0.33 0.92 0.081 1.3
## x9 0.90 0.03 -0.41 0.97 0.029 1.4
## x10 0.91 0.01 -0.37 0.96 0.043 1.3
## x11 0.84 0.16 -0.40 0.90 0.099 1.5
## x12 0.72 0.05 -0.59 0.87 0.133 1.9
##
## PC1 PC2 PC3
## SS loadings 6.50 2.65 1.50
## Proportion Var 0.54 0.22 0.12
## Cumulative Var 0.54 0.76 0.89
## Proportion Explained 0.61 0.25 0.14
## Cumulative Proportion 0.61 0.86 1.00
##
## Mean item complexity = 1.6
## Test of the hypothesis that 3 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.03
## with the empirical chi square 9.42 with prob < 1
##
## Fit based upon off diagonal values = 1
##从上述极大似然法、主因子法和主成分法得出的因子分析结果上可以看出,极大似然法前三个因子累计贡献率有85.3%,而主因子法和主成分法累计贡献率达到了89%,说明主成分法和主因子法效果比极大似然分析法效果好,其原因在于,极大似然法做因子分析要求数据样本要服从多元正态分布,但在实际中大多数数据都很难满足多元正态要求。接下来为了更好地解释因子的含义,我们基于主成分法采用方差最大化作因子正交旋转。(主成分法和主因子法得到的结果一致,我们在后面的过程中选择主成分法)
fac1=principal(da,3,rotate="varimax")
fac1
## Principal Components Analysis
## Call: principal(r = da, nfactors = 3, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
## RC1 RC3 RC2 h2 u2 com
## x1 -0.15 0.26 0.76 0.67 0.333 1.3
## x2 0.13 0.07 0.94 0.91 0.090 1.1
## x3 0.08 0.02 0.95 0.90 0.097 1.0
## x4 0.88 0.22 0.16 0.85 0.155 1.2
## x5 0.85 0.21 -0.32 0.86 0.142 1.4
## x6 0.89 0.35 -0.12 0.93 0.070 1.3
## x7 0.91 0.30 0.10 0.93 0.075 1.2
## x8 0.79 0.34 0.42 0.92 0.081 1.9
## x9 0.40 0.89 0.12 0.97 0.029 1.4
## x10 0.43 0.87 0.12 0.96 0.043 1.5
## x11 0.31 0.87 0.23 0.90 0.099 1.4
## x12 0.15 0.92 0.04 0.87 0.133 1.1
##
## RC1 RC3 RC2
## SS loadings 4.25 3.64 2.77
## Proportion Var 0.35 0.30 0.23
## Cumulative Var 0.35 0.66 0.89
## Proportion Explained 0.40 0.34 0.26
## Cumulative Proportion 0.40 0.74 1.00
##
## Mean item complexity = 1.3
## Test of the hypothesis that 3 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.03
## with the empirical chi square 9.42 with prob < 1
##
## Fit based upon off diagonal values = 1
fac1$loadings
##
## Loadings:
## RC1 RC3 RC2
## x1 -0.155 0.261 0.758
## x2 0.132 0.942
## x3 0.947
## x4 0.877 0.220 0.164
## x5 0.845 0.208 -0.317
## x6 0.892 0.347 -0.118
## x7 0.910 0.296 0.101
## x8 0.792 0.340 0.420
## x9 0.397 0.894 0.118
## x10 0.434 0.869 0.116
## x11 0.312 0.866 0.230
## x12 0.147 0.918
##
## RC1 RC3 RC2
## SS loadings 4.246 3.638 2.769
## Proportion Var 0.354 0.303 0.231
## Cumulative Var 0.354 0.657 0.888
##从上述因子正交旋转的结果可以看出,方差累计贡献率达到了89%. 第一个因子主要和营业利润率(x4)、毛利率(x5)、成本费用利润率(x6)、总资产报酬率(x7)和净资产收益率-加权(扣除非经常性损益)(x8)五个指标有很强的正相关,相关系数分别为0.877、0.845、0.892和0.910;第二个因子主要和每股收益(x9)、扣除非经常性损益每股收益(x10)、每股未分配利润(x11)和每股净资产(x12)四个指标有很强的正相关,相关系数分别为0.894、0.869、0.866和0.918;第三个因子主要和存货周转率(x1)、总资产周转率(x2)、流动资产周转率(x3)三个指标有很强的正相关,相关系数分别为0.758、0.942和0.947;所以第一个因子可称为“企业盈利能力因子”,第二个因子称为“股东回报因子”,第三个因子称为“企业运营能力因子”.
##在了解各个综合因子的具体含义后,可采用回归估计等估计方法计算样本的因子得分,绘制前两个因子载荷、得分及信息重叠图.
plot(fac1$loadings,,type="n",xlab="Factor1",ylab="Factor2") #输出因子载荷图
text(fac1$loadings,paste("x",1:12,sep=""),cex=1.5)
fac1_plotdata<-fac1$scores
fac1_plotdata
## RC1 RC3 RC2
## [1,] -0.5999661592 -0.56013562 0.24368649
## [2,] 1.1669650078 -0.27391127 -0.67679954
## [3,] 0.3717616793 -0.13640160 0.28935997
## [4,] 0.5083379905 -1.06622471 1.11570555
## [5,] -1.7603133124 -0.59796323 -1.06358033
## [6,] 0.3203043635 -0.67170793 -0.40333798
## [7,] -0.3605736648 1.59450094 -0.51532778
## [8,] 0.0878853290 -0.02912843 1.01899352
## [9,] 1.1699831403 -0.57172183 -0.70028210
## [10,] -0.4359993776 -0.66344241 -0.67754046
## [11,] 0.4293302604 -0.50661864 -0.29165436
## [12,] 1.0313571525 -0.13826741 -0.27330211
## [13,] 0.5682620562 -0.70131627 -0.45744820
## [14,] -0.0178401702 -0.49500496 -0.64013814
## [15,] -0.5350266169 0.38429288 1.35305971
## [16,] 3.2002753335 0.62314023 -1.18241353
## [17,] -1.1044549336 -0.54468835 -0.67178748
## [18,] -0.3823792523 -0.39769958 0.92350164
## [19,] -0.4046776027 -0.88706980 0.26200198
## [20,] 1.0514418051 -0.96811089 -1.32424792
## [21,] -0.6005258328 1.69083886 0.16240253
## [22,] 0.1653022801 -0.33256976 -1.23605127
## [23,] -0.8571337408 -0.30964819 -0.18245809
## [24,] 0.0423184529 0.53627285 -0.38156464
## [25,] 0.0006364157 -0.28255945 2.30887462
## [26,] -0.4883365127 1.55616739 1.13130353
## [27,] 0.1664096355 0.60692313 -0.29470156
## [28,] -1.1173981101 0.55644783 0.48304356
## [29,] -0.4806816685 -0.71604241 -0.08065096
## [30,] 0.0385546447 0.33654555 -0.24083851
## [31,] -0.3369374994 -0.47129138 -0.85869262
## [32,] -0.6407913290 -0.12822700 2.56750406
## [33,] 0.2916313068 -0.42539079 -0.12231075
## [34,] 0.7390834489 -1.13372943 0.34095664
## [35,] -0.0645084110 0.18343238 1.12554562
## [36,] 0.9634075958 -0.37292304 -0.31291896
## [37,] 1.4384845496 -1.03692946 0.49718301
## [38,] -3.1609081915 0.04825025 -2.29715171
## [39,] -0.5704266866 -0.25262177 1.55658524
## [40,] -0.2774624548 -0.10334633 1.69396623
## [41,] 0.5158306188 0.83915764 0.16324765
## [42,] 0.3768502088 -0.20345341 0.45192504
## [43,] 0.2307349677 3.31679142 -0.71015078
## [44,] -0.2994061814 0.10107567 0.23644619
## [45,] 1.2401851462 4.23973726 -1.51829394
## [46,] -0.1666857658 -0.30182427 -0.81991106
## [47,] -0.5036411847 -0.45678558 0.46355536
## [48,] -2.8289505115 -0.06110120 -1.96054190
## [49,] 1.8800356718 -0.76060278 -0.41127039
## [50,] 1.6226742283 0.34811486 0.54498510
## [51,] -0.4707628809 -0.75233279 -0.37400419
## [52,] 0.7612342008 0.19673482 -0.69641796
## [53,] -0.5494071967 -0.33536806 -0.34759939
## [54,] -1.1344669213 2.61590943 2.31448499
## [55,] 0.0878853290 -0.02912843 1.01899352
## [56,] 0.4733529019 -0.15399734 -0.54496739
## [57,] -0.0142564085 -0.78178447 -0.09248126
## [58,] -0.0051614156 -0.29635606 -0.68570583
## [59,] 0.0420879391 -0.54756040 1.28085467
## [60,] -0.8135236669 -0.31934667 -0.50162333
rownames(fac1_plotdata)<-unlist(name)
plot(fac1_plotdata[, 1], fac1_plotdata[, 2], type = "n", xlab="Factor1", ylab = "Factor2") #输出因子得分图
text(fac1_plotdata[,1],fac1_plotdata[,2],labels=rownames(fac1_plotdata), cex = 1.5)
biplot(fac1_plotdata,fac1$loadings) #输出信息重叠图
##由因子得分图可知,新坐标的盈利能力和兆丰股份、苏威孚B、华域汽车的股东回报大大领先于其他企业.
weights <- runif(nrow(fac1$scores))
weighted_fac1_scores <- fac1$scores * weights #计算加权因子得分
ranked_weighted_fac1_scores <- data.frame(matrix(nrow = nrow(weighted_fac1_scores), ncol = ncol(weighted_fac1_scores)))
for (i in 1:ncol(weighted_fac1_scores)) {
col_name <- paste0("Rank_Factor", i)
rank_scores <- rank(-weighted_fac1_scores[, i])
ranked_weighted_fac1_scores[, col_name] <- rank_scores
} #单因子排序
w1 <- 0.354
w2 <- 0.213
w3 <- 0.303
composite_scores <- w1 * weighted_fac1_scores[, 1] + w2 * weighted_fac1_scores[, 2] + w3 * weighted_fac1_scores[, 3]
composite_rank <- rank(-composite_scores)
ranked_weighted_fac1_scores <- data.frame(ranked_weighted_fac1_scores, composite_rank)
colnames(ranked_weighted_fac1_scores)[ncol(ranked_weighted_fac1_scores)] <- "Composite_Rank" #综合因子排序
ranked_weighted_fac1_scores #查看排名结果
## X1 X2 X3 Rank_Factor1 Rank_Factor2 Rank_Factor3 Composite_Rank
## 1 NA NA NA 40 28 24 38
## 2 NA NA NA 4 41 54 21
## 3 NA NA NA 13 33 15 9
## 4 NA NA NA 16 55 8 15
## 5 NA NA NA 59 54 57 59
## 6 NA NA NA 15 58 51 50
## 7 NA NA NA 44 5 39 28
## 8 NA NA NA 25 20 9 8
## 9 NA NA NA 21 25 29 31
## 10 NA NA NA 39 31 33 42
## 11 NA NA NA 12 53 45 40
## 12 NA NA NA 6 30 41 11
## 13 NA NA NA 9 57 52 43
## 14 NA NA NA 32 32 38 45
## 15 NA NA NA 54 7 3 6
## 16 NA NA NA 1 9 56 2
## 17 NA NA NA 55 44 48 57
## 18 NA NA NA 38 27 20 30
## 19 NA NA NA 45 45 23 44
## 20 NA NA NA 7 56 58 49
## 21 NA NA NA 37 13 25 27
## 22 NA NA NA 20 42 59 54
## 23 NA NA NA 57 38 36 55
## 24 NA NA NA 29 14 31 33
## 25 NA NA NA 30 37 1 3
## 26 NA NA NA 51 2 4 4
## 27 NA NA NA 22 11 35 26
## 28 NA NA NA 58 4 11 47
## 29 NA NA NA 43 35 26 41
## 30 NA NA NA 26 10 44 29
## 31 NA NA NA 47 47 53 56
## 32 NA NA NA 46 24 5 17
## 33 NA NA NA 19 49 34 36
## 34 NA NA NA 5 60 13 20
## 35 NA NA NA 33 16 19 25
## 36 NA NA NA 3 51 47 12
## 37 NA NA NA 11 46 21 19
## 38 NA NA NA 50 18 42 51
## 39 NA NA NA 53 39 2 10
## 40 NA NA NA 42 23 7 18
## 41 NA NA NA 14 6 22 7
## 42 NA NA NA 17 34 14 14
## 43 NA NA NA 23 3 40 16
## 44 NA NA NA 48 15 16 34
## 45 NA NA NA 10 1 55 5
## 46 NA NA NA 34 21 30 37
## 47 NA NA NA 52 50 12 46
## 48 NA NA NA 60 26 60 60
## 49 NA NA NA 8 43 37 22
## 50 NA NA NA 2 8 10 1
## 51 NA NA NA 49 52 43 53
## 52 NA NA NA 24 17 28 32
## 53 NA NA NA 36 22 27 39
## 54 NA NA NA 41 12 17 23
## 55 NA NA NA 28 19 18 24
## 56 NA NA NA 18 29 46 35
## 57 NA NA NA 35 59 32 52
## 58 NA NA NA 31 36 50 48
## 59 NA NA NA 27 48 6 13
## 60 NA NA NA 56 40 49 58
##从盈利能力来看,排在前面的分别是新坐标、中原内配、贝斯特、继峰股份.
##从股东回报来看,排在前面的分别是越博动力、兆丰股份、苏威孚、德尔股份.
##从运营能力来看,排在前面的分别是亚普股份、万向钱潮、众泰汽车、富奥B.
##从综合指标来看,排在前面的分别是新坐标、亚普股份、继峰股份、岱美股份.