#輸入data,並將其命名為dta
data(bfi)

#將bfi中的負向題分數轉為正向題計分
bfi[,c(1,9, 10, 11, 12, 22)] = 7 - bfi[,c(1,9, 10, 11, 12, 22)]

dta <- bfi
#檢視資料結構
str(dta)
## 'data.frame':    2800 obs. of  28 variables:
##  $ A1       : num  5 5 2 3 5 1 5 3 3 5 ...
##  $ A2       : int  4 4 4 4 3 6 5 3 3 5 ...
##  $ A3       : int  3 5 5 6 3 5 5 1 6 6 ...
##  $ A4       : int  4 2 4 5 4 6 3 5 3 6 ...
##  $ A5       : int  4 5 4 5 5 5 5 1 3 5 ...
##  $ C1       : int  2 5 4 4 4 6 5 3 6 6 ...
##  $ C2       : int  3 4 5 4 4 6 4 2 6 5 ...
##  $ C3       : int  3 4 4 3 5 6 4 4 3 6 ...
##  $ C4       : num  3 4 5 2 4 6 5 5 3 5 ...
##  $ C5       : num  3 3 2 2 5 4 4 3 2 6 ...
##  $ E1       : num  4 6 5 2 5 5 3 4 2 5 ...
##  $ E2       : num  4 6 3 4 5 6 4 1 4 5 ...
##  $ E3       : int  3 6 4 4 5 6 4 4 NA 4 ...
##  $ E4       : int  4 4 4 4 4 5 5 2 4 5 ...
##  $ E5       : int  4 3 5 4 5 6 5 1 3 5 ...
##  $ N1       : int  3 3 4 2 2 3 1 6 5 5 ...
##  $ N2       : int  4 3 5 5 3 5 2 3 5 5 ...
##  $ N3       : int  2 3 4 2 4 2 2 2 2 5 ...
##  $ N4       : int  2 5 2 4 4 2 1 6 3 2 ...
##  $ N5       : int  3 5 3 1 3 3 1 4 3 4 ...
##  $ O1       : int  3 4 4 3 3 4 5 3 6 5 ...
##  $ O2       : num  1 5 5 4 4 4 5 5 1 6 ...
##  $ O3       : int  3 4 5 4 4 5 5 4 6 5 ...
##  $ O4       : int  4 3 5 3 3 6 6 5 6 5 ...
##  $ O5       : int  3 3 2 5 3 1 1 3 1 2 ...
##  $ gender   : int  1 2 2 2 1 2 1 1 1 2 ...
##  $ education: int  NA NA NA NA NA 3 NA 2 1 NA ...
##  $ age      : int  16 18 17 17 17 21 18 19 19 17 ...

28個變項,總共2800筆資料點。

#將原始資料的1到8行資料取出,重新定義其為dta
dta <- dta[, 1:25]
my_summary <- function(x) {
 require(moments)
 funs <- c(mean, sd, skewness, kurtosis)
 sapply(funs, function(f) f(x, na.rm = T))
 }
