Praktikum 9 APG : AF

Terkadang Ambisi Tinggi dapat Menjatuhkan ke Jurang Terdalam, Lakukan versi terbaik dan Tetaplah Bersyukur

My Image

Pengantar

A. deskripsi singkat

  • Tujuan penting dari analisis faktor adalah untuk mendeskripsikan hubungan kovarians di antara banyak variabel dalam beberapa kuantitas acak yang disebut factor, dimana factor merupakan suatu variable laten. Variabel laten adalah variable yang tidak bisa diamati secara langsung (unobservable) namun bisa diasumsikan bahwa factor bisa dijelaskan oleh sekumpulan variable yang bisa diamati langsung yang disebut sebagai variable manifes atau indikator.

  • metode analisis yang paling umum digunakan untuk membantu mengungkap hubungan antara variabel laten yang diasumsikan dan variabel manifes.

B. Jenis Analisis Faktor

  • EFA (Exploration Factor Analisis)
  • CFA (Confirmatory Factor Analisis)

C. Metode Dalam AF

Metode AF

Penerapan 1

Penerapan 2

susun matrix korelasi

kor = matrix(c(1,0.02,0.96,0.42,0.01,0.02,1,0.13,0.71,0.85,0.96,0.13,1,0.5,0.11,0.42,0.71,0.5,1,0.79,0.01,0.85,0.11,0.79,1),5,5)
kor
##      [,1] [,2] [,3] [,4] [,5]
## [1,] 1.00 0.02 0.96 0.42 0.01
## [2,] 0.02 1.00 0.13 0.71 0.85
## [3,] 0.96 0.13 1.00 0.50 0.11
## [4,] 0.42 0.71 0.50 1.00 0.79
## [5,] 0.01 0.85 0.11 0.79 1.00
eigen(kor)
## eigen() decomposition
## $values
## [1] 2.85309042 1.80633245 0.20449022 0.10240947 0.03367744
## 
## $vectors
##           [,1]        [,2]        [,3]       [,4]         [,5]
## [1,] 0.3314539 -0.60721643  0.09848524  0.1386643  0.701783012
## [2,] 0.4601593  0.39003172  0.74256408 -0.2821170  0.071674637
## [3,] 0.3820572 -0.55650828  0.16840896  0.1170037 -0.708716714
## [4,] 0.5559769  0.07806457 -0.60158211 -0.5682357  0.001656352
## [5,] 0.4725608  0.40418799 -0.22053713  0.7513990  0.009012569

Pemilihan jumlah common factor

Menghitung estimasi factor loading

#Membangun fungsi loading
loading=function(basis){
  vektor_eig=eigen(basis)$vectors
  nilai_eig=matrix(c(eigen(basis)$values),1,5) #5 karena ada 5 variabel
  sqnilai_eig=sqrt(nilai_eig)
  print("Estimated factor loadings, sesuaikan kebutuhan jumlah faktornya")
  for (i in 1:nrow(basis)) {
    lod=sqnilai_eig[,i]*vektor_eig[,i]
    print(lod)
    }
  hasil<-list(nilai_eig,vektor_eig,sqnilai_eig)
  names(hasil)<-c("Nilai eigen","Vektor eigen","sqnilai_eigen")
  return(hasil)
}
#Penggunaan
loading(kor)
## [1] "Estimated factor loadings, sesuaikan kebutuhan jumlah faktornya"
## [1] 0.5598618 0.7772594 0.6453364 0.9391057 0.7982069
## [1] -0.8160981  0.5242021 -0.7479464  0.1049187  0.5432281
## [1]  0.04453561  0.33579190  0.07615553 -0.27203901 -0.09972820
## [1]  0.04437464 -0.09028161  0.03744292 -0.18184384  0.24045880
## [1]  0.128787099  0.013153309 -0.130059531  0.000303964  0.001653934
## $`Nilai eigen`
##         [,1]     [,2]      [,3]      [,4]       [,5]
## [1,] 2.85309 1.806332 0.2044902 0.1024095 0.03367744
## 
## $`Vektor eigen`
##           [,1]        [,2]        [,3]       [,4]         [,5]
## [1,] 0.3314539 -0.60721643  0.09848524  0.1386643  0.701783012
## [2,] 0.4601593  0.39003172  0.74256408 -0.2821170  0.071674637
## [3,] 0.3820572 -0.55650828  0.16840896  0.1170037 -0.708716714
## [4,] 0.5559769  0.07806457 -0.60158211 -0.5682357  0.001656352
## [5,] 0.4725608  0.40418799 -0.22053713  0.7513990  0.009012569
## 
## $sqnilai_eigen
##          [,1]     [,2]     [,3]      [,4]      [,5]
## [1,] 1.689109 1.343999 0.452206 0.3200148 0.1835141

