題項分析

載入套件

library(psychometric)

進行題項分析

item<-read.csv("D:/104/ML_R/scale_test.csv", 
                header=TRUE, sep=",")
head(item)
##   self_1 self_2 self_3 self_4 self_5 self_6 self_7 self_8 self_9 self_10
## 1      4      2      4      4      1      2      4      3      1       4
## 2      4      2      4      4      2      1      4      3      2       4
## 3      4      2      5      5      2      2      4      4      1       4
## 4      4      2      4      4      1      1      4      4      1       4
## 5      4      2      3      3      2      3      4      4      2       3
## 6      4      2      4      3      2      1      4      3      1       4
item1<- item.exam(item[,1:10], discrim = TRUE)
head(item1)
##        Sample.SD Item.total Item.Tot.woi Difficulty Discrimination
## self_1 0.7559976  0.3412282   0.11353359   3.477901      0.5666667
## self_2 0.8914767  0.3682440   0.09903319   2.129834      0.6166667
## self_3 0.7225804  0.4887244   0.29088131   3.574586      0.7583333
## self_4 0.7302545  0.5104715   0.31422734   3.604972      0.8166667
## self_5 0.8950874  0.2573135  -0.02019437   2.187845      0.4583333
## self_6 0.9513181  0.3621139   0.07264161   2.160221      0.5666667
##        Item.Criterion Item.Reliab Item.Rel.woi Item.Validity
## self_1             NA   0.2576111   0.08571249            NA
## self_2             NA   0.3278272   0.08816376            NA
## self_3             NA   0.3526546   0.20989461            NA
## self_4             NA   0.3722588   0.22914876            NA
## self_5             NA   0.2299997  -0.01805074            NA
## self_6             NA   0.3440093   0.06900976            NA

Sample.SD–> 題項標準差

Item.total–>題項和量表總分的相關

Item.Tot.woi–>題項和量表總分的相關(扣掉本身題項分數)

Difficulty–>均值

Discrimination–>前25%-33%(U)和後25%-33%(L)之差異

             U和L都答對---->0
             
             U全對L都錯---->1
             
             U全錯L都對---->-1
             

Item.Reliab Item reliability index–>題項一致性信度

Item.Rel.woi Item reliability index–>題項一致性信度(扣掉本身題項分數)

題目信度

item2 <-item1$Item.Rel.woi

先卸下套件

題目刪除後全量表信度變化

detach("package:psychometric", unload = TRUE)
library(psych)
item3 <- alpha(item[,1:10],check.keys=TRUE)$alpha.drop[,'raw_alpha']

把分析結果合起來

item4 <- as.data.frame(t(rbind(item3,  item2)))
names(item4) <- c('總量表信度(刪題)',  '題目信度')
head(item4)
##   總量表信度(刪題)    題目信度
## 1          0.8384603  0.08571249
## 2          0.8453470  0.08816376
## 3          0.8408557  0.20989461
## 4          0.8462150  0.22914876
## 5          0.8384205 -0.01805074
## 6          0.8455503  0.06900976

加上題目名字、顯示三位

row.names(item4) <- names(item[,1:10])
round(item4, 3)
##         總量表信度(刪題) 題目信度
## self_1               0.838    0.086
## self_2               0.845    0.088
## self_3               0.841    0.210
## self_4               0.846    0.229
## self_5               0.838   -0.018
## self_6               0.846    0.069
## self_7               0.849    0.204
## self_8               0.876    0.275
## self_9               0.843    0.014
## self_10              0.835    0.067

因素分析

利用PCA探索因素數量

fa.parallel(item[, 1:10], fa = "pc", show.legend = FALSE)

## Parallel analysis suggests that the number of factors =  NA  and the number of components =  2

建議因素數是2,看看因素結構

print.psych(fa(item[, 1:10], nfactor = 2, fm = "pa", rotate = "promax"), cut = .3)
## Factor Analysis using method =  pa
## Call: fa(r = item[, 1:10], nfactors = 2, rotate = "promax", fm = "pa")
## Standardized loadings (pattern matrix) based upon correlation matrix
##           PA2   PA1   h2   u2 com
## self_1   0.60       0.55 0.45 1.3
## self_2         0.84 0.64 0.36 1.0
## self_3   0.81       0.65 0.35 1.0
## self_4   0.79       0.56 0.44 1.0
## self_5         0.72 0.61 0.39 1.0
## self_6         0.83 0.64 0.36 1.0
## self_7   0.65       0.42 0.58 1.0
## self_8   0.50       0.18 0.82 1.4
## self_9         0.66 0.51 0.49 1.0
## self_10  0.56       0.56 0.44 1.4
## 
##                        PA2  PA1
## SS loadings           2.73 2.59
## Proportion Var        0.27 0.26
## Cumulative Var        0.27 0.53
## Proportion Explained  0.51 0.49
## Cumulative Proportion 0.51 1.00
## 
##  With factor correlations of 
##       PA2   PA1
## PA2  1.00 -0.54
## PA1 -0.54  1.00
## 
## Mean item complexity =  1.1
## Test of the hypothesis that 2 factors are sufficient.
## 
## The degrees of freedom for the null model are  45  and the objective function was  4.46 with Chi Square of  1589.85
## The degrees of freedom for the model are 26  and the objective function was  0.21 
## 
## The root mean square of the residuals (RMSR) is  0.03 
## The df corrected root mean square of the residuals is  0.04 
## 
## The harmonic number of observations is  362 with the empirical chi square  37.67  with prob <  0.065 
## The total number of observations was  362  with MLE Chi Square =  74.71  with prob <  1.3e-06 
## 
## Tucker Lewis Index of factoring reliability =  0.945
## RMSEA index =  0.073  and the 90 % confidence intervals are  0.053 0.091
## BIC =  -78.47
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 PA2  PA1
## Correlation of scores with factors             0.93 0.93
## Multiple R square of scores with factors       0.86 0.87
## Minimum correlation of possible factor scores  0.72 0.74