#將my_summary函數應用於數據集中的每一列並將其分配給dta_desc
dta_desc <- apply(dta, 2, my_summary)
#查看每筆資料的mean, sd, skewness, kurtosis
head(dta_desc)
##              A1        A2        A3        A4        A5         C1         C2
## [1,]  4.5865661  4.802380  4.603821  4.699748  4.560345  4.5023390  4.3699568
## [2,]  1.4077372  1.172020  1.301834  1.479633  1.258512  1.2413465  1.3183465
## [3,] -0.8254883 -1.124894 -0.998997 -1.031499 -0.847690 -0.8551631 -0.7422207
## [4,]  2.6942957  4.057765  3.444524  3.042640  3.161176  3.3068088  2.8656243
##              C3         C4          C5         E1         E2         E3
## [1,]  4.3039568  4.4466474  3.70330460  4.0255672  3.8581178  4.0007207
## [2,]  1.2885518  1.3751181  1.62854187  1.6315055  1.6052103  1.3527188
## [3,] -0.6918287 -0.5964955 -0.06620282 -0.3736569 -0.2209396 -0.4706335
## [4,]  2.8697332  2.3802970  1.78461246  1.9090390  1.8526925  2.5367154
##              E4        E5        N1          N2        N3        N4        N5
## [1,]  4.4224292  4.416337 2.9290857  3.50773660 3.2165651 3.1856006 2.9696860
## [2,]  1.4575174  1.334768 1.5709175  1.52594359 1.6029021 1.5696851 1.6186474
## [3,] -0.8241831 -0.777486 0.3714298 -0.07698521 0.1506797 0.1969966 0.3744599
## [4,]  2.6977079  2.908401 1.9885722  1.95035250 1.8227046 1.9090309 1.9401121
##              O1        O2         O3        O4        O5
## [1,]  4.8160547  4.286786  4.4383117  4.892319 2.4895683
## [2,]  1.1295303  1.565152  1.2209011  1.221250 1.3279590
## [3,] -0.8973669 -0.585679 -0.7730516 -1.218247 0.7384818
## [4,]  3.4277033  2.188889  3.3043641  4.082686 2.7630094
#命名每個列,並將其轉換為data.frame呈現
rownames(dta_desc) <- c("mean", "sd", "skewness", "kurtosis")
rslt1 <- as.data.frame(t(dta_desc))
rslt1 |> knitr::kable()
mean sd skewness kurtosis
A1 4.586566 1.407737 -0.8254883 2.694296
A2 4.802380 1.172020 -1.1248938 4.057765
A3 4.603821 1.301834 -0.9989970 3.444524
A4 4.699748 1.479633 -1.0314991 3.042640
A5 4.560345 1.258512 -0.8476900 3.161176
C1 4.502339 1.241346 -0.8551631 3.306809
C2 4.369957 1.318347 -0.7422207 2.865624
C3 4.303957 1.288552 -0.6918287 2.869733
C4 4.446647 1.375118 -0.5964955 2.380297
C5 3.703305 1.628542 -0.0662028 1.784612
E1 4.025567 1.631506 -0.3736569 1.909039
E2 3.858118 1.605210 -0.2209396 1.852693
E3 4.000721 1.352719 -0.4706335 2.536715
E4 4.422429 1.457517 -0.8241831 2.697708
E5 4.416337 1.334768 -0.7774860 2.908401
N1 2.929086 1.570917 0.3714298 1.988572
N2 3.507737 1.525944 -0.0769852 1.950352
N3 3.216565 1.602902 0.1506797 1.822705
N4 3.185601 1.569685 0.1969966 1.909031
N5 2.969686 1.618647 0.3744599 1.940112
O1 4.816055 1.129530 -0.8973669 3.427703
O2 4.286786 1.565152 -0.5856790 2.188889
O3 4.438312 1.220901 -0.7730516 3.304364
O4 4.892319 1.221250 -1.2182471 4.082686
O5 2.489568 1.327959 0.7384818 2.763009
#轉換成 longdata
dtal_desc <- melt(dta_desc)
names(dtal_desc)[1:2] <- c("moments", "items")
#查看前6筆資料
head(dtal_desc)
##    moments items      value
## 1     mean    A1  4.5865661
## 2       sd    A1  1.4077372
## 3 skewness    A1 -0.8254883
## 4 kurtosis    A1  2.6942957
## 5     mean    A2  4.8023801
## 6       sd    A2  1.1720199
ggplot(data = subset(dtal_desc, moments == "mean"),
 aes(x = reorder(items, value, max), y = value, group = moments)) +
 geom_point(size = 1) +
 geom_hline(yintercept = mean(t(dta_desc["mean",])) +
 c(-1.5, 0, 1.5) * sd(t(dta_desc["mean", ])), linetype = "dashed") +
 coord_flip() +
 labs(x = "items",  y = "mean") +
  theme_bw()

在mean當中,O5、N1、N5的值極端小於mean的平均;沒有任何值極端大於平均。

ggplot(data = subset(dtal_desc, moments == "sd"),
 aes(x = reorder(items, value, max), y = value, group = moments)) +
 geom_point(size = 1) +
 geom_hline(yintercept = mean(t(dta_desc["sd",])) +
 c(-1.5, 0, 1.5) * sd(t(dta_desc["sd", ])), linetype = "dashed") +
 coord_flip() +
 labs(x = "items",  y = "sd") +
  theme_bw()