Menghitung Communalities dan Specific Variance

#Lengkap banget keyword search on help "fa"
library(psych)
library(GPArotation)
fa1 <- principal(kor,2,rotate = "none")
fa1
## Principal Components Analysis
## Call: principal(r = kor, nfactors = 2, rotate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
##    PC1   PC2   h2    u2 com
## 1 0.56  0.82 0.98 0.021 1.8
## 2 0.78 -0.52 0.88 0.121 1.8
## 3 0.65  0.75 0.98 0.024 2.0
## 4 0.94 -0.10 0.89 0.107 1.0
## 5 0.80 -0.54 0.93 0.068 1.8
## 
##                        PC1  PC2
## SS loadings           2.85 1.81
## Proportion Var        0.57 0.36
## Cumulative Var        0.57 0.93
## Proportion Explained  0.61 0.39
## Cumulative Proportion 0.61 1.00
## 
## Mean item complexity =  1.7
## Test of the hypothesis that 2 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0.03 
## 
## Fit based upon off diagonal values = 1
fa2 <- principal(kor,2,rotate="varimax")
fa2
## Principal Components Analysis
## Call: principal(r = kor, nfactors = 2, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
##    RC1   RC2   h2    u2 com
## 1 0.02  0.99 0.98 0.021 1.0
## 2 0.94 -0.01 0.88 0.121 1.0
## 3 0.13  0.98 0.98 0.024 1.0
## 4 0.84  0.43 0.89 0.107 1.5
## 5 0.97 -0.02 0.93 0.068 1.0
## 
##                        RC1  RC2
## SS loadings           2.54 2.12
## Proportion Var        0.51 0.42
## Cumulative Var        0.51 0.93
## Proportion Explained  0.54 0.46
## Cumulative Proportion 0.54 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 
## 
## Fit based upon off diagonal values = 1

Penerapan 3

  • Gunakan dataset investmen dari package”sandwich” untuk melakukan analisis faktor. Dataset investment terdiri dari tujuh kolom. Kolom yang kita gunakan untuk analisis faktor ini terdiri dari 6 kolom atau 6 variabel yaitu:

  • \(X_1\) = GNP, \(X_2\)=Investment, \(X_3\)=Price, \(X_4\) =Interest, \(X_5\) =RealGNP, \(X_6\) =RealInv

LOAD DATA

data(Investment, package="sandwich") 
Investment <- as.data.frame(Investment[,1:6])
head(Investment)
##     GNP Investment  Price Interest   RealGNP  RealInv
## 1 596.7       90.9 0.7167     3.23  832.5659 126.8313
## 2 637.7       97.4 0.7277     3.55  876.3227 133.8464
## 3 691.1      113.5 0.7436     4.04  929.3975 152.6358
## 4 756.0      125.7 0.7676     4.50  984.8880 163.7572
## 5 799.6      122.8 0.7906     4.19 1011.3838 155.3251
## 6 873.4      133.3 0.8254     5.16 1058.1536 161.4975

Standarisasi data

zinvestment<-data.frame(scale(Investment))
head(zinvestment)
##          GNP Investment      Price   Interest    RealGNP    RealInv
## 1 -1.1249182 -1.1478402 -1.0681849 -1.1527290 -1.6976136 -1.5795163
## 2 -1.0731174 -1.0958112 -1.0423975 -1.0421224 -1.4945241 -1.4017030
## 3 -1.0056499 -0.9669393 -1.0051229 -0.8727559 -1.2481860 -0.9254396
## 4 -0.9236530 -0.8692849 -0.9488595 -0.7137588 -0.9906364 -0.6435429
## 5 -0.8685673 -0.8924978 -0.8949404 -0.8209090 -0.8676606 -0.8572743
## 6 -0.7753258 -0.8084509 -0.8133584 -0.4856325 -0.6505861 -0.7008206

Eksplorasi Data

hist(zinvestment[,1], prob=TRUE, main="X1", xlab="X1",col="orange")
lines(density(zinvestment[,1]))

Interpretasi Terlihat bahwa GNP terdistribusi pada sebelah kiri.

hist(zinvestment[,2], prob=TRUE, main="Investment", xlab="X2",col="purple") 
lines(density(zinvestment[,2]))

hist(zinvestment[,3], prob=TRUE, main="Price", xlab="X3") 
lines(density(zinvestment[,3]))

