安裝package{psych} install.packages(“psych”)
#install.package只需要進行一次
#每次打開R,都需要再library(psych)一次
library(psych) {psych}語法包 https://cran.r-project.org/web/packages/psych/psych.pdf
TFE:進食困擾問卷。IPA:活動量問卷。Attitude:態度(分運動或對吃的態度)。Subjective:主觀規範。行為控制能力、行為意圖、自我歧視問卷1、自我歧視問卷2…等,是老師提供的資料。
#head=T第一列是變相名稱,命名這個資料為dta
#"D://GSdata_20211113.csv",按照檔案所在處修改,檔案名建議為全英文,放在D槽比較不容易出錯
dta<-read.csv("D://GSdata_20211113.csv", head=T, fileEncoding = "UTF-8-BOM")
summary(dta) Placeofliving Age Gender Weight
Min. :1.000 Min. :17.0 Min. :1.000 Min. : 40.00
1st Qu.:1.000 1st Qu.:20.0 1st Qu.:1.000 1st Qu.: 52.00
Median :1.000 Median :21.0 Median :2.000 Median : 58.00
Mean :1.241 Mean :21.6 Mean :1.612 Mean : 61.74
3rd Qu.:1.000 3rd Qu.:23.0 3rd Qu.:2.000 3rd Qu.: 70.00
Max. :3.000 Max. :30.0 Max. :2.000 Max. :135.00
NA's :105
Height BMI Major TFEQ1r
Min. :145.0 Min. :15.35 Min. :1.000 Min. :1.000
1st Qu.:159.0 1st Qu.:19.53 1st Qu.:1.000 1st Qu.:2.000
Median :165.0 Median :21.60 Median :2.000 Median :2.000
Mean :165.5 Mean :22.39 Mean :1.738 Mean :2.415
3rd Qu.:171.0 3rd Qu.:24.30 3rd Qu.:2.000 3rd Qu.:3.000
Max. :185.0 Max. :47.86 Max. :2.000 Max. :4.000
TFEQ2r TFEQ3r TFEQ4r TFEQ5r
Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000
Median :2.000 Median :2.000 Median :2.000 Median :2.000
Mean :2.228 Mean :2.372 Mean :2.258 Mean :2.378
3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:3.000
Max. :4.000 Max. :4.000 Max. :4.000 Max. :4.000
TFEQ6r TFEQ7r TFEQ8r TFEQ9r
Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:2.000 1st Qu.:2.000 1st Qu.:1.000 1st Qu.:1.000
Median :2.000 Median :2.000 Median :2.000 Median :2.000
Mean :2.215 Mean :2.468 Mean :2.089 Mean :1.994
3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:3.000
Max. :4.000 Max. :4.000 Max. :4.000 Max. :4.000
TFEQ10r TFEQ11r TFEQ12r TFEQ13r
Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:1.000 1st Qu.:2.000 1st Qu.:1.000 1st Qu.:1.000
Median :2.000 Median :2.000 Median :2.000 Median :2.000
Mean :2.203 Mean :2.274 Mean :1.914 Mean :2.031
3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:2.000 3rd Qu.:2.000
Max. :4.000 Max. :4.000 Max. :4.000 Max. :4.000
TFEQ14 TFEQ15 TFEQ16 TFEQ17
Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000
Median :2.000 Median :2.000 Median :3.000 Median :2.000
Mean :2.258 Mean :2.292 Mean :2.637 Mean :2.012
3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:2.000
Max. :4.000 Max. :4.000 Max. :4.000 Max. :4.000
TFEQ18c IPAQ0 IPAQ1 IPAQ2 IPAQ3
Min. :1.000 Min. :1.000 Min. :0.000 Min. : 0 Min. :0.000
1st Qu.:2.000 1st Qu.:2.000 1st Qu.:0.000 1st Qu.: 0 1st Qu.:0.000
Median :2.000 Median :3.000 Median :1.000 Median : 15 Median :2.000
Mean :2.135 Mean :2.409 Mean :1.563 Mean : 35 Mean :1.991
3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:2.000 3rd Qu.: 60 3rd Qu.:3.000
Max. :4.000 Max. :3.000 Max. :7.000 Max. :300 Max. :7.000
IPAQ4 IPAQ5 IPAQ6 IPAQ7
Min. : 0.00 Min. :0.000 Min. : 0.00 Min. : 0.00
1st Qu.: 0.00 1st Qu.:4.000 1st Qu.: 20.00 1st Qu.: 6.00
Median : 24.00 Median :6.000 Median : 30.00 Median : 8.00
Mean : 34.78 Mean :5.348 Mean : 61.74 Mean : 19.85
3rd Qu.: 50.00 3rd Qu.:7.000 3rd Qu.: 60.00 3rd Qu.: 12.00
Max. :300.00 Max. :7.000 Max. :2046.00 Max. :360.00
IPAQ7c IPAQtotalMET IPAQexerciselevel Attitude1a
Min. : 0.000 Min. : 0 Min. :1.000 Min. :2.000
1st Qu.: 5.000 1st Qu.: 560 1st Qu.:1.000 1st Qu.:4.000
Median : 8.000 Median : 1386 Median :2.000 Median :5.000
Mean : 8.138 Mean : 2008 Mean :2.022 Mean :5.117
3rd Qu.:10.000 3rd Qu.: 2613 3rd Qu.:3.000 3rd Qu.:6.000
Max. :24.000 Max. :17598 Max. :3.000 Max. :7.000
Attitude1b Attitude1c Attitude1d Attitude1e Attitude1f
Min. :3.000 Min. :1.0 Min. :3.000 Min. :2.000 Min. :1.000
1st Qu.:6.000 1st Qu.:6.0 1st Qu.:5.000 1st Qu.:6.000 1st Qu.:4.000
Median :7.000 Median :7.0 Median :6.000 Median :7.000 Median :5.000
Mean :6.354 Mean :6.4 Mean :6.083 Mean :6.298 Mean :4.818
3rd Qu.:7.000 3rd Qu.:7.0 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:6.000
Max. :7.000 Max. :7.0 Max. :7.000 Max. :7.000 Max. :7.000
Attitude1g Attitude1h Attitude2a Attitude2b
Min. :1.000 Min. :3.000 Min. :2.000 Min. :3.000
1st Qu.:4.000 1st Qu.:6.000 1st Qu.:5.000 1st Qu.:6.000
Median :5.000 Median :7.000 Median :6.000 Median :7.000
Mean :4.935 Mean :6.274 Mean :5.471 Mean :6.289
3rd Qu.:6.000 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:7.000
Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
Attitude2c Attitude2d Attitude2e Attitude2f Attitude2g
Min. :3.000 Min. :3.00 Min. :4.000 Min. :1.000 Min. :1.000
1st Qu.:6.000 1st Qu.:5.00 1st Qu.:6.000 1st Qu.:4.000 1st Qu.:5.000
Median :7.000 Median :6.00 Median :7.000 Median :5.000 Median :6.000
Mean :6.363 Mean :6.12 Mean :6.292 Mean :5.298 Mean :5.557
3rd Qu.:7.000 3rd Qu.:7.00 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:7.000
Max. :7.000 Max. :7.00 Max. :7.000 Max. :7.000 Max. :7.000
Attitude2h Subjectivenorm1 Subjectivenorm2 Subjectivenorm3
Min. :3.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:6.000 1st Qu.:3.000 1st Qu.:4.000 1st Qu.:2.000
Median :7.000 Median :5.000 Median :5.000 Median :4.000
Mean :6.302 Mean :4.477 Mean :4.603 Mean :3.751
3rd Qu.:7.000 3rd Qu.:6.000 3rd Qu.:6.000 3rd Qu.:5.000
Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
Subjectivenorm4 Subjectivenorm5 Subjectivenorm6 PBC1
Min. :1.000 Min. :1.0 Min. :1.000 Min. :1.000
1st Qu.:2.000 1st Qu.:2.0 1st Qu.:3.000 1st Qu.:4.000
Median :3.000 Median :4.0 Median :4.000 Median :5.000
Mean :3.477 Mean :3.8 Mean :4.234 Mean :4.868
3rd Qu.:5.000 3rd Qu.:5.0 3rd Qu.:6.000 3rd Qu.:6.000
Max. :7.000 Max. :7.0 Max. :7.000 Max. :7.000
PBC2 PBC3 PBC4 PBC5
Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:5.000 1st Qu.:3.000 1st Qu.:4.000 1st Qu.:4.000
Median :6.000 Median :4.000 Median :5.000 Median :5.000
Mean :5.825 Mean :3.945 Mean :4.686 Mean :4.935
3rd Qu.:7.000 3rd Qu.:5.000 3rd Qu.:6.000 3rd Qu.:6.000
Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
PBC6 PBC7 PBC8 PBC9
Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:3.000 1st Qu.:3.000 1st Qu.:3.000 1st Qu.:3.000
Median :5.000 Median :5.000 Median :4.000 Median :4.000
Mean :4.582 Mean :4.655 Mean :4.188 Mean :4.385
3rd Qu.:6.000 3rd Qu.:6.000 3rd Qu.:5.000 3rd Qu.:6.000
Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
PBC10 Behavioralintention1 Behavioralintention2 Behavioralintention3
Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:3.000 1st Qu.:4.000 1st Qu.:4.000 1st Qu.:4.000
Median :5.000 Median :5.000 Median :5.000 Median :5.000
Mean :4.606 Mean :4.495 Mean :4.714 Mean :4.726
3rd Qu.:6.000 3rd Qu.:5.000 3rd Qu.:6.000 3rd Qu.:6.000
Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
Behavioralintention4 Behavioralintention5 Behavioralintention6 WBIS1
Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:3.000 1st Qu.:4.000 1st Qu.:4.000 1st Qu.:3.000
Median :5.000 Median :5.000 Median :5.000 Median :4.000
Mean :4.631 Mean :4.757 Mean :4.809 Mean :3.443
3rd Qu.:6.000 3rd Qu.:6.000 3rd Qu.:6.000 3rd Qu.:4.000
Max. :7.000 Max. :7.000 Max. :7.000 Max. :5.000
WBIS2 WBIS3 WBIS4 WBIS5
Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000
Median :3.000 Median :3.000 Median :4.000 Median :3.000
Mean :3.009 Mean :3.163 Mean :3.372 Mean :2.858
3rd Qu.:4.000 3rd Qu.:4.000 3rd Qu.:4.000 3rd Qu.:4.000
Max. :5.000 Max. :5.000 Max. :5.000 Max. :5.000
WBIS6 WBIS7 WBIS8 WBIS9
Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:2.000 1st Qu.:1.000 1st Qu.:1.000 1st Qu.:2.000
Median :3.000 Median :2.000 Median :2.000 Median :3.000
Mean :2.982 Mean :1.895 Mean :1.997 Mean :3.262
3rd Qu.:4.000 3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:4.000
Max. :5.000 Max. :5.000 Max. :5.000 Max. :5.000
WBIS10 WBIS11 WSSQ1 WSSQ2
Min. :1.000 Min. :1.000 Min. :0.000 Min. :0.000
1st Qu.:1.000 1st Qu.:1.000 1st Qu.:0.000 1st Qu.:1.000
Median :2.000 Median :2.000 Median :2.000 Median :3.000
Mean :2.182 Mean :2.169 Mean :1.803 Mean :2.557
3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:4.000
Max. :5.000 Max. :5.000 Max. :5.000 Max. :5.000
WSSQ3 WSSQ4 WSSQ5 WSSQ6
Min. :0.000 Min. :0.000 Min. :0.000 Min. :0.000
1st Qu.:1.000 1st Qu.:0.000 1st Qu.:1.000 1st Qu.:1.000
Median :2.000 Median :1.000 Median :2.000 Median :3.000
Mean :2.212 Mean :1.498 Mean :2.068 Mean :2.437
3rd Qu.:4.000 3rd Qu.:2.000 3rd Qu.:3.000 3rd Qu.:4.000
Max. :5.000 Max. :5.000 Max. :5.000 Max. :5.000
WSSQ7 WSSQ8 WSSQ9 WSSQ10
Min. :0.000 Min. :0.000 Min. :0.000 Min. :0.000
1st Qu.:2.000 1st Qu.:1.000 1st Qu.:1.000 1st Qu.:0.000
Median :3.000 Median :1.000 Median :1.000 Median :2.000
Mean :2.628 Mean :1.658 Mean :1.542 Mean :1.914
3rd Qu.:4.000 3rd Qu.:2.000 3rd Qu.:2.000 3rd Qu.:3.000
Max. :5.000 Max. :5.000 Max. :5.000 Max. :5.000
WSSQ11 WSSQ12 Weight_group WBIS1_r WBIS9_r
Min. :0.000 Min. :0.000 Min. :1.00 Min. :1.000 Min. :1.000
1st Qu.:0.000 1st Qu.:1.000 1st Qu.:1.00 1st Qu.:2.000 1st Qu.:2.000
Median :1.000 Median :1.000 Median :1.00 Median :2.000 Median :3.000
Mean :1.529 Mean :1.535 Mean :1.32 Mean :2.557 Mean :2.738
3rd Qu.:2.000 3rd Qu.:3.000 3rd Qu.:2.00 3rd Qu.:3.000 3rd Qu.:4.000
Max. :5.000 Max. :5.000 Max. :2.00 Max. :5.000 Max. :5.000
WBIS_Total_Score WSSQ_Q1to6_Total WSSQ_Q7to12_Total WSSQ_Total_Score
Min. :11.00 Min. : 0.00 Min. : 0.00 Min. : 0.00
1st Qu.:22.00 1st Qu.: 7.00 1st Qu.: 6.00 1st Qu.:12.00
Median :30.00 Median :14.00 Median :12.00 Median :25.00
Mean :28.92 Mean :12.58 Mean :10.81 Mean :23.38
3rd Qu.:36.00 3rd Qu.:18.00 3rd Qu.:16.00 3rd Qu.:33.00
Max. :55.00 Max. :28.00 Max. :28.00 Max. :53.00
TFEQ_Total Attitude_Eat Attitude_PA SubNorm_Eat
Min. :12.0 Min. : 47.92 Min. : 41.67 Min. : 0.00
1st Qu.:22.0 1st Qu.: 70.83 1st Qu.: 72.92 1st Qu.: 38.89
Median :26.0 Median : 81.25 Median : 83.33 Median : 55.56
Mean :26.7 Mean : 79.75 Mean : 82.69 Mean : 54.62
3rd Qu.:31.0 3rd Qu.: 89.58 3rd Qu.: 95.83 3rd Qu.: 72.22
Max. :45.0 Max. :100.00 Max. :100.00 Max. :100.00
SubNorm_PA PBC_Eat PBC_PA Int_Eat
Min. : 0.00 Min. : 0.00 Min. : 0.00 Min. : 0.00
1st Qu.: 27.78 1st Qu.: 58.33 1st Qu.: 37.50 1st Qu.: 50.00
Median : 50.00 Median : 66.67 Median : 58.33 Median : 66.67
Mean : 47.28 Mean : 67.97 Mean : 59.28 Mean : 60.75
3rd Qu.: 66.67 3rd Qu.: 79.17 3rd Qu.: 83.33 3rd Qu.: 77.78
Max. :100.00 Max. :100.00 Max. :100.00 Max. :100.00
Int_PA IPAQtotalMET2
Min. : 0.00 Min. : 0.00
1st Qu.: 50.00 1st Qu.: 5.60
Median : 66.67 Median : 13.86
Mean : 62.21 Mean : 20.08
3rd Qu.: 83.33 3rd Qu.: 26.13
Max. :100.00 Max. :175.98
檢測內在一致性,最常用的是Conbarch’s alpha。
#算資料的內在一致性,算Conbarch's alpha(TEFQ1r-TEFQ5r在資料的8~12column)
#指令alpha(資料名[row,column])
#這邊row空著(所有row的資料都納入)
#column依要分析的資料修改,這邊是第8到第12個column
#Conbarch's alpha算出來的存成dta_1
dta_1<-alpha(dta[,8:12])
summary(dta_1)
Reliability analysis
raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
0.65 0.65 0.64 0.27 1.9 0.03 2.3 0.56 0.34
看std.alpha值
std.alpha=0.65→感覺沒有太好(0.8以上比較好)
#列出Conbarch's alpha所有資料
dta_1
Reliability analysis
Call: alpha(x = dta[, 8:12])
raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
0.65 0.65 0.64 0.27 1.9 0.03 2.3 0.56 0.34
lower alpha upper 95% confidence boundaries
0.59 0.65 0.71
Reliability if an item is dropped:
raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
TFEQ1r 0.57 0.57 0.56 0.25 1.3 0.038 0.0454 0.22
TFEQ2r 0.73 0.74 0.69 0.41 2.8 0.024 0.0059 0.40
TFEQ3r 0.56 0.56 0.55 0.24 1.3 0.039 0.0515 0.23
TFEQ4r 0.51 0.51 0.48 0.21 1.1 0.044 0.0279 0.22
TFEQ5r 0.56 0.56 0.53 0.24 1.3 0.039 0.0340 0.24
Item statistics
n raw.r std.r r.cor r.drop mean sd
TFEQ1r 325 0.68 0.68 0.56 0.455 2.4 0.84
TFEQ2r 325 0.39 0.39 0.10 0.085 2.2 0.85
TFEQ3r 325 0.71 0.69 0.58 0.472 2.4 0.91
TFEQ4r 325 0.76 0.76 0.72 0.570 2.3 0.88
TFEQ5r 325 0.69 0.70 0.62 0.482 2.4 0.82
Non missing response frequency for each item
1 2 3 4 miss
TFEQ1r 0.14 0.39 0.38 0.09 0
TFEQ2r 0.21 0.42 0.31 0.06 0
TFEQ3r 0.19 0.36 0.34 0.11 0
TFEQ4r 0.21 0.41 0.30 0.08 0
TFEQ5r 0.14 0.41 0.37 0.07 0
Reliability if an item is dropped→刪掉Q2這題,剩下題目的(Q1,Q3,Q4) std.alpha=0.74
Item statistics→r.cor=0.1→發現TFEQ2r與其他題的相關性最低
Conbarch’s alpha被詬病的是每題的貢獻度一樣,有可能被低估
可以改作Mcdonald’s omega assumptions (內在一致性結果會比較高)
文章發表Conbarch’s alpha還是占一席之地,原因是:大家比較習慣的用法、和其他問卷的COnbarch’s alpha有可比性。
#需要加裝package{GPArotation}
library(GPArotation)
#指令改成omega
dta_2<-omega(dta[,8:12])summary(dta_2)Omega
omega(m = dta[, 8:12])
Alpha: 0.65
G.6: 0.64
Omega Hierarchical: 0.63
Omega H asymptotic: 0.87
Omega Total 0.73
With eigenvalues of:
g F1* F2* F3*
1.618 0.035 0.363 0.140
The degrees of freedom for the model is -2 and the fit was 0
The number of observations was 325 with Chi Square = 0 with prob < NA
The root mean square of the residuals is 0
The df corrected root mean square of the residuals is NA
Explained Common Variance of the general factor = 0.75
Total, General and Subset omega for each subset
g F1* F2* F3*
Omega total for total scores and subscales 0.73 0.72 0.37 0.41
Omega general for total scores and subscales 0.63 0.69 0.15 0.29
Omega group for total scores and subscales 0.07 0.02 0.23 0.13
看Omega Total=0.73 比Conbrach’s alpha高
沒辦法跳者選column,所以當要選column1.3.5.6.8,要先整理資料,把上面5個column聚集成連續的column 1~5。
探 索 性 因 素 分 析 (Exploratory Factor Analysis)—針對一組資料,在無限制因素個數與路徑參數的情況下,找出因素的結構
驗 證 性 因 素 分 析 (Confirmatory Factor Analysis)—事先提出因素結構,並允許因素間有相關,利用資料檢定此架構是否合理
傳統EPA的方式,會計算出eigenvalues,>1要留,但因切點設1,有時容易有爭議
Parallel Analysis會有simulated data(模擬資料):幫忙算要留幾個factor,通常當factor掉到小於simulated data時,就會不選,決定factor的數目用!比只看EPA eigenvalues似乎更客觀些
PCA→component:問卷中每個題目裡面都有屬於每一個factor,只是比例不同
FA=EFA→component:問卷中每個題目都分別”只”屬於一個factor,Parallel Analysis用模擬資料來做比較,得到的結果是「建議分成幾個factor」
PCA中的主成分是原始變量的線性組合,而EFA中的原始變量是公共因子的線性組合,因子是影響變量的潛在變量,變量中不能被因子所解釋的部分稱為誤差,因子和誤差均不能直接觀察到。(參考原文網址:https://kknews.cc/news/y8rgnvb.html)
#fa.parallel是parallel analysis的指令
#資料選第8~25 column
dta_3<-fa.parallel(dta[,8:25])Parallel analysis suggests that the number of factors = 3 and the number of components = 2
PCA:the number of components = 2 (x的線)
FA:number of factors = 3 (△的線)
因為FA的第三和第四個點就在紅線左右,所以有時會因simulation的資料選的不一樣,造成factors=3或factors=4
#factor analysis當因素>=2時,會有轉軸的問題
#rotate要設,讓factor更清楚落在哪個象限
#nfactors="多少",來自於fa.parallel的結果
#rotate="oblimin"斜交轉軸、="varimax"為正交轉軸
dta_4<-fa(dta[,8:25], nfactors=4, rotate = "oblimin")
dta_4Factor Analysis using method = minres
Call: fa(r = dta[, 8:25], nfactors = 4, rotate = "oblimin")
Standardized loadings (pattern matrix) based upon correlation matrix
MR1 MR2 MR3 MR4 h2 u2 com
TFEQ1r 0.27 0.09 0.14 0.42 0.44 0.56 2.1
TFEQ2r -0.04 0.82 0.03 0.00 0.69 0.31 1.0
TFEQ3r -0.07 -0.03 0.83 -0.01 0.62 0.38 1.0
TFEQ4r 0.20 0.13 0.40 0.30 0.51 0.49 2.7
TFEQ5r 0.26 0.08 0.28 0.24 0.37 0.63 3.1
TFEQ6r 0.02 0.04 0.72 -0.04 0.53 0.47 1.0
TFEQ7r 0.29 0.07 0.24 0.30 0.43 0.57 3.0
TFEQ8r 0.84 0.05 -0.10 0.04 0.66 0.34 1.0
TFEQ9r 0.69 0.02 0.12 0.03 0.61 0.39 1.1
TFEQ10r 0.14 -0.01 0.60 0.02 0.47 0.53 1.1
TFEQ11r 0.01 0.82 -0.04 0.03 0.66 0.34 1.0
TFEQ12r 0.13 0.46 -0.04 -0.22 0.30 0.70 1.6
TFEQ13r 0.71 -0.14 0.04 -0.04 0.53 0.47 1.1
TFEQ14 0.51 -0.11 0.13 -0.14 0.30 0.70 1.4
TFEQ15 0.03 0.32 0.01 -0.51 0.43 0.57 1.7
TFEQ16 -0.03 0.36 0.02 -0.40 0.37 0.63 2.0
TFEQ17 0.09 0.10 0.27 0.08 0.15 0.85 1.7
TFEQ18c -0.11 0.48 0.09 -0.11 0.29 0.71 1.3
MR1 MR2 MR3 MR4
SS loadings 2.62 2.21 2.34 1.19
Proportion Var 0.15 0.12 0.13 0.07
Cumulative Var 0.15 0.27 0.40 0.46
Proportion Explained 0.31 0.26 0.28 0.14
Cumulative Proportion 0.31 0.58 0.86 1.00
With factor correlations of
MR1 MR2 MR3 MR4
MR1 1.00 0.01 0.54 0.40
MR2 0.01 1.00 0.16 -0.26
MR3 0.54 0.16 1.00 0.33
MR4 0.40 -0.26 0.33 1.00
Mean item complexity = 1.6
Test of the hypothesis that 4 factors are sufficient.
The degrees of freedom for the null model are 153 and the objective function was 6.65 with Chi Square of 2109.19
The degrees of freedom for the model are 87 and the objective function was 0.66
The root mean square of the residuals (RMSR) is 0.04
The df corrected root mean square of the residuals is 0.05
The harmonic number of observations is 325 with the empirical chi square 127.33 with prob < 0.0032
The total number of observations was 325 with Likelihood Chi Square = 208.39 with prob < 5.9e-12
Tucker Lewis Index of factoring reliability = 0.89
RMSEA index = 0.065 and the 90 % confidence intervals are 0.054 0.077
BIC = -294.81
Fit based upon off diagonal values = 0.98
Measures of factor score adequacy
MR1 MR2 MR3 MR4
Correlation of (regression) scores with factors 0.92 0.92 0.91 0.81
Multiple R square of scores with factors 0.85 0.85 0.83 0.66
Minimum correlation of possible factor scores 0.71 0.69 0.66 0.32
summary(dta_4)
Factor analysis with Call: fa(r = dta[, 8:25], nfactors = 4, rotate = "oblimin")
Test of the hypothesis that 4 factors are sufficient.
The degrees of freedom for the model is 87 and the objective function was 0.66
The number of observations was 325 with Chi Square = 208.39 with prob < 5.9e-12
The root mean square of the residuals (RMSA) is 0.04
The df corrected root mean square of the residuals is 0.05
Tucker Lewis Index of factoring reliability = 0.89
RMSEA index = 0.065 and the 10 % confidence intervals are 0.054 0.077
BIC = -294.81
With factor correlations of
MR1 MR2 MR3 MR4
MR1 1.00 0.01 0.54 0.40
MR2 0.01 1.00 0.16 -0.26
MR3 0.54 0.16 1.00 0.33
MR4 0.40 -0.26 0.33 1.00
Varimax rotation:正交轉軸,當萃取出來的因素沒有相關性,固定在90度。
varimax rotation後不需要再做correlation(因為varimax的假設是factor之間沒有相關)
Oblimin rotation:斜交轉軸的其中一種(有很多種),因素之間有相關性(比較常見)
#這是貼上圖片的語法
knitr::include_graphics("oblimin_picture1.png")Standardized loadings (pattern matrix) based upon correlation matrix(選0.3以上)
例如:TFEQ1r屬於MR4這個factor、TEFQ2r屬於MR2這個factor
在factor loading若是負數,先看題目是不是反向題,應該調整反向題的計分後再做Parallel analysis
knitr::include_graphics("oblimin_picture2.png")斜交轉軸會有correlation
factoe correlation通常>0.8,會受到質疑
#以正交轉軸再做一次
dta_5<-fa(dta[,8:25], nfactors=4, rotate = "varimax")
dta_5Factor Analysis using method = minres
Call: fa(r = dta[, 8:25], nfactors = 4, rotate = "varimax")
Standardized loadings (pattern matrix) based upon correlation matrix
MR1 MR3 MR2 MR4 h2 u2 com
TFEQ1r 0.35 0.37 -0.11 0.40 0.44 0.56 3.1
TFEQ2r 0.12 -0.05 0.81 0.15 0.69 0.31 1.1
TFEQ3r 0.78 0.14 0.01 -0.01 0.62 0.38 1.1
TFEQ4r 0.55 0.34 0.01 0.31 0.51 0.49 2.3
TFEQ5r 0.43 0.36 -0.03 0.25 0.37 0.63 2.6
TFEQ6r 0.69 0.19 0.09 -0.01 0.53 0.47 1.2
TFEQ7r 0.43 0.39 -0.07 0.30 0.43 0.57 2.9
TFEQ8r 0.19 0.77 0.00 0.16 0.66 0.34 1.2
TFEQ9r 0.34 0.69 -0.02 0.13 0.61 0.39 1.6
TFEQ10r 0.62 0.28 0.01 0.04 0.47 0.53 1.4
TFEQ11r 0.07 -0.01 0.79 0.18 0.66 0.34 1.1
TFEQ12r -0.01 0.07 0.53 -0.07 0.30 0.70 1.1
TFEQ13r 0.24 0.67 -0.14 0.04 0.53 0.47 1.4
TFEQ14 0.23 0.49 -0.06 -0.06 0.30 0.70 1.5
TFEQ15 -0.09 -0.06 0.55 -0.35 0.43 0.57 1.8
TFEQ16 -0.07 -0.10 0.53 -0.26 0.37 0.63 1.6
TFEQ17 0.32 0.16 0.07 0.10 0.15 0.85 1.8
TFEQ18c 0.07 -0.11 0.52 -0.01 0.29 0.71 1.1
MR1 MR3 MR2 MR4
SS loadings 2.68 2.48 2.47 0.72
Proportion Var 0.15 0.14 0.14 0.04
Cumulative Var 0.15 0.29 0.42 0.46
Proportion Explained 0.32 0.30 0.30 0.09
Cumulative Proportion 0.32 0.62 0.91 1.00
Mean item complexity = 1.7
Test of the hypothesis that 4 factors are sufficient.
The degrees of freedom for the null model are 153 and the objective function was 6.65 with Chi Square of 2109.19
The degrees of freedom for the model are 87 and the objective function was 0.66
The root mean square of the residuals (RMSR) is 0.04
The df corrected root mean square of the residuals is 0.05
The harmonic number of observations is 325 with the empirical chi square 127.33 with prob < 0.0032
The total number of observations was 325 with Likelihood Chi Square = 208.39 with prob < 5.9e-12
Tucker Lewis Index of factoring reliability = 0.89
RMSEA index = 0.065 and the 90 % confidence intervals are 0.054 0.077
BIC = -294.81
Fit based upon off diagonal values = 0.98
Measures of factor score adequacy
MR1 MR3 MR2 MR4
Correlation of (regression) scores with factors 0.88 0.87 0.92 0.70
Multiple R square of scores with factors 0.77 0.76 0.85 0.49
Minimum correlation of possible factor scores 0.55 0.52 0.70 -0.02
summary(dta_5)
Factor analysis with Call: fa(r = dta[, 8:25], nfactors = 4, rotate = "varimax")
Test of the hypothesis that 4 factors are sufficient.
The degrees of freedom for the model is 87 and the objective function was 0.66
The number of observations was 325 with Chi Square = 208.39 with prob < 5.9e-12
The root mean square of the residuals (RMSA) is 0.04
The df corrected root mean square of the residuals is 0.05
Tucker Lewis Index of factoring reliability = 0.89
RMSEA index = 0.065 and the 10 % confidence intervals are 0.054 0.077
BIC = -294.81
#畫圖,dta_4為斜交轉軸結果,因素間有相關係數
#應該不會有負值,應為反向題造成,建議將反向題修正後再做
fa.diagram(dta_4)#畫圖,dta_5為正交轉軸結果,因素為獨立
fa.diagram(dta_5)若問卷有反向題,務必先轉回正向分數再處理!!!
WBIS1和WBIS9是反向題,先改成方向相同的分數
#第75 column(題目WBIS1,以"6-得分"改為正向的分數)
wb1<-6-dta[,75]
#83 column(題目WBIS9,以"6-得分"改為正向的分數)
wb9<-6-dta[,83]
#用summary檢查一下資料是否有異常
summary(wb1) Min. 1st Qu. Median Mean 3rd Qu. Max.
1.000 2.000 2.000 2.557 3.000 5.000
summary(wb9) Min. 1st Qu. Median Mean 3rd Qu. Max.
1.000 2.000 3.000 2.738 4.000 5.000
#創造新資料dta_wbis
#資料裡面column combine包括:[ wb1, dta第76~82 column, wb9, dta第84~85 column]
dta_wbis<-cbind(wb1, dta[,76:82],wb9,dta[84:85])
#看一下新資料dta_wbis
summary(dta_wbis) wb1 WBIS2 WBIS3 WBIS4
Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000
Median :2.000 Median :3.000 Median :3.000 Median :4.000
Mean :2.557 Mean :3.009 Mean :3.163 Mean :3.372
3rd Qu.:3.000 3rd Qu.:4.000 3rd Qu.:4.000 3rd Qu.:4.000
Max. :5.000 Max. :5.000 Max. :5.000 Max. :5.000
WBIS5 WBIS6 WBIS7 WBIS8
Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:2.000 1st Qu.:2.000 1st Qu.:1.000 1st Qu.:1.000
Median :3.000 Median :3.000 Median :2.000 Median :2.000
Mean :2.858 Mean :2.982 Mean :1.895 Mean :1.997
3rd Qu.:4.000 3rd Qu.:4.000 3rd Qu.:3.000 3rd Qu.:3.000
Max. :5.000 Max. :5.000 Max. :5.000 Max. :5.000
wb9 WBIS10 WBIS11
Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:2.000 1st Qu.:1.000 1st Qu.:1.000
Median :3.000 Median :2.000 Median :2.000
Mean :2.738 Mean :2.182 Mean :2.169
3rd Qu.:4.000 3rd Qu.:3.000 3rd Qu.:3.000
Max. :5.000 Max. :5.000 Max. :5.000
head(dta_wbis) wb1 WBIS2 WBIS3 WBIS4 WBIS5 WBIS6 WBIS7 WBIS8 wb9 WBIS10 WBIS11
1 4 4 5 4 3 4 2 4 4 4 4
2 3 4 4 5 3 4 2 2 4 2 1
3 2 4 4 5 3 5 5 5 1 5 5
4 2 3 4 4 3 3 2 2 3 2 2
5 2 4 4 4 3 4 3 1 3 1 1
6 4 3 4 4 3 3 1 1 3 3 3
#Conbarch's alpha
WBIS_1<-alpha(dta_wbis[,1:11])
summary(WBIS_1)
Reliability analysis
raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
0.91 0.91 0.93 0.47 9.7 0.0074 2.6 0.87 0.51
omega(WBIS, fm=“lm”)
WBIS_2<-omega(dta_wbis[,1:11])summary(WBIS_2)Omega
omega(m = dta_wbis[, 1:11])
Alpha: 0.91
G.6: 0.93
Omega Hierarchical: 0.78
Omega H asymptotic: 0.84
Omega Total 0.94
With eigenvalues of:
g F1* F2* F3*
4.87 1.77 0.00 0.54
The degrees of freedom for the model is 25 and the fit was 0.25
The number of observations was 325 with Chi Square = 78.56 with prob < 0
The root mean square of the residuals is 0.04
The df corrected root mean square of the residuals is 0.08
RMSEA and the 0.9 confidence intervals are 0.081 0.061 0.102
BIC = -66.04Explained Common Variance of the general factor = 0.68
Total, General and Subset omega for each subset
g F1* F2* F3*
Omega total for total scores and subscales 0.94 0.89 NA 0.89
Omega general for total scores and subscales 0.78 0.45 NA 0.86
Omega group for total scores and subscales 0.13 0.44 NA 0.03
WBIS_3<-fa.parallel(dta_wbis[,1:11])Parallel analysis suggests that the number of factors = 2 and the number of components = 2
#依據WBIS因素分析結果,nfactors設2
WBIS_4<-fa(dta_wbis[,1:11], nfactors=2, rotate = "oblimin")
WBIS_4Factor Analysis using method = minres
Call: fa(r = dta_wbis[, 1:11], nfactors = 2, rotate = "oblimin")
Standardized loadings (pattern matrix) based upon correlation matrix
MR1 MR2 h2 u2 com
wb1 0.44 -0.10 0.16 0.84 1.1
WBIS2 0.54 0.25 0.49 0.51 1.4
WBIS3 0.46 0.27 0.42 0.58 1.6
WBIS4 0.84 0.05 0.75 0.25 1.0
WBIS5 0.66 0.30 0.73 0.27 1.4
WBIS6 0.78 0.15 0.76 0.24 1.1
WBIS7 -0.07 0.86 0.69 0.31 1.0
WBIS8 -0.01 0.88 0.77 0.23 1.0
wb9 0.86 -0.25 0.56 0.44 1.2
WBIS10 0.26 0.63 0.65 0.35 1.3
WBIS11 0.12 0.76 0.69 0.31 1.0
MR1 MR2
SS loadings 3.57 3.11
Proportion Var 0.32 0.28
Cumulative Var 0.32 0.61
Proportion Explained 0.53 0.47
Cumulative Proportion 0.53 1.00
With factor correlations of
MR1 MR2
MR1 1.00 0.54
MR2 0.54 1.00
Mean item complexity = 1.2
Test of the hypothesis that 2 factors are sufficient.
The degrees of freedom for the null model are 55 and the objective function was 7.14 with Chi Square of 2281.36
The degrees of freedom for the model are 34 and the objective function was 0.38
The root mean square of the residuals (RMSR) is 0.04
The df corrected root mean square of the residuals is 0.04
The harmonic number of observations is 325 with the empirical chi square 44.48 with prob < 0.11
The total number of observations was 325 with Likelihood Chi Square = 121.3 with prob < 9.9e-12
Tucker Lewis Index of factoring reliability = 0.936
RMSEA index = 0.089 and the 90 % confidence intervals are 0.072 0.106
BIC = -75.35
Fit based upon off diagonal values = 1
Measures of factor score adequacy
MR1 MR2
Correlation of (regression) scores with factors 0.96 0.95
Multiple R square of scores with factors 0.91 0.91
Minimum correlation of possible factor scores 0.82 0.82
summary(WBIS_4)
Factor analysis with Call: fa(r = dta_wbis[, 1:11], nfactors = 2, rotate = "oblimin")
Test of the hypothesis that 2 factors are sufficient.
The degrees of freedom for the model is 34 and the objective function was 0.38
The number of observations was 325 with Chi Square = 121.3 with prob < 9.9e-12
The root mean square of the residuals (RMSA) is 0.04
The df corrected root mean square of the residuals is 0.04
Tucker Lewis Index of factoring reliability = 0.936
RMSEA index = 0.089 and the 10 % confidence intervals are 0.072 0.106
BIC = -75.35
With factor correlations of
MR1 MR2
MR1 1.00 0.54
MR2 0.54 1.00
WBIS_5<-fa(dta_wbis[,1:11], nfactors=2, rotate = "varimax")
WBIS_5Factor Analysis using method = minres
Call: fa(r = dta_wbis[, 1:11], nfactors = 2, rotate = "varimax")
Standardized loadings (pattern matrix) based upon correlation matrix
MR1 MR2 h2 u2 com
wb1 0.06 0.39 0.16 0.84 1.0
WBIS2 0.43 0.56 0.49 0.51 1.9
WBIS3 0.42 0.49 0.42 0.58 2.0
WBIS4 0.34 0.80 0.75 0.25 1.4
WBIS5 0.52 0.68 0.73 0.27 1.9
WBIS6 0.42 0.77 0.76 0.24 1.5
WBIS7 0.82 0.12 0.69 0.31 1.0
WBIS8 0.86 0.18 0.77 0.23 1.1
wb9 0.05 0.75 0.56 0.44 1.0
WBIS10 0.71 0.38 0.65 0.35 1.5
WBIS11 0.78 0.27 0.69 0.31 1.2
MR1 MR2
SS loadings 3.45 3.22
Proportion Var 0.31 0.29
Cumulative Var 0.31 0.61
Proportion Explained 0.52 0.48
Cumulative Proportion 0.52 1.00
Mean item complexity = 1.4
Test of the hypothesis that 2 factors are sufficient.
The degrees of freedom for the null model are 55 and the objective function was 7.14 with Chi Square of 2281.36
The degrees of freedom for the model are 34 and the objective function was 0.38
The root mean square of the residuals (RMSR) is 0.04
The df corrected root mean square of the residuals is 0.04
The harmonic number of observations is 325 with the empirical chi square 44.48 with prob < 0.11
The total number of observations was 325 with Likelihood Chi Square = 121.3 with prob < 9.9e-12
Tucker Lewis Index of factoring reliability = 0.936
RMSEA index = 0.089 and the 90 % confidence intervals are 0.072 0.106
BIC = -75.35
Fit based upon off diagonal values = 1
Measures of factor score adequacy
MR1 MR2
Correlation of (regression) scores with factors 0.94 0.93
Multiple R square of scores with factors 0.87 0.86
Minimum correlation of possible factor scores 0.75 0.71
summary(WBIS_5)
Factor analysis with Call: fa(r = dta_wbis[, 1:11], nfactors = 2, rotate = "varimax")
Test of the hypothesis that 2 factors are sufficient.
The degrees of freedom for the model is 34 and the objective function was 0.38
The number of observations was 325 with Chi Square = 121.3 with prob < 9.9e-12
The root mean square of the residuals (RMSA) is 0.04
The df corrected root mean square of the residuals is 0.04
Tucker Lewis Index of factoring reliability = 0.936
RMSEA index = 0.089 and the 10 % confidence intervals are 0.072 0.106
BIC = -75.35