在sd當中,O1極端小於sd的平均;沒有任何值極端大於平均。

ggplot(data = subset(dtal_desc, moments == "skewness"),
 aes(x = reorder(items, value, max), y = value, group = moments)) +
 geom_point(size = 1) +
 geom_hline(yintercept = mean(t(dta_desc["skewness",])) +
 c(-1.5, 0, 1.5) * sd(t(dta_desc["skewness", ])), linetype = "dashed") +
 coord_flip() +
 labs(x = "items",  y = "skewness") +
  theme_bw()

在skewness當中,沒有任何值極端小於skewness的平均;O5、N5、N1極端大於skewness的平均。

ggplot(data = subset(dtal_desc, moments == "kurtosis"),
 aes(x = reorder(items, value, max), y = value, group = moments)) +
 geom_point(size = 1) +
 geom_hline(yintercept = mean(t(dta_desc["kurtosis",])) +
 c(-1.5, 0, 1.5) * sd(t(dta_desc["kurtosis", ])), linetype = "dashed") +
 coord_flip() +
 labs(x = "items",  y = "kurtosis") +
  theme_bw()

在kurtosis當中,沒有任何值極端小於kurtosis的平均;O4、A2極端大於kurtosis的平均。

#刪除所有含有缺失資料NA的row
dta1 = na.omit(dta)
dta1$tot <- apply(dta1, 1, sum)
#在 dta 中設一個欄位叫 grp,將所有數值設為 NA
dta$grp <- NA
#只要分數小於2436*.27,就在 grp 中顯示L代表低;大於2436*.73 則顯示H代表高;其餘仍以NA顯示
dta1$grp[rank(dta1$tot) < 2436*.27] <- "L"
dta1$grp[rank(dta1$tot) > 2436*.73] <- "H"
dta1$grp <- factor(dta1$grp)
head(dta1)
##       A1 A2 A3 A4 A5 C1 C2 C3 C4 C5 E1 E2 E3 E4 E5 N1 N2 N3 N4 N5 O1 O2 O3 O4
## 61617  5  4  3  4  4  2  3  3  3  3  4  4  3  4  4  3  4  2  2  3  3  1  3  4
## 61618  5  4  5  2  5  5  4  4  4  3  6  6  6  4  3  3  3  3  5  5  4  5  4  3
## 61620  2  4  5  4  4  4  5  4  5  2  5  3  4  4  5  4  5  4  2  3  4  5  5  5
## 61621  3  4  6  5  5  4  4  3  2  2  2  4  4  4  4  2  5  2  4  1  3  4  4  3
## 61622  5  3  3  4  5  4  4  5  4  5  5  5  5  4  5  2  3  4  4  3  3  4  4  3
## 61623  1  6  5  6  5  6  6  6  6  4  5  6  6  5  6  3  5  2  2  3  4  4  5  6
##       O5 tot  grp
## 61617  3  81    L
## 61618  3 104 <NA>
## 61620  2  99 <NA>
## 61621  5  89    L
## 61622  3  99 <NA>
## 61623  1 114    H
#算高低分組平均數
dtam <- aggregate(dta1[, 1:25], by=list(dta1$grp), mean)
print(dtam)
##   Group.1       A1       A2       A3       A4       A5       C1       C2
## 1       H 5.007407 5.438519 5.364444 5.325926 5.237037 5.136296 5.102222
## 2       L 4.202080 4.017831 3.693908 3.918276 3.796434 3.897474 3.632987
##         C3       C4       C5       E1       E2       E3       E4       E5
## 1 4.885926 5.040000 4.358519 4.746667 4.617778 4.856296 5.145185 5.229630
## 2 3.742942 3.832095 3.005944 3.077266 2.921248 3.062407 3.401189 3.423477
##         N1       N2       N3       N4       N5       O1       O2       O3
## 1 3.364444 3.955556 3.680000 3.269630 3.330370 5.299259 4.691852 5.091852
## 2 2.585438 3.200594 2.783061 3.194651 2.649331 4.326895 4.031204 3.790490
##         O4       O5
## 1 5.272593 2.334815
## 2 4.679049 2.563150
#將第一欄刪除
dtam <- t(dtam[, -1])