hist(zinvestment[,4], prob=TRUE, main="Interest", xlab="X4",col="Blue") 
lines(density(zinvestment[,4]))

hist(zinvestment[,5], prob=TRUE, main="Real GNP", xlab="X5",col="violet") 
lines(density(zinvestment[,5]))

hist(zinvestment[,6], prob=TRUE, main="Real Investment", xlab="X6",col="green") 
lines(density(zinvestment[,6])) #

Uji Normalitas Data

  • Jika menggunakan MLE sebagai dasar penentuan faktor,maka asumsi normalitas diperlukan
  • Uji normalitas menggunakan uji mardia (multivariat normal)
  • \(H_0 : Data \space Berdistribusi \space Normal \space Multivariat\)
  • \(H_1 : Data\space Tidak \space Berdistribusi \space Normal\space Multivariat\)
library(MVN)
result <- mvn(data =zinvestment,mvnTest = "mardia")
result
## $multivariateNormality
##              Test          Statistic            p value Result
## 1 Mardia Skewness    81.264615451692 0.0153260019439198     NO
## 2 Mardia Kurtosis -0.298396533549195  0.765400534455039    YES
## 3             MVN               <NA>               <NA>     NO
## 
## $univariateNormality
##               Test   Variable Statistic   p value Normality
## 1 Anderson-Darling    GNP        0.7245    0.0493    NO    
## 2 Anderson-Darling Investment    0.9209    0.0154    NO    
## 3 Anderson-Darling   Price       0.7279    0.0483    NO    
## 4 Anderson-Darling  Interest     1.0673    0.0065    NO    
## 5 Anderson-Darling  RealGNP      0.3130    0.5204    YES   
## 6 Anderson-Darling  RealInv      0.3923    0.3449    YES   
## 
## $Descriptives
##             n          Mean Std.Dev      Median       Min      Max       25th
## GNP        20 -4.857226e-17       1 -0.29174606 -1.124918 2.003726 -0.7986361
## Investment 20 -8.113085e-17       1 -0.27015068 -1.147840 1.925874 -0.8236594
## Price      20  2.222614e-17       1 -0.33664292 -1.068185 2.101557 -0.8337539
## Interest   20 -1.671298e-16       1 -0.30416838 -1.152729 2.369403 -0.7137588
## RealGNP    20 -3.966554e-16       1  0.04832706 -1.697614 1.464388 -0.7048547
## RealInv    20 -5.407323e-17       1 -0.12800541 -1.579516 1.766614 -0.7249998
##                 75th        Skew   Kurtosis
## GNP        0.6224122  0.67604403 -0.9542482
## Investment 0.8438707  0.58362449 -1.2362325
## Price      0.5956306  0.70003321 -0.8708394
## Interest   0.3413253  0.99777586 -0.2452418
## RealGNP    0.8754060 -0.02656484 -1.3519458
## RealInv    0.7641314  0.29791744 -1.1619473

Bartlett test dan KMO

  • Uji Bartlet Sperisitas untuk menguji apakah setiap variabel saling independen atau tidak
  • \(H_0 : R=I\)
  • \(H_1 : R\neq I\)

library(psych)
library(Hmisc)
library(REdaS) 
bart_spher(zinvestment) 
##  Bartlett's Test of Sphericity
## 
## Call: bart_spher(x = zinvestment)
## 
##      X2 = 326.331
##      df = 15
## p-value < 2.22e-16
KMO(zinvestment)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = zinvestment)
## Overall MSA =  0.72
## MSA for each item = 
##        GNP Investment      Price   Interest    RealGNP    RealInv 
##       0.78       0.74       0.72       0.79       0.70       0.62
  • InterpretasiKMO Semua variabel memiliki nilai MSA>0.5 sehingga dianggap reliabel dan tidak di hapus.

  • Interpretasi bartlet test Nilai Pvalue <0.05 berarti pada tingkat signifikansi 5% terdapat cukup bukti bahwa matriks korelasi tidak sama dengan matriks identitas. Sehingga variabel tidak saling independent dan dapat digunakan analisis multivariat.

Menentukan Faktor

  • Menentukan banyak faktor dengan melihat nilai eigen dari covarians matriks data yang sudah di standarisasi
