# Nhập liệu
likert=file.choose()
datalikert=read.csv(likert,header=TRUE)
save(datalikert,file="datalikert.rda")
attach(datalikert)
is.data.frame(datalikert)
## [1] TRUE
head(datalikert)
##   STT GTINH TDO DTUOI TNHAP A1 A2 A3 A4 A5 B1 B2 B3 B4 C1 C2 C3 C4 D1 D2 D3 E1
## 1   1     2   4     1     3  5  5  3  5  4  3  2  3  4  5  5  4  4  4  5  4  2
## 2   2     2   2     2     3  3  3  3  5  4  4  5  4  5  2  3  3  2  3  4  3  3
## 3   3     2   4     1     2  3  3  3  3  3  4  4  4  5  4  4  3  4  3  4  4  4
## 4   4     1   4     2     2  5  3  3  4  4  5  5  5  5  1  2  4  3  5  4  1  3
## 5   5     2   3     1     1  5  3  3  5  4  3  3  3  3  3  4  3  3  4  4  3  4
## 6   6     1   4     2     2  5  3  3  5  4  3  4  3  3  3  4  5  3  2  3  3  4
##   E2 E3 E4 F1 F2 F3 F4 F5 Atb  Btb  Ctb  Dtb  Etb Ftb
## 1  3  3  4  4  5  3  4  5 4.4 3.00 4.50 4.33 3.00 4.2
## 2  4  3  4  3  3  3  4  5 3.6 4.50 2.50 3.33 3.50 3.6
## 3  3  3  4  4  4  4  4  5 3.0 4.25 3.75 3.67 3.50 4.2
## 4  4  3  4  5  5  4  4  5 3.8 5.00 2.50 3.33 3.50 4.6
## 5  3  3  4  2  5  4  4  5 4.0 3.00 3.25 3.67 3.50 4.0
## 6  4  3  4  3  3  5  4  5 4.0 3.25 3.75 2.67 3.75 4.0
dim(datalikert)
## [1] 198  36
# câu 12
library(psych)
ff=data.frame(A1,A2,A3,A4,A5,B1,B2,B3,B4,C1,C2,C3,C4,D1,D2,D3,E1,E2,E3,E4)
KMO(ff)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = ff)
## Overall MSA =  0.67
## MSA for each item = 
##   A1   A2   A3   A4   A5   B1   B2   B3   B4   C1   C2   C3   C4   D1   D2   D3 
## 0.77 0.70 0.61 0.75 0.68 0.78 0.81 0.53 0.56 0.58 0.53 0.86 0.84 0.72 0.74 0.88 
##   E1   E2   E3   E4 
## 0.60 0.82 0.74 0.61
cortest.bartlett(ff)
## R was not square, finding R from data
## $chisq
## [1] 5048.334
## 
## $p.value
## [1] 0
## 
## $df
## [1] 190
principal(ff,cor=TRUE,nfactors=20,ratate="none")
## Principal Components Analysis
## Call: principal(r = ff, nfactors = 20, cor = TRUE, ratate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
##      RC1   RC3   RC4   RC2   RC5  RC10   RC9   RC6  RC11   RC8   RC7  RC13
## A1  0.51  0.10  0.01  0.05 -0.05  0.04 -0.03  0.02  0.01  0.85 -0.04  0.06
## A2  0.96 -0.02  0.04  0.03  0.03  0.07  0.00 -0.05 -0.02  0.09 -0.02  0.03
## A3  0.96 -0.02  0.05  0.02  0.02  0.05 -0.01 -0.05 -0.03  0.09  0.00  0.03
## A4  0.87 -0.08  0.00  0.00 -0.05  0.02 -0.07 -0.01 -0.05  0.13 -0.04 -0.05
## A5  0.95 -0.09  0.03  0.00  0.02  0.02 -0.05  0.11  0.02  0.09 -0.05 -0.01
## B1  0.02 -0.04  0.97  0.02  0.05  0.06 -0.01  0.04  0.03 -0.02 -0.03 -0.01
## B2  0.00  0.02  0.48  0.04  0.05  0.08  0.01  0.86  0.10  0.02 -0.02  0.08
## B3  0.03 -0.09  0.94  0.03  0.08  0.05  0.02  0.25  0.07  0.01 -0.04  0.04
## B4  0.05 -0.06  0.97  0.04  0.01  0.07  0.01  0.08 -0.02  0.02  0.00  0.01
## C1  0.03 -0.02  0.05  0.94  0.13  0.09  0.13  0.07  0.13 -0.03 -0.05  0.12
## C2  0.03  0.00  0.01  0.97  0.07  0.06  0.09 -0.05  0.09  0.05  0.01  0.03
## C3 -0.08  0.06  0.10  0.50  0.09  0.11  0.11  0.12  0.81  0.01  0.03  0.17
## C4  0.03  0.03  0.07  0.58  0.12  0.06  0.16  0.13  0.25  0.09  0.00  0.72
## D1  0.02  0.01  0.11  0.22  0.92  0.25  0.15  0.04  0.07 -0.04 -0.01  0.06
## D2  0.15  0.02  0.17  0.17  0.28  0.89  0.18  0.07  0.08  0.03 -0.01  0.03
## D3 -0.10  0.20  0.02  0.31  0.18  0.19  0.87  0.01  0.09 -0.03  0.11  0.10
## E1 -0.05  0.98 -0.05  0.00  0.00  0.00  0.06  0.02  0.01  0.04  0.09  0.01
## E2 -0.10  0.51 -0.08 -0.05 -0.02 -0.01  0.12 -0.02  0.02 -0.04  0.84  0.00
## E3 -0.01  0.98 -0.06  0.00  0.03  0.02  0.07 -0.01  0.03  0.00  0.12  0.03
## E4 -0.06  0.98 -0.06  0.00 -0.01  0.01  0.04  0.00  0.01  0.05  0.09 -0.01
##     RC12  RC15  RC14  RC17  RC18  RC16  RC19  RC20 h2       u2 com
## A1  0.02  0.00  0.00  0.00  0.00  0.00  0.00  0.00  1  3.3e-16 1.7
## A2 -0.17 -0.11 -0.03  0.01 -0.01  0.12  0.00 -0.01  1 -4.4e-16 1.2
## A3 -0.17 -0.11  0.01  0.00 -0.01 -0.12  0.00  0.01  1  1.6e-15 1.2
## A4  0.45  0.01  0.00  0.00  0.00  0.00  0.00  0.00  1  4.4e-16 1.6
## A5  0.12  0.23  0.02  0.00  0.02  0.00  0.00  0.00  1  1.0e-15 1.2
## B1  0.02  0.01  0.22 -0.01 -0.03 -0.01  0.00  0.00  1  3.3e-16 1.1
## B2  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  1  1.3e-15 1.6
## B3 -0.02  0.06 -0.09  0.04  0.14  0.00  0.00  0.01  1  4.4e-16 1.3
## B4  0.00 -0.06 -0.13 -0.02 -0.10  0.01  0.00 -0.01  1  7.8e-16 1.1
## C1 -0.06 -0.01 -0.03  0.14  0.03  0.01  0.01  0.00  1  3.3e-16 1.3
## C2  0.05  0.01  0.02 -0.12 -0.03 -0.01 -0.01  0.00  1  2.2e-16 1.1
## C3 -0.01  0.00  0.00  0.00  0.00  0.00  0.00  0.00  1 -2.2e-16 2.0
## C4 -0.02  0.00  0.00  0.00  0.00  0.00  0.00  0.00  1  7.8e-16 2.5
## D1 -0.01  0.00  0.00  0.00  0.00  0.00  0.00  0.00  1  3.3e-16 1.4
## D2  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  1  7.8e-16 1.6
## D3 -0.01  0.00  0.00  0.00  0.00  0.00  0.00  0.00  1  0.0e+00 1.7
## E1  0.01  0.00  0.01 -0.01  0.03 -0.05 -0.05  0.08  1  1.3e-15 1.1
## E2 -0.01  0.00  0.00  0.00  0.00  0.00  0.00  0.00  1  5.6e-16 1.8
## E3 -0.09 -0.02  0.02  0.03  0.00  0.00  0.10  0.00  1  1.3e-15 1.1
## E4  0.06  0.01 -0.02 -0.01 -0.03  0.05 -0.05 -0.08  1  7.8e-16 1.1
## 
##                        RC1  RC3  RC4  RC2  RC5 RC10  RC9  RC6 RC11  RC8  RC7
## SS loadings           3.84 3.24 3.07 2.61 1.02 0.95 0.91 0.88 0.78 0.78 0.76
## Proportion Var        0.19 0.16 0.15 0.13 0.05 0.05 0.05 0.04 0.04 0.04 0.04
## Cumulative Var        0.19 0.35 0.51 0.64 0.69 0.74 0.78 0.82 0.86 0.90 0.94
## Proportion Explained  0.19 0.16 0.15 0.13 0.05 0.05 0.05 0.04 0.04 0.04 0.04
## Cumulative Proportion 0.19 0.35 0.51 0.64 0.69 0.74 0.78 0.82 0.86 0.90 0.94
##                       RC13 RC12 RC15 RC14 RC17 RC18 RC16 RC19 RC20
## SS loadings           0.60 0.29 0.09 0.07 0.04 0.04 0.03 0.02 0.01
## Proportion Var        0.03 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## Cumulative Var        0.97 0.99 0.99 0.99 1.00 1.00 1.00 1.00 1.00
## Proportion Explained  0.03 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## Cumulative Proportion 0.97 0.99 0.99 0.99 1.00 1.00 1.00 1.00 1.00
## 
## Mean item complexity =  1.4
## Test of the hypothesis that 20 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0 
##  with the empirical chi square  0  with prob <  NA 
## 
## Fit based upon off diagonal values = 1
principal(ff,cor=TRUE,nfactors=5,ratate="none")
## Principal Components Analysis
## Call: principal(r = ff, nfactors = 5, cor = TRUE, ratate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
##      RC1   RC3   RC4   RC2   RC5   h2    u2 com
## A1  0.72  0.12  0.03  0.13 -0.12 0.57 0.430 1.2
## A2  0.94 -0.05  0.02  0.00  0.12 0.90 0.099 1.0
## A3  0.94 -0.04  0.02 -0.02  0.10 0.90 0.103 1.0
## A4  0.90 -0.12 -0.01 -0.06 -0.03 0.83 0.169 1.0
## A5  0.94 -0.14  0.06 -0.02  0.04 0.90 0.095 1.1
## B1  0.02 -0.07  0.93  0.01  0.08 0.88 0.121 1.0
## B2  0.00  0.03  0.73  0.16  0.05 0.56 0.437 1.1
## B3  0.03 -0.11  0.97  0.06  0.10 0.96 0.036 1.1
## B4  0.06 -0.08  0.94  0.02  0.08 0.90 0.099 1.0
## C1  0.03 -0.06  0.04  0.92  0.21 0.89 0.110 1.1
## C2  0.06 -0.04 -0.04  0.90  0.12 0.82 0.176 1.1
## C3 -0.09  0.07  0.16  0.78  0.14 0.68 0.323 1.2
## C4  0.05  0.04  0.11  0.84  0.14 0.75 0.251 1.1
## D1 -0.01 -0.02  0.11  0.24  0.82 0.74 0.256 1.2
## D2  0.18  0.01  0.21  0.19  0.80 0.76 0.245 1.4
## D3 -0.15  0.29 -0.01  0.43  0.58 0.63 0.368 2.6
## E1 -0.01  0.98 -0.02  0.03  0.00 0.95 0.047 1.0
## E2 -0.14  0.73 -0.09 -0.04  0.07 0.56 0.440 1.1
## E3  0.01  0.97 -0.04  0.04  0.05 0.95 0.048 1.0
## E4 -0.02  0.97 -0.04  0.03 -0.01 0.94 0.055 1.0
## 
##                        RC1  RC3  RC4  RC2  RC5
## SS loadings           4.08 3.54 3.34 3.30 1.83
## Proportion Var        0.20 0.18 0.17 0.17 0.09
## Cumulative Var        0.20 0.38 0.55 0.71 0.80
## Proportion Explained  0.25 0.22 0.21 0.21 0.11
## Cumulative Proportion 0.25 0.47 0.68 0.89 1.00
## 
## Mean item complexity =  1.2
## Test of the hypothesis that 5 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0.03 
##  with the empirical chi square  71.75  with prob <  0.99 
## 
## Fit based upon off diagonal values = 0.99
principal(ff,nfactors=5,ratate="varimax")
## Principal Components Analysis
## Call: principal(r = ff, nfactors = 5, ratate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
##      RC1   RC3   RC4   RC2   RC5   h2    u2 com
## A1  0.72  0.12  0.03  0.13 -0.12 0.57 0.430 1.2
## A2  0.94 -0.05  0.02  0.00  0.12 0.90 0.099 1.0
## A3  0.94 -0.04  0.02 -0.02  0.10 0.90 0.103 1.0
## A4  0.90 -0.12 -0.01 -0.06 -0.03 0.83 0.169 1.0
## A5  0.94 -0.14  0.06 -0.02  0.04 0.90 0.095 1.1
## B1  0.02 -0.07  0.93  0.01  0.08 0.88 0.121 1.0
## B2  0.00  0.03  0.73  0.16  0.05 0.56 0.437 1.1
## B3  0.03 -0.11  0.97  0.06  0.10 0.96 0.036 1.1
## B4  0.06 -0.08  0.94  0.02  0.08 0.90 0.099 1.0
## C1  0.03 -0.06  0.04  0.92  0.21 0.89 0.110 1.1
## C2  0.06 -0.04 -0.04  0.90  0.12 0.82 0.176 1.1
## C3 -0.09  0.07  0.16  0.78  0.14 0.68 0.323 1.2
## C4  0.05  0.04  0.11  0.84  0.14 0.75 0.251 1.1
## D1 -0.01 -0.02  0.11  0.24  0.82 0.74 0.256 1.2
## D2  0.18  0.01  0.21  0.19  0.80 0.76 0.245 1.4
## D3 -0.15  0.29 -0.01  0.43  0.58 0.63 0.368 2.6
## E1 -0.01  0.98 -0.02  0.03  0.00 0.95 0.047 1.0
## E2 -0.14  0.73 -0.09 -0.04  0.07 0.56 0.440 1.1
## E3  0.01  0.97 -0.04  0.04  0.05 0.95 0.048 1.0
## E4 -0.02  0.97 -0.04  0.03 -0.01 0.94 0.055 1.0
## 
##                        RC1  RC3  RC4  RC2  RC5
## SS loadings           4.08 3.54 3.34 3.30 1.83
## Proportion Var        0.20 0.18 0.17 0.17 0.09
## Cumulative Var        0.20 0.38 0.55 0.71 0.80
## Proportion Explained  0.25 0.22 0.21 0.21 0.11
## Cumulative Proportion 0.25 0.47 0.68 0.89 1.00
## 
## Mean item complexity =  1.2
## Test of the hypothesis that 5 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0.03 
##  with the empirical chi square  71.75  with prob <  0.99 
## 
## Fit based upon off diagonal values = 0.99
# Nhận xét: Số nhân tố được trích từ 5 nhóm nhân tố
# Giá trị Eigenvalue = 1,83 > 1 => đạt yêu cầu
# Giá trị tổng phương sai trích = 0,80 > 50% => đạt yêu cầu
# Cấu trúc nhân tố phù hợp với dữ liệu ban đầu vì các biến/thang đo sắp xếp theo đúng nhóm nhân tố