t-test

#使用 t-test 檢查兩個高低兩組平均值之間的差異
item_t <- sapply(dta1[, 1:25], function(x) t.test(x ~ dta1$grp)$statistic)
print(item_t)
##       A1.t       A2.t       A3.t       A4.t       A5.t       C1.t       C2.t 
## 10.8435846 24.1029485 26.7156154 18.7839003 23.0699742 19.1247670 22.3832065 
##       C3.t       C4.t       C5.t       E1.t       E2.t       E3.t       E4.t 
## 17.1453481 16.9457542 16.0464821 20.4585020 21.2538284 28.5111542 23.8114957 
##       E5.t       N1.t       N2.t       N3.t       N4.t       N5.t       O1.t 
## 28.1321438  9.2082776  9.2587359 10.4863674  0.8665417  7.6373698 16.2839271 
##       O2.t       O3.t       O4.t       O5.t 
##  7.7166981 20.8345645  9.2886876 -3.1290125
#將 t-test 結果儲存進 rslt2 並創建另外三個列
rslt2 <- data.frame(Item = rownames(dtam), low.mean.score = dtam[, 2], 
                    high.mean.score = dtam[, 1], mean.dif = dtam[, 1]-dtam[, 2], 
                    t.value = item_t)
print(rslt2)
##    Item low.mean.score high.mean.score    mean.dif    t.value
## A1   A1       4.202080        5.007407  0.80532717 10.8435846
## A2   A2       4.017831        5.438519  1.42068791 24.1029485
## A3   A3       3.693908        5.364444  1.67053657 26.7156154
## A4   A4       3.918276        5.325926  1.40764955 18.7839003
## A5   A5       3.796434        5.237037  1.44060316 23.0699742
## C1   C1       3.897474        5.136296  1.23882230 19.1247670
## C2   C2       3.632987        5.102222  1.46923560 22.3832065
## C3   C3       3.742942        4.885926  1.14298388 17.1453481
## C4   C4       3.832095        5.040000  1.20790490 16.9457542
## C5   C5       3.005944        4.358519  1.35257498 16.0464821
## E1   E1       3.077266        4.746667  1.66940069 20.4585020
## E2   E2       2.921248        4.617778  1.69652964 21.2538284
## E3   E3       3.062407        4.856296  1.79388916 28.5111542
## E4   E4       3.401189        5.145185  1.74399648 23.8114957
## E5   E5       3.423477        5.229630  1.80615266 28.1321438
## N1   N1       2.585438        3.364444  0.77900611  9.2082776
## N2   N2       3.200594        3.955556  0.75496120  9.2587359
## N3   N3       2.783061        3.680000  0.89693908 10.4863674
## N4   N4       3.194651        3.269630  0.07497881  0.8665417
## N5   N5       2.649331        3.330370  0.68103902  7.6373698
## O1   O1       4.326895        5.299259  0.97236476 16.2839271
## O2   O2       4.031204        4.691852  0.66064829  7.7166981
## O3   O3       3.790490        5.091852  1.30136151 20.8345645
## O4   O4       4.679049        5.272593  0.59354356  9.2886876
## O5   O5       2.563150        2.334815 -0.22833526 -3.1290125
ggplot(data = rslt2, aes(x = reorder(Item, t.value, max), y = t.value)) +
 geom_point() +
 geom_hline(yintercept = 2, linetype = "dashed") +
 coord_flip() +
 labs(x = "Items", y = "t-value") +
 theme_bw()

#計算全量表的cronbach’s α,在刪除項目本身後顯示相關性評分
itotr <- psych::alpha(dta1[, 1:25])$item.stats[, "r.drop"]
## Warning in psych::alpha(dta1[, 1:25]): Some items 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
## Some items ( N1 N2 N3 N4 N5 O4 O5 ) 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
#創造一個含有列表的子量表
ldta <- list(A = dta[, 1:5], C = dta[, 6:10], E = dta[ ,11:15], 
              N = dta[, 16:20], O = dta[, 21:25])