R<-cov(zinvestment) 
eigen<-eigen(R) 
eigen
## eigen() decomposition
## $values
## [1] 5.5173791599 0.3300284791 0.1151570916 0.0361705689 0.0010496037
## [6] 0.0002150969
## 
## $vectors
##           [,1]        [,2]        [,3]        [,4]        [,5]        [,6]
## [1,] 0.4194705 -0.22343018  0.32000450  0.13760165  0.33486088  0.73529214
## [2,] 0.4230439  0.05771685  0.07624479  0.53240938 -0.72647463 -0.02577197
## [3,] 0.4155335 -0.28516498  0.41772067  0.06975269  0.33813839 -0.67254686
## [4,] 0.3931743 -0.48686777 -0.77062786 -0.11413025  0.02673516 -0.02767562
## [5,] 0.4165632  0.21444001  0.18394897 -0.80469596 -0.31224573  0.04025371
## [6,] 0.3798674  0.76315392 -0.29931383  0.17938590  0.38412637 -0.06305315

Investment_fac<-factanal(factors=2,covmat=R) 
Investment_fac
## 
## Call:
## factanal(factors = 2, covmat = R)
## 
## Uniquenesses:
##        GNP Investment      Price   Interest    RealGNP    RealInv 
##      0.005      0.007      0.005      0.161      0.039      0.005 
## 
## Loadings:
##            Factor1 Factor2
## GNP        0.871   0.490  
## Investment 0.766   0.637  
## Price      0.892   0.449  
## Interest   0.812   0.424  
## RealGNP    0.710   0.676  
## RealInv    0.427   0.902  
## 
##                Factor1 Factor2
## SS loadings      3.487   2.297
## Proportion Var   0.581   0.383
## Cumulative Var   0.581   0.964
## 
## The degrees of freedom for the model is 4 and the fit was 3.7934

Penerapan 4

data2<-read.csv2(file="life_exp.csv",sep=",",row.names = 1)
data2
##                      m0 m25 m50 m75 w0 w25 w50 w75
## Algeria              63  51  30  13 67  54  34  15
## Cameroon             34  29  13   5 38  32  17   6
## Madagascar           38  30  17   7 38  34  20   7
## Mauritius            59  42  20   6 64  46  25   8
## Reunion              56  38  18   7 62  46  25  10
## Seychelles           62  44  24   7 69  50  28  14
## South Africa (C)     50  39  20   7 55  43  23   8
## South Africa (W)     65  44  22   7 72  50  27   9
## Tunisia              56  46  24  11 63  54  33  19
## Canada               69  47  24   8 75  53  29  10
## Costa Rica           65  48  26   9 68  50  27  10
## Dominican Rep.       64  50  28  11 66  51  29  11
## El Salvador          56  44  25  10 61  48  27  12
## Greenland            60  44  22   6 65  45  25   9
## Grenada              61  45  22   8 65  49  27  10
## Guatemala            49  40  22   9 51  41  23   8
## Honduras             59  42  22   6 61  43  22   7
## Jamaica              63  44  23   8 67  48  26   9
## Mexico               59  44  24   8 63  46  25   8
## Nicaragua            65  48  28  14 68  51  29  13
## Panama               65  48  26   9 67  49  27  10
## Trinidad (62)        64  63  21   7 68  47  25   9
## Trinidad (67)        64  43  21   6 68  47  24   8
## United States (66)   67  45  23   8 74  51  28  10
## United States (NW66) 61  40  21  10 67  46  25  11
## United States (W66)  68  46  23   8 75  52  29  10
## United States (67)   67  45  23   8 74  51  28  10
## Argentina            65  46  24   9 71  51  28  10
## Chile                59  43  23  10 66  49  27  12
## Colombia             58  44  24   9 62  47  25  10
## Ecuador              57  46  28   9 60  49  28  11

Metode Eigen

eigen(cor(data2))
## eigen() decomposition
## $values
## [1] 5.602410288 1.358181546 0.499327002 0.308125898 0.154689625 0.058633785
## [7] 0.012821625 0.005810232
## 
## $vectors
##            [,1]        [,2]         [,3]        [,4]        [,5]        [,6]
## [1,] -0.3573036  0.43236267 -0.003143393 -0.25023350  0.16312832  0.24146522
## [2,] -0.3351907  0.22761436  0.497028435  0.75069308  0.13858513 -0.05912424
## [3,] -0.3650204 -0.17751400  0.479769912 -0.29335863 -0.64408165  0.29213840
## [4,] -0.2851475 -0.54240974  0.320105609 -0.30414061  0.64625383 -0.10041047
## [5,] -0.3512527  0.43357565 -0.229867308 -0.20719739  0.23895366  0.18986315
## [6,] -0.4105755  0.09455088 -0.236580606 -0.06798696 -0.10088200 -0.26826816
## [7,] -0.4003568 -0.15152905 -0.256454233  0.03883396 -0.23306160 -0.66485275
## [8,] -0.3052803 -0.46437690 -0.495709541  0.38238885 -0.01021733  0.54104229
##              [,7]        [,8]
## [1,] -0.360147257  0.63886432
## [2,]  0.023806185 -0.04464621
## [3,]  0.010077073 -0.13683156
## [4,]  0.039654180 -0.01465378
## [5,] -0.003472231 -0.70689820
## [6,]  0.786018526  0.24884766
## [7,] -0.497207380 -0.07690542
## [8,] -0.054780089  0.05811047

