Library
library(pacman)
p_load(psych)
憂鬱量表(CESD)題目
1_原來不會介意的事,最近竟然會困擾我
2_我做任何事情都覺得費力
3_我覺得我和別人一樣好
4_我做事無法集中精神
5_我覺得悲傷
6_我覺得恐懼
7_我覺得寂寞
8_我曾經痛哭
9_我睡得不安寧
10_我比平日不愛講話
11_我享受了生活的樂趣
12_即使有親友的幫忙,我還是無法拋開煩惱
13_我認為我的人生是失敗的
14_我是快樂的
15_我缺乏幹勁
16_我對未來充滿希望
17_人們是不友善的
18_我的胃口不好,不想吃東西
19_我覺得悶悶不樂
20_我覺得別人不喜歡我
First order factor analysis of CESD
dta1 <- read.table("D:/wen_sung/psychology/心測/HW/hw01.dat",header=FALSE)
cesddta1 <- dta1[,1:20]
fa.parallel(cesddta1,n.obs=nrow(cesddta1),fa="pc",show.legend=FALSE)

## Parallel analysis suggests that the number of factors = NA and the number of components = 2
pa <- factor.pa(cesddta1,nfactor=4,rotate="promax",scores=FALSE)
print.psych(pa,cut=.25,sort=TRUE)
## Factor Analysis using method = pa
## Call: factor.pa(r = cesddta1, nfactors = 4, rotate = "promax", scores = FALSE)
## Unstandardized loadings (pattern matrix) based upon covariance matrix
## item PA1 PA2 PA4 PA3 h2 u2 H2 U2
## V5 5 0.80 0.75 0.25 0.75 0.25
## V8 8 0.78 0.54 0.46 0.54 0.46
## V7 7 0.76 0.67 0.33 0.67 0.33
## V6 6 0.69 0.60 0.40 0.60 0.40
## V9 9 0.36 0.35 0.65 0.35 0.65
## V1 1 0.30 0.27 0.26 0.74 0.26 0.74
## V12 12 0.38 0.62 0.38 0.62
## V14 14 0.77 0.68 0.32 0.68 0.32
## V16 16 0.75 0.54 0.46 0.54 0.46
## V11 11 0.71 0.51 0.49 0.51 0.49
## V3 3 0.48 0.23 0.77 0.23 0.77
## V17 17 -0.66 0.35 0.65 0.35 0.65
## V20 20 -0.63 0.49 0.51 0.49 0.51
## V19 19 0.28 -0.61 0.66 0.34 0.66 0.34
## V10 10 -0.44 0.21 0.79 0.21 0.79
## V13 13 -0.38 0.45 0.55 0.45 0.55
## V18 18 -0.34 0.20 0.80 0.20 0.80
## V4 4 0.73 0.46 0.54 0.46 0.54
## V2 2 0.69 0.45 0.55 0.45 0.55
## V15 15 0.60 0.42 0.58 0.42 0.58
##
## PA1 PA2 PA4 PA3
## SS loadings 3.19 1.98 2.32 1.71
## Proportion Var 0.16 0.10 0.12 0.09
## Cumulative Var 0.16 0.26 0.37 0.46
## Proportion Explained 0.35 0.22 0.25 0.19
## Cumulative Proportion 0.35 0.56 0.81 1.00
##
## Standardized loadings (pattern matrix)
## item PA1 PA2 PA4 PA3 h2 u2
## V5 5 0.8 0.75 0.25
## V8 8 0.78 0.54 0.46
## V7 7 0.76 0.67 0.33
## V6 6 0.69 0.60 0.40
## V9 9 0.36 0.35 0.65
## V1 1 0.3 0.27 0.26 0.74
## V12 12 0.38 0.62
## V14 14 0.77 0.68 0.32
## V16 16 0.75 0.54 0.46
## V11 11 0.71 0.51 0.49
## V3 3 0.48 0.23 0.77
## V17 17 -0.66 0.35 0.65
## V20 20 -0.64 0.49 0.51
## V19 19 0.28 -0.61 0.66 0.34
## V10 10 -0.44 0.21 0.79
## V13 13 -0.38 0.45 0.55
## V18 18 -0.34 0.20 0.80
## V4 4 0.73 0.46 0.54
## V2 2 0.69 0.45 0.55
## V15 15 0.6 0.42 0.58
##
## PA1 PA2 PA4 PA3
## SS loadings 3.19 1.98 2.32 1.71
## Proportion Var 0.16 0.10 0.12 0.09
## Cumulative Var 0.16 0.26 0.37 0.46
## Cum. factor Var 0.35 0.56 0.81 1.00
##
## With factor correlations of
## PA1 PA2 PA4 PA3
## PA1 1.00 0.24 -0.76 0.71
## PA2 0.24 1.00 -0.32 0.13
## PA4 -0.76 -0.32 1.00 -0.75
## PA3 0.71 0.13 -0.75 1.00
##
## Mean item complexity = 1.4
## Test of the hypothesis that 4 factors are sufficient.
##
## The degrees of freedom for the null model are 190 and the objective function was 7.89 with Chi Square of 19228.24
## The degrees of freedom for the model are 116 and the objective function was 0.27
##
## The root mean square of the residuals (RMSR) is 0.02
## The df corrected root mean square of the residuals is 0.03
##
## The harmonic number of observations is 2444 with the empirical chi square 421.9 with prob < 2.5e-36
## The total number of observations was 2444 with MLE Chi Square = 655.39 with prob < 3.5e-76
##
## Tucker Lewis Index of factoring reliability = 0.954
## RMSEA index = 0.044 and the 90 % confidence intervals are 0.04 0.047
## BIC = -249.57
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy
## PA1 PA2 PA4 PA3
## Correlation of scores with factors 0.95 0.91 0.92 0.90
## Multiple R square of scores with factors 0.90 0.82 0.85 0.80
## Minimum correlation of possible factor scores 0.80 0.65 0.69 0.61
人格問卷量表題目
I01-我很容易發怒
I02-別人認為我是一個很暴躁的人
I03-大多數的人比我容易生氣(#)
I04-有些人說他們從來沒有見過我生氣(#)
I05-我會重覆地檢查自己的工作,以找出任何錯誤(#)
I06-做事時, 我不太注意小細節
I07-我不喜歡花時間去把已經做得夠好的工作,再變得更好
I08-我不介意自己書寫的文件中有一些拼字或標點錯誤
I09-看到別人哭時,我也會想哭(#)
I10我不明白為什麼有些人在婚禮裡會變得很容易感動
I11-當親近的人擔心某些事物時,我也感到擔心(#)
I12-即使在大多數人變得很感傷的情境中,我仍可不動情感
反向題(#),所有題目都是五點李克式量尺
First order factor analysis of personality questionnaire
dta2 <- read.table("D:/wen_sung/psychology/心測/HW/hw02.dat",header=FALSE)
cesddta2 <- dta2[,1:12]
fa.parallel(cesddta2,n.obs=nrow(cesddta2),fa="pc",show.legend=FALSE)

## Parallel analysis suggests that the number of factors = NA and the number of components = 3
pa <- factor.pa(cesddta2,nfactor=3,rotate="promax",scores=FALSE)
print.psych(pa,cut=.25,sort=TRUE)
## Factor Analysis using method = pa
## Call: factor.pa(r = cesddta2, nfactors = 3, rotate = "promax", scores = FALSE)
## Unstandardized loadings (pattern matrix) based upon covariance matrix
## item PA1 PA3 PA2 h2 u2 H2 U2
## V1 1 -0.97 0.912 0.09 0.910 0.09
## V2 2 -0.75 0.548 0.45 0.549 0.45
## V3 3 0.63 0.499 0.50 0.500 0.50
## V4 4 0.51 -0.29 0.396 0.60 0.398 0.60
## V7 7 0.85 0.694 0.31 0.691 0.31
## V5 5 -0.74 0.590 0.41 0.590 0.41
## V6 6 0.57 0.404 0.60 0.402 0.60
## V8 8 0.27 0.072 0.93 0.072 0.93
## V10 10 0.74 0.511 0.49 0.511 0.49
## V9 9 -0.70 0.526 0.47 0.528 0.47
## V12 12 0.54 0.293 0.71 0.292 0.71
## V11 11 -0.27 0.097 0.90 0.097 0.90
##
## PA1 PA3 PA2
## SS loadings 2.21 1.71 1.62
## Proportion Var 0.18 0.14 0.13
## Cumulative Var 0.18 0.33 0.46
## Proportion Explained 0.40 0.31 0.29
## Cumulative Proportion 0.40 0.71 1.00
##
## Standardized loadings (pattern matrix)
## item PA1 PA3 PA2 h2 u2
## V1 1 -0.97 0.910 0.09
## V2 2 -0.76 0.549 0.45
## V3 3 0.63 0.500 0.50
## V4 4 0.51 -0.29 0.398 0.60
## V7 7 0.85 0.691 0.31
## V5 5 -0.74 0.590 0.41
## V6 6 0.56 0.402 0.60
## V8 8 0.27 0.072 0.93
## V10 10 0.74 0.511 0.49
## V9 9 -0.7 0.528 0.47
## V12 12 0.53 0.292 0.71
## V11 11 -0.27 0.097 0.90
##
## PA1 PA3 PA2
## SS loadings 2.21 1.71 1.62
## Proportion Var 0.18 0.14 0.13
## Cumulative Var 0.18 0.33 0.46
## Cum. factor Var 0.40 0.71 1.00
##
## With factor correlations of
## PA1 PA3 PA2
## PA1 1.00 0.09 -0.15
## PA3 0.09 1.00 0.29
## PA2 -0.15 0.29 1.00
##
## Mean item complexity = 1.2
## Test of the hypothesis that 3 factors are sufficient.
##
## The degrees of freedom for the null model are 66 and the objective function was 4.21 with Chi Square of 236.55
## The degrees of freedom for the model are 33 and the objective function was 0.87
##
## The root mean square of the residuals (RMSR) is 0.06
## The df corrected root mean square of the residuals is 0.08
##
## The harmonic number of observations is 62 with the empirical chi square 25.39 with prob < 0.83
## The total number of observations was 62 with MLE Chi Square = 47.14 with prob < 0.053
##
## Tucker Lewis Index of factoring reliability = 0.826
## RMSEA index = 0.1 and the 90 % confidence intervals are NA 0.133
## BIC = -89.05
## Fit based upon off diagonal values = 0.95
## Measures of factor score adequacy
## PA1 PA3 PA2
## Correlation of scores with factors 0.97 0.90 0.87
## Multiple R square of scores with factors 0.94 0.82 0.76
## Minimum correlation of possible factor scores 0.88 0.63 0.52