#計算所有子量表的Cronbach's α
isubalpha <- lapply(ldta, psych::alpha)
## Warning in FUN(X[[i]], ...): Some items 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
## Some items ( O5 ) 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
isubr <- c(isubalpha$A$item.stats[, "r.drop"],
             isubalpha$C$item.stats[, "r.drop"],
             isubalpha$E$item.stats[, "r.drop"],
           isubalpha$N$item.stats[, "r.drop"],
           isubalpha$O$item.stats[, "r.drop"])
rslt3 <- as.data.frame(t(rbind(itotr, isubr)))
names(rslt3) <- c("Item-total correlation without item", "Item-subscale correlation without item")

print(rslt3)
##    Item-total correlation without item Item-subscale correlation without item
## 1                           0.12129886                             0.30841774
## 2                           0.44014085                             0.56361516
## 3                           0.46294030                             0.58700459
## 4                           0.31532083                             0.39444409
## 5                           0.40108276                             0.48856514
## 6                           0.31617880                             0.45024169
## 7                           0.36605572                             0.50456471
## 8                           0.26908306                             0.46420485
## 9                           0.24405601                             0.55254665
## 10                          0.21036732                             0.47746920
## 11                          0.29545305                             0.51627292
## 12                          0.31820168                             0.60536884
## 13                          0.46367816                             0.50457255
## 14                          0.40479750                             0.57799397
## 15                          0.46538882                             0.45424460
## 16                          0.07803633                             0.66720571
## 17                          0.07567906                             0.65261625
## 18                          0.11094446                             0.67481671
## 19                         -0.10220864                             0.54280013
## 20                          0.04465205                             0.48648241
## 21                          0.27231436                             0.29054250
## 22                          0.03491339                             0.08778888
## 23                          0.36270021                             0.28189375
## 24                          0.08713837                             0.11880816
## 25                         -0.18664142                            -0.41621051

題目信度

itotalpha <- psych::alpha(dta[, 1:25])$alpha.drop[, "raw_alpha"]
## Warning in psych::alpha(dta[, 1:25]): Some items 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
## Some items ( N1 N2 N3 N4 N5 O4 O5 ) 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
ialphad <- c(isubalpha$A$alpha.drop[, "raw_alpha"],
             isubalpha$C$alpha.drop[, "raw_alpha"],
             isubalpha$E$alpha.drop[, "raw_alpha"],
             isubalpha$N$alpha.drop[, "raw_alpha"],
             isubalpha$O$alpha.drop[, "raw_alpha"])
rslt4 <- as.data.frame(t(rbind(itotalpha, ialphad)))
names(rslt4) <- c("Main Reliability(item drop)", "Sub Reliability (item drop)")
print(rslt4)
##    Main Reliability(item drop) Sub Reliability (item drop)
## 1                    0.6632149                  0.71851736
## 2                    0.6367700                  0.61718004
## 3                    0.6323646                  0.60025958
## 4                    0.6453668                  0.68580565
## 5                    0.6380217                  0.64295296
## 6                    0.6473781                  0.69400042
## 7                    0.6407685                  0.67357146
## 8                    0.6490963                  0.68873410
## 9                    0.6522542                  0.65382557
## 10                   0.6546084                  0.68972493
## 11                   0.6457509                  0.72565472
## 12                   0.6438399                  0.69018038
## 13                   0.6311851                  0.72791419
## 14                   0.6352193                  0.70188850
## 15                   0.6313077                  0.74363273
## 16                   0.6677606                  0.75813791
## 17                   0.6673696                  0.76323265
## 18                   0.6647101                  0.75534281
## 19                   0.6855098                  0.79534991
## 20                   0.6713194                  0.81260218
## 21                   0.6496561                 -0.23847961
## 22                   0.6732647                 -0.03098808
## 23                   0.6422412                 -0.25873151
## 24                   0.6635357                 -0.04428384
## 25                   0.6877593                  0.51165759

根據信度結果來看,會排除拿掉該題目後,全量表信度和子量表信度皆高者。若在全量表中的信度排序,和子量表中的信度排序有差異,則以子量表信度為優先,因為該題目作為測量該項目的其中一題,會比整體來說更重要。

以子量表親和性(A)來說,會排除掉1和4,因為少了這題,其信度仍優於拿掉其他題目。