Interpretasi Berdasarkan data niai eigen yang lebih dari 1 ada 2, maka usulan 2 faktor

sapply(1:3,function(f){
  factanal(data2,factors=f,method="mle")$PVAL
})
##    objective    objective    objective 
## 1.879555e-24 1.911514e-05 4.578204e-01
factanal(data2,factors = 3,method="mle",rotation = "varimax")
## 
## Call:
## factanal(x = data2, factors = 3, rotation = "varimax", method = "mle")
## 
## Uniquenesses:
##    m0   m25   m50   m75    w0   w25   w50   w75 
## 0.005 0.362 0.066 0.288 0.005 0.011 0.020 0.146 
## 
## Loadings:
##     Factor1 Factor2 Factor3
## m0  0.964   0.122   0.226  
## m25 0.646   0.169   0.438  
## m50 0.430   0.354   0.790  
## m75         0.525   0.656  
## w0  0.970   0.217          
## w25 0.764   0.556   0.310  
## w50 0.536   0.729   0.401  
## w75 0.156   0.867   0.280  
## 
##                Factor1 Factor2 Factor3
## SS loadings      3.375   2.082   1.640
## Proportion Var   0.422   0.260   0.205
## Cumulative Var   0.422   0.682   0.887
## 
## Test of the hypothesis that 3 factors are sufficient.
## The chi square statistic is 6.73 on 7 degrees of freedom.
## The p-value is 0.458

Penerapan 5

Load data

  • hasil survey Andy Field menggunakan SPSS Anxiety Questionnaire. SAQ-8 terdiri dari 8 pertanyaan berikut:
  1. Statistics makes me cry
  2. My friends will think I’m stupid for not being able to cope with SPSS
  3. Standard deviations excite me
  4. I dream that Pearson is attacking me with correlation coefficients
  5. I don’t understand statistics
  6. I have little experience of computers
  7. All computers hate me
  8. I have never been good at mathematics
library(haven)
data3<-read_spss(file="SAQ8.sav")
data3
## # A tibble: 2,571 x 8
##    q01                q02        q03     q04     q05     q06     q07     q08    
##    <dbl+lbl>          <dbl+lbl>  <dbl+l> <dbl+l> <dbl+l> <dbl+l> <dbl+l> <dbl+l>
##  1 2 [Agree]          1 [Strong~ 4 [Dis~ 2 [Agr~ 2 [Agr~ 2 [Agr~ 3 [Nei~ 1 [Str~
##  2 1 [Strongly agree] 1 [Strong~ 4 [Dis~ 3 [Nei~ 2 [Agr~ 2 [Agr~ 2 [Agr~ 2 [Agr~
##  3 2 [Agree]          3 [Neithe~ 2 [Agr~ 2 [Agr~ 4 [Dis~ 1 [Str~ 2 [Agr~ 2 [Agr~
##  4 3 [Neither]        1 [Strong~ 1 [Str~ 4 [Dis~ 3 [Nei~ 3 [Nei~ 4 [Dis~ 2 [Agr~
##  5 2 [Agree]          1 [Strong~ 3 [Nei~ 2 [Agr~ 2 [Agr~ 3 [Nei~ 3 [Nei~ 2 [Agr~
##  6 2 [Agree]          1 [Strong~ 3 [Nei~ 2 [Agr~ 4 [Dis~ 4 [Dis~ 4 [Dis~ 2 [Agr~
##  7 2 [Agree]          3 [Neithe~ 3 [Nei~ 2 [Agr~ 2 [Agr~ 2 [Agr~ 2 [Agr~ 2 [Agr~
##  8 2 [Agree]          2 [Agree]  3 [Nei~ 2 [Agr~ 2 [Agr~ 2 [Agr~ 2 [Agr~ 2 [Agr~
##  9 3 [Neither]        3 [Neithe~ 1 [Str~ 4 [Dis~ 5 [Str~ 3 [Nei~ 5 [Str~ 5 [Str~
## 10 2 [Agree]          4 [Disagr~ 4 [Dis~ 3 [Nei~ 2 [Agr~ 1 [Str~ 2 [Agr~ 2 [Agr~
## # ... with 2,561 more rows