以此類推,親和性(A)保留2、3、5;盡責性(C)保留2、3、4;外向性(E)保留1、2、4;神經質(N)保留1、2、3;經驗開放性(O)保留1、3、5。

#factor loading
#因素負載量-因素對構念(construct)的影響
#因素負載量越高越好,越能反映子構念
print.psych(fa(dta[, 1:25],
               nfactor = 5,
               fm = "pa",
               rotate = "Promax"),
               cut = .3)
## Factor Analysis using method =  pa
## Call: fa(r = dta[, 1:25], nfactors = 5, rotate = "Promax", fm = "pa")
## Standardized loadings (pattern matrix) based upon correlation matrix
##      PA2   PA1   PA3   PA5   PA4   h2   u2 com
## A1                    0.42       0.19 0.81 1.9
## A2                    0.62       0.45 0.55 1.1
## A3                    0.63       0.52 0.48 1.2
## A4                    0.42       0.28 0.72 1.9
## A5        0.31        0.51       0.46 0.54 1.8
## C1              0.56             0.33 0.67 1.2
## C2              0.69             0.45 0.55 1.2
## C3              0.59             0.32 0.68 1.1
## C4              0.62             0.45 0.55 1.2
## C5              0.55             0.43 0.57 1.4
## E1        0.62                   0.35 0.65 1.2
## E2        0.72                   0.54 0.46 1.0
## E3        0.50                   0.44 0.56 2.0
## E4        0.65                   0.53 0.47 1.3
## E5        0.47                   0.40 0.60 2.2
## N1  0.84                         0.65 0.35 1.2
## N2  0.80                         0.60 0.40 1.1
## N3  0.72                         0.55 0.45 1.0
## N4  0.47 -0.35                   0.49 0.51 2.1
## N5  0.49                         0.35 0.65 1.8
## O1                          0.50 0.31 0.69 1.2
## O2                          0.46 0.26 0.74 1.7
## O3                          0.60 0.46 0.54 1.3
## O4                          0.38 0.25 0.75 2.6
## O5                         -0.55 0.30 0.70 1.2
## 
##                        PA2  PA1  PA3  PA5  PA4
## SS loadings           2.62 2.45 1.97 1.81 1.53
## Proportion Var        0.10 0.10 0.08 0.07 0.06
## Cumulative Var        0.10 0.20 0.28 0.35 0.41
## Proportion Explained  0.25 0.24 0.19 0.17 0.15
## Cumulative Proportion 0.25 0.49 0.68 0.85 1.00
## 
##  With factor correlations of 
##       PA2   PA1   PA3  PA5   PA4
## PA2  1.00 -0.32 -0.24 0.02 -0.02
## PA1 -0.32  1.00  0.37 0.29  0.17
## PA3 -0.24  0.37  1.00 0.22  0.23
## PA5  0.02  0.29  0.22 1.00  0.19
## PA4 -0.02  0.17  0.23 0.19  1.00
## 
## Mean item complexity =  1.5
## Test of the hypothesis that 5 factors are sufficient.
## 
## The degrees of freedom for the null model are  300  and the objective function was  7.23 with Chi Square of  20163.79
## The degrees of freedom for the model are 185  and the objective function was  0.65 
## 
## 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  2762 with the empirical chi square  1392.16  with prob <  5.6e-184 
## The total number of observations was  2800  with Likelihood Chi Square =  1809.1  with prob <  4e-264 
## 
## Tucker Lewis Index of factoring reliability =  0.867
## RMSEA index =  0.056  and the 90 % confidence intervals are  0.054 0.058
## BIC =  340.68
## Fit based upon off diagonal values = 0.98
## Measures of factor score adequacy             
##                                                    PA2  PA1  PA3  PA5  PA4
## Correlation of (regression) scores with factors   0.93 0.90 0.88 0.87 0.84
## Multiple R square of scores with factors          0.86 0.82 0.78 0.75 0.70
## Minimum correlation of possible factor scores     0.71 0.64 0.56 0.50 0.41
#平行分析
fa.parallel(dta[, 1:25], fa = "pc", show.legend = FALSE)

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

高於虛線的實際特徵值數目就是建議的因素數目,根據平行分析,建議為5個。