Uji Reliabilitas dan validitas

  • Uji Reliabilitas menggunakan uji cronbach alpha
library(tidyverse)
data3<-data3 %>% mutate(total=q01+q02+q03+q04+q05+q06+q07+q08)
head(data3)
## # A tibble: 6 x 9
##   q01              q02     q03     q04     q05     q06     q07     q08     total
##   <dbl+lbl>        <dbl+l> <dbl+l> <dbl+l> <dbl+l> <dbl+l> <dbl+l> <dbl+l> <dbl>
## 1 2 [Agree]        1 [Str~ 4 [Dis~ 2 [Agr~ 2 [Agr~ 2 [Agr~ 3 [Nei~ 1 [Str~    17
## 2 1 [Strongly agr~ 1 [Str~ 4 [Dis~ 3 [Nei~ 2 [Agr~ 2 [Agr~ 2 [Agr~ 2 [Agr~    17
## 3 2 [Agree]        3 [Nei~ 2 [Agr~ 2 [Agr~ 4 [Dis~ 1 [Str~ 2 [Agr~ 2 [Agr~    18
## 4 3 [Neither]      1 [Str~ 1 [Str~ 4 [Dis~ 3 [Nei~ 3 [Nei~ 4 [Dis~ 2 [Agr~    21
## 5 2 [Agree]        1 [Str~ 3 [Nei~ 2 [Agr~ 2 [Agr~ 3 [Nei~ 3 [Nei~ 2 [Agr~    18
## 6 2 [Agree]        1 [Str~ 3 [Nei~ 2 [Agr~ 4 [Dis~ 4 [Dis~ 4 [Dis~ 2 [Agr~    22
datalatfact<-data.frame(sapply(data3,as.numeric))
head(datalatfact)
##   q01 q02 q03 q04 q05 q06 q07 q08 total
## 1   2   1   4   2   2   2   3   1    17
## 2   1   1   4   3   2   2   2   2    17
## 3   2   3   2   2   4   1   2   2    18
## 4   3   1   1   4   3   3   4   2    21
## 5   2   1   3   2   2   3   3   2    18
## 6   2   1   3   2   4   4   4   2    22
psych::alpha(datalatfact)
## Some items ( q02 q03 ) were negatively correlated with the total scale and 
## probably should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## 
## Reliability analysis   
## Call: psych::alpha(x = datalatfact)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean   sd median_r
##       0.68      0.67    0.68      0.18   2 0.0037  4.3 0.79     0.27
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.66  0.68  0.69
## Duhachek  0.67  0.68  0.68
## 
##  Reliability if an item is dropped:
##       raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q01        0.64      0.62    0.89      0.17 1.6   0.0043 0.112  0.26
## q02        0.69      0.71    0.89      0.24 2.5   0.0035 0.114  0.32
## q03        0.74      0.77    0.87      0.29 3.3   0.0030 0.063  0.32
## q04        0.63      0.61    0.87      0.16 1.5   0.0045 0.106  0.24
## q05        0.63      0.62    0.86      0.17 1.6   0.0044 0.112  0.25
## q06        0.62      0.62    0.83      0.17 1.6   0.0045 0.115  0.30
## q07        0.62      0.61    0.84      0.16 1.5   0.0046 0.103  0.24
## q08        0.64      0.62    0.87      0.17 1.7   0.0043 0.119  0.27
## total      0.46      0.47    0.57      0.10 0.9   0.0151 0.085  0.24
## 
##  Item statistics 
##          n raw.r std.r  r.cor r.drop mean   sd
## q01   2571  0.57  0.60  0.546  0.489  2.4 0.83
## q02   2571  0.16  0.19 -0.014  0.046  1.6 0.85
## q03   2571 -0.14 -0.15 -0.397 -0.280  2.6 1.08
## q04   2571  0.63  0.64  0.605  0.542  2.8 0.95
## q05   2571  0.60  0.60  0.537  0.501  2.7 0.96
## q06   2571  0.63  0.60  0.537  0.526  2.2 1.12
## q07   2571  0.66  0.64  0.607  0.559  2.9 1.10
## q08   2571  0.56  0.58  0.490  0.465  2.2 0.87
## total 2571  1.00  1.00  0.954  1.000 19.5 3.57
## 
## Non missing response frequency for each item
##        1    2    3    4    5 miss
## q01 0.11 0.52 0.29 0.07 0.02    0
## q02 0.56 0.31 0.08 0.04 0.01    0
## q03 0.19 0.26 0.34 0.17 0.03    0
## q04 0.05 0.37 0.36 0.17 0.05    0
## q05 0.06 0.43 0.29 0.18 0.04    0
## q06 0.27 0.44 0.13 0.10 0.06    0
## q07 0.07 0.34 0.26 0.24 0.09    0
## q08 0.15 0.58 0.19 0.06 0.03    0

Interpretasi semua pertanyaan memiliki nilai alpha >0.6 , berarti semua sudah reliabel

  • Uji Validitas menggunakan korelasi
Hmisc::rcorr(sapply(data3,as.numeric))
##         q01   q02   q03   q04   q05   q06   q07   q08 total
## q01    1.00 -0.10 -0.34  0.44  0.40  0.22  0.31  0.33  0.57
## q02   -0.10  1.00  0.32 -0.11 -0.12 -0.07 -0.16 -0.05  0.16
## q03   -0.34  0.32  1.00 -0.38 -0.31 -0.23 -0.38 -0.26 -0.14
## q04    0.44 -0.11 -0.38  1.00  0.40  0.28  0.41  0.35  0.63
## q05    0.40 -0.12 -0.31  0.40  1.00  0.26  0.34  0.27  0.60
## q06    0.22 -0.07 -0.23  0.28  0.26  1.00  0.51  0.22  0.63
## q07    0.31 -0.16 -0.38  0.41  0.34  0.51  1.00  0.30  0.66
## q08    0.33 -0.05 -0.26  0.35  0.27  0.22  0.30  1.00  0.56
## total  0.57  0.16 -0.14  0.63  0.60  0.63  0.66  0.56  1.00
## 
## n= 2571 
## 
## 
## P
##       q01    q02    q03    q04    q05    q06    q07    q08    total 
## q01          0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## q02   0.0000        0.0000 0.0000 0.0000 0.0002 0.0000 0.0119 0.0000
## q03   0.0000 0.0000        0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## q04   0.0000 0.0000 0.0000        0.0000 0.0000 0.0000 0.0000 0.0000
## q05   0.0000 0.0000 0.0000 0.0000        0.0000 0.0000 0.0000 0.0000
## q06   0.0000 0.0002 0.0000 0.0000 0.0000        0.0000 0.0000 0.0000
## q07   0.0000 0.0000 0.0000 0.0000 0.0000 0.0000        0.0000 0.0000
## q08   0.0000 0.0119 0.0000 0.0000 0.0000 0.0000 0.0000        0.0000
## total 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000

Interpretasi Semua pertanyaan valid

Uji Asumsi

Catatan KMO

#Kecukupan sampel
KMO(datalatfact[1:8])
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = datalatfact[1:8])
## Overall MSA =  0.82
## MSA for each item = 
##  q01  q02  q03  q04  q05  q06  q07  q08 
## 0.84 0.68 0.82 0.85 0.87 0.75 0.78 0.88

Interpretasi Semua variabel memiliki nilai MSA >0.5, berarti ukuran sampel cukup dan reliabel.

#Uji independensi H0: R=I, H1: R !=I
bart_spher(datalatfact[1:8])
##  Bartlett's Test of Sphericity
## 
## Call: bart_spher(x = datalatfact[1:8])
## 
##      X2 = 4157.283
##      df = 28
## p-value < 2.22e-16

Interpretasi Nilai Pvalue <0.05 berarti pada tingkat signifikansi 5% terdapat cukup bukti bahwa matriks korelasi tidak sama dengan matriks identitas. Sehingga variabel tidak saling independent dan dapat digunakan analisis multivariat.

Analisis Faktor

R2<-cor(datalatfact[1:8])
eigen(cor(datalatfact[1:8]))
## eigen() decomposition
## $values
## [1] 3.0565181 1.0669108 0.9583728 0.7364178 0.6215983 0.5707792 0.5430007
## [8] 0.4464023
## 
## $vectors
##            [,1]        [,2]        [,3]         [,4]       [,5]        [,6]
## [1,]  0.3770887 -0.13153453  0.40629889  0.186566596 -0.0807492  0.75222211
## [2,] -0.1713375 -0.83883879  0.02557898  0.107624897 -0.3681131 -0.22443355
## [3,] -0.3736902 -0.39564219 -0.08322941  0.074812976  0.5197953  0.33567005
## [4,]  0.4118076 -0.11509760  0.19572263  0.074679198 -0.3655488 -0.11795590
## [5,]  0.3715159 -0.09269101  0.21924373  0.536278728  0.5621253 -0.43127930
## [6,]  0.3270875 -0.17906337 -0.68970297  0.036278166  0.1351576  0.23286744
## [7,]  0.4105079 -0.04276093 -0.46269753 -0.007325367 -0.1147471 -0.06797019
## [8,]  0.3251009 -0.25842629  0.22624200 -0.808375645  0.3267107 -0.11115067
##             [,7]         [,8]
## [1,] -0.24044448  0.102199801
## [2,] -0.26243857 -0.001972779
## [3,]  0.51338883  0.211823375
## [4,]  0.76389623 -0.205440303
## [5,] -0.12452087 -0.015147512
## [6,] -0.07811714 -0.552581839
## [7,]  0.03384164  0.772385901
## [8,] -0.05877004 -0.017897849

Rekomendasi 3 atau 4 faktor

analfac<-factanal(datalatfact[1:8],factors = 4)
analfac
## 
## Call:
## factanal(x = datalatfact[1:8], factors = 4)
## 
## Uniquenesses:
##   q01   q02   q03   q04   q05   q06   q07   q08 
## 0.578 0.734 0.475 0.534 0.291 0.640 0.252 0.724 
## 
## Loadings:
##     Factor1 Factor2 Factor3 Factor4
## q01  0.583   0.132  -0.125   0.221 
## q02                  0.510         
## q03 -0.378  -0.196   0.578         
## q04  0.585   0.257  -0.156   0.181 
## q05  0.341   0.186  -0.130   0.736 
## q06  0.191   0.555           0.110 
## q07  0.261   0.792  -0.204   0.104 
## q08  0.476   0.198                 
## 
##                Factor1 Factor2 Factor3 Factor4
## SS loadings      1.273   1.134   0.699   0.664
## Proportion Var   0.159   0.142   0.087   0.083
## Cumulative Var   0.159   0.301   0.388   0.471
## 
## Test of the hypothesis that 4 factors are sufficient.
## The chi square statistic is 1.39 on 2 degrees of freedom.
## The p-value is 0.5

Interpretasi

  1. Statistics makes me cry
  2. My friends will think I’m stupid for not being able to cope with SPSS
  3. Standard deviations excite me
  4. I dream that Pearson is attacking me with correlation coefficients
  5. I don’t understand statistics
  6. I have little experience of computers
  7. All computers hate me
  8. I have never been good at mathematics
  • Nilai Pvalue(0.5)>0.05 berarti sudah memenuhi untuk analisis faktor
  • Faktor 1 terpilih q01 dan q04 (rotasi varimax) => Faktor Ketakutan pada statistik
  • Faktor 2 terpilih q07 dan q06 => Faktor ketidakahlian dalam pengoperasian komputer
  • Faktor 3 terpilih q03 => Rumus
  • Faktor 4 terpilih q06 => Ketidakpahaman
sapply(1:4,function(f){
  factanal(datalatfact[1:8],factors=f,method="mle")$PVAL
})
##     objective     objective     objective     objective 
## 2.143987e-104  2.627055e-35  5.466773e-02  5.000783e-01
factanal(datalatfact[1:8],factors = 4,method="mle",rotation = "varimax")
## 
## Call:
## factanal(x = datalatfact[1:8], factors = 4, rotation = "varimax",     method = "mle")
## 
## Uniquenesses:
##   q01   q02   q03   q04   q05   q06   q07   q08 
## 0.578 0.734 0.475 0.534 0.291 0.640 0.252 0.724 
## 
## Loadings:
##     Factor1 Factor2 Factor3 Factor4
## q01  0.583   0.132  -0.125   0.221 
## q02                  0.510         
## q03 -0.378  -0.196   0.578         
## q04  0.585   0.257  -0.156   0.181 
## q05  0.341   0.186  -0.130   0.736 
## q06  0.191   0.555           0.110 
## q07  0.261   0.792  -0.204   0.104 
## q08  0.476   0.198                 
## 
##                Factor1 Factor2 Factor3 Factor4
## SS loadings      1.273   1.134   0.699   0.664
## Proportion Var   0.159   0.142   0.087   0.083
## Cumulative Var   0.159   0.301   0.388   0.471
## 
## Test of the hypothesis that 4 factors are sufficient.
## The chi square statistic is 1.39 on 2 degrees of freedom.
## The p-value is 0.5

Penerapan 6 (Soal UAS)

Bagian A

Bagian B

Bagian C

Bagian D

Coba sendiri yak soal UAS tahun kemarin :))