R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R は、自由なソフトウェアであり、「完全に無保証」です。 一定の条件に従えば、自由にこれを再配布することができます。 配布条件の詳細に関しては、'license()' あるいは 'licence()' と入力してください。 R は多くの貢献者による共同プロジェクトです。 詳しくは 'contributors()' と入力してください。 また、R や R のパッケージを出版物で引用する際の形式については 'citation()' と入力してください。 'demo()' と入力すればデモをみることができます。 'help()' とすればオンラインヘルプが出ます。 'help.start()' で HTML ブラウザによるヘルプがみられます。 'q()' と入力すれば R を終了します。 [以前にセーブされたワークスペースを復帰します] > library(psych) > library(GPArotation) > five.data <- read.csv("i://r//five_subject.csv") > head(five.data) 国語 社会 英語 数学 理科 1 3 3 4 5 5 2 4 3 4 4 4 3 5 3 5 5 5 4 4 1 4 5 5 5 4 3 4 4 5 6 3 1 4 5 5 > cor(five.data) 国語 社会 英語 数学 理科 国語 1.0000000 0.3269180 0.4519981 0.3522042 0.2847861 社会 0.3269180 1.0000000 0.3036502 0.1367164 0.1570586 英語 0.4519981 0.3036502 1.0000000 0.4359957 0.3635618 数学 0.3522042 0.1367164 0.4359957 1.0000000 0.4987013 理科 0.2847861 0.1570586 0.3635618 0.4987013 1.0000000 > print(cor(five.data),digits=3) 国語 社会 英語 数学 理科 国語 1.000 0.327 0.452 0.352 0.285 社会 0.327 1.000 0.304 0.137 0.157 英語 0.452 0.304 1.000 0.436 0.364 数学 0.352 0.137 0.436 1.000 0.499 理科 0.285 0.157 0.364 0.499 1.000 > five.result <- fa(five.data, nfactors=2, rotate="varimax") > print(five.result, digtits=3) Factor Analysis using method = minres Call: fa(r = five.data, nfactors = 2, rotate = "varimax") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 h2 u2 com 国語 0.29 0.60 0.44 0.56 1.5 社会 0.06 0.51 0.27 0.73 1.0 英語 0.42 0.55 0.48 0.52 1.9 数学 0.83 0.17 0.71 0.29 1.1 理科 0.56 0.22 0.36 0.64 1.3 MR1 MR2 SS loadings 1.26 1.00 Proportion Var 0.25 0.20 Cumulative Var 0.25 0.45 Proportion Explained 0.56 0.44 Cumulative Proportion 0.56 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 10 and the objective function was 0.96 3 with Chi Square of 247.98 The degrees of freedom for the model are 1 and the objective function was 0 3 The root mean square of the residuals (RMSR) is 0.01 The df corrected root mean square of the residuals is 0.02 3 The harmonic number of observations is 263 with the empirical chi square 0.19 with prob < 0.66 3The total number of observations was 263 with Likelihood Chi Square = 0.31 with prob < 0.58 3 Tucker Lewis Index of factoring reliability = 1.029 RMSEA index = 0 and the 90 % confidence intervals are 0 0.134 3 BIC = -5.26 Fit based upon off diagonal values = 1 Measures of factor score adequacy MR1 MR2 Correlation of (regression) scores with factors 0.85 0.74 Multiple R square of scores with factors 0.72 0.55 Minimum correlation of possible factor scores 0.44 0.11 > print(five.result, digits=3) Factor Analysis using method = minres Call: fa(r = five.data, nfactors = 2, rotate = "varimax") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 h2 u2 com 国語 0.294 0.598 0.445 0.555 1.46 社会 0.065 0.512 0.267 0.733 1.03 英語 0.422 0.546 0.475 0.525 1.88 数学 0.827 0.169 0.712 0.288 1.08 理科 0.557 0.223 0.360 0.640 1.31 MR1 MR2 SS loadings 1.263 0.997 Proportion Var 0.253 0.199 Cumulative Var 0.253 0.452 Proportion Explained 0.559 0.441 Cumulative Proportion 0.559 1.000 Mean item complexity = 1.4 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 10 and the objective function was 0.956 with Chi Square of 247.981 The degrees of freedom for the model are 1 and the objective function was 0.001 The root mean square of the residuals (RMSR) is 0.006 The df corrected root mean square of the residuals is 0.019 The harmonic number of observations is 263 with the empirical chi square 0.19 with prob < 0.663 The total number of observations was 263 with Likelihood Chi Square = 0.313 with prob < 0.576 Tucker Lewis Index of factoring reliability = 1.029 RMSEA index = 0 and the 90 % confidence intervals are 0 0.1344 BIC = -5.259 Fit based upon off diagonal values = 1 Measures of factor score adequacy MR1 MR2 Correlation of (regression) scores with factors 0.848 0.745 Multiple R square of scores with factors 0.720 0.554 Minimum correlation of possible factor scores 0.439 0.109 > fa.diagram(five.result) > fa.diagram(five.result, cut=0, simple=FALSE, sort=FALSE, digits=3) > fa.plot(five.result) > fa.plot(five.result, labels=colnames(five.data)) > fa(five.data, nfactors=2, rotate="varimax") Factor Analysis using method = minres Call: fa(r = five.data, nfactors = 2, rotate = "varimax") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 h2 u2 com 国語 0.29 0.60 0.44 0.56 1.5 社会 0.06 0.51 0.27 0.73 1.0 英語 0.42 0.55 0.48 0.52 1.9 数学 0.83 0.17 0.71 0.29 1.1 理科 0.56 0.22 0.36 0.64 1.3 MR1 MR2 SS loadings 1.26 1.00 Proportion Var 0.25 0.20 Cumulative Var 0.25 0.45 Proportion Explained 0.56 0.44 Cumulative Proportion 0.56 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 10 and the objective function was 0.96 with Chi Square of 247.98 The degrees of freedom for the model are 1 and the objective function was 0 The root mean square of the residuals (RMSR) is 0.01 The df corrected root mean square of the residuals is 0.02 The harmonic number of observations is 263 with the empirical chi square 0.19 with prob < 0.66 The total number of observations was 263 with Likelihood Chi Square = 0.31 with prob < 0.58 Tucker Lewis Index of factoring reliability = 1.029 RMSEA index = 0 and the 90 % confidence intervals are 0 0.134 BIC = -5.26 Fit based upon off diagonal values = 1 Measures of factor score adequacy MR1 MR2 Correlation of (regression) scores with factors 0.85 0.74 Multiple R square of scores with factors 0.72 0.55 Minimum correlation of possible factor scores 0.44 0.11 > fa(five.data, nfactors=3, rotate="varimax") Factor Analysis using method = minres Call: fa(r = five.data, nfactors = 3, rotate = "varimax") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 MR3 h2 u2 com 国語 0.29 0.56 0.23 0.45 0.55 1.9 社会 0.07 0.56 -0.04 0.32 0.68 1.0 英語 0.42 0.50 0.21 0.47 0.53 2.3 数学 0.73 0.16 0.23 0.61 0.39 1.3 理科 0.66 0.19 -0.04 0.47 0.53 1.2 MR1 MR2 MR3 SS loadings 1.22 0.94 0.15 Proportion Var 0.24 0.19 0.03 Cumulative Var 0.24 0.43 0.46 Proportion Explained 0.53 0.41 0.07 Cumulative Proportion 0.53 0.93 1.00 Mean item complexity = 1.5 Test of the hypothesis that 3 factors are sufficient. The degrees of freedom for the null model are 10 and the objective function was 0.96 with Chi Square of 247.98 The degrees of freedom for the model are -2 and the objective function was 0 The root mean square of the residuals (RMSR) is 0 The df corrected root mean square of the residuals is NA The harmonic number of observations is 263 with the empirical chi square 0 with prob < NA The total number of observations was 263 with Likelihood Chi Square = 0 with prob < NA Tucker Lewis Index of factoring reliability = 1.042 Fit based upon off diagonal values = 1 Measures of factor score adequacy MR1 MR2 MR3 Correlation of (regression) scores with factors 0.81 0.73 0.38 Multiple R square of scores with factors 0.65 0.53 0.15 Minimum correlation of possible factor scores 0.31 0.07 -0.70 > fa(five.data, nfactors=3, rotate="promax") Factor Analysis using method = minres Call: fa(r = five.data, nfactors = 3, rotate = "promax") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 MR3 h2 u2 com 国語 0.01 0.39 0.38 0.45 0.55 2.0 社会 -0.03 0.57 0.02 0.32 0.68 1.0 英語 0.19 0.31 0.34 0.47 0.53 2.6 数学 0.59 -0.12 0.32 0.61 0.39 1.7 理科 0.69 0.06 -0.04 0.47 0.53 1.0 MR1 MR2 MR3 SS loadings 1.00 0.70 0.62 Proportion Var 0.20 0.14 0.12 Cumulative Var 0.20 0.34 0.46 Proportion Explained 0.43 0.30 0.27 Cumulative Proportion 0.43 0.73 1.00 With factor correlations of MR1 MR2 MR3 MR1 1.00 0.38 0.61 MR2 0.38 1.00 0.47 MR3 0.61 0.47 1.00 Mean item complexity = 1.6 Test of the hypothesis that 3 factors are sufficient. The degrees of freedom for the null model are 10 and the objective function was 0.96 with Chi Square of 247.98 The degrees of freedom for the model are -2 and the objective function was 0 The root mean square of the residuals (RMSR) is 0 The df corrected root mean square of the residuals is NA The harmonic number of observations is 263 with the empirical chi square 0 with prob < NA The total number of observations was 263 with Likelihood Chi Square = 0 with prob < NA Tucker Lewis Index of factoring reliability = 1.042 Fit based upon off diagonal values = 1 Measures of factor score adequacy MR1 MR2 MR3 Correlation of (regression) scores with factors 0.84 0.75 0.78 Multiple R square of scores with factors 0.71 0.56 0.60 Minimum correlation of possible factor scores 0.41 0.12 0.20 > > fa(five.data, nfactors=2, rotate="promax") Factor Analysis using method = minres Call: fa(r = five.data, nfactors = 2, rotate = "promax") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 h2 u2 com 国語 0.11 0.59 0.44 0.56 1.1 社会 -0.13 0.58 0.27 0.73 1.1 英語 0.28 0.48 0.48 0.52 1.6 数学 0.91 -0.13 0.71 0.29 1.0 理科 0.57 0.04 0.36 0.64 1.0 MR1 MR2 SS loadings 1.29 0.97 Proportion Var 0.26 0.19 Cumulative Var 0.26 0.45 Proportion Explained 0.57 0.43 Cumulative Proportion 0.57 1.00 With factor correlations of MR1 MR2 MR1 1.0 0.6 MR2 0.6 1.0 Mean item complexity = 1.2 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 10 and the objective function was 0.96 with Chi Square of 247.98 The degrees of freedom for the model are 1 and the objective function was 0 The root mean square of the residuals (RMSR) is 0.01 The df corrected root mean square of the residuals is 0.02 The harmonic number of observations is 263 with the empirical chi square 0.19 with prob < 0.66 The total number of observations was 263 with Likelihood Chi Square = 0.31 with prob < 0.58 Tucker Lewis Index of factoring reliability = 1.029 RMSEA index = 0 and the 90 % confidence intervals are 0 0.134 BIC = -5.26 Fit based upon off diagonal values = 1 Measures of factor score adequacy MR1 MR2 Correlation of (regression) scores with factors 0.89 0.81 Multiple R square of scores with factors 0.79 0.66 Minimum correlation of possible factor scores 0.59 0.32 > > five.result <- fa(five.data, nfactors=2, rotate="varimax") > cortest.bartlett(five.data, n=263) R was not square, finding R from data $chisq [1] 247.9806 $p.value [1] 1.442618e-47 $df [1] 10 > KMO(five.data) Kaiser-Meyer-Olkin factor adequacy Call: KMO(r = five.data) Overall MSA = 0.74 MSA for each item = 国語 社会 英語 数学 理科 0.76 0.74 0.76 0.71 0.73 > datafile <- read.csv("i://r//kmotest.csv") > head(datafile) v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 1 20 22 24 20 24 27 22 19 15 64 2 43 47 48 69 68 72 66 61 60 20 3 66 69 65 63 67 62 67 66 61 22 4 22 20 24 69 70 70 30 28 24 35 5 39 36 39 48 43 45 25 24 25 66 6 38 42 43 49 47 42 60 64 67 55 > KOM(datafile) KOM(datafile) でエラー: 関数 "KOM" を見つけることができませんでした > KMO(datafile) Kaiser-Meyer-Olkin factor adequacy Call: KMO(r = datafile) Overall MSA = 0.75 MSA for each item = v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 0.81 0.69 0.82 0.78 0.65 0.78 0.79 0.67 0.80 0.47 > fa(five.data, nfactors=2, fm="ml", rotate="varimax") Factor Analysis using method = ml Call: fa(r = five.data, nfactors = 2, rotate = "varimax", fm = "ml") Standardized loadings (pattern matrix) based upon correlation matrix ML1 ML2 h2 u2 com 国語 0.30 0.59 0.44 0.56 1.5 社会 0.06 0.52 0.27 0.73 1.0 英語 0.42 0.54 0.47 0.53 1.9 数学 0.82 0.17 0.70 0.30 1.1 理科 0.56 0.22 0.36 0.64 1.3 ML1 ML2 SS loadings 1.27 0.99 Proportion Var 0.25 0.20 Cumulative Var 0.25 0.45 Proportion Explained 0.56 0.44 Cumulative Proportion 0.56 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 10 and the objective function was 0.96 with Chi Square of 247.98 The degrees of freedom for the model are 1 and the objective function was 0 The root mean square of the residuals (RMSR) is 0.01 The df corrected root mean square of the residuals is 0.02 The harmonic number of observations is 263 with the empirical chi square 0.21 with prob < 0.65 The total number of observations was 263 with Likelihood Chi Square = 0.3 with prob < 0.59 Tucker Lewis Index of factoring reliability = 1.03 RMSEA index = 0 and the 90 % confidence intervals are 0 0.133 BIC = -5.27 Fit based upon off diagonal values = 1 Measures of factor score adequacy ML1 ML2 Correlation of (regression) scores with factors 0.85 0.74 Multiple R square of scores with factors 0.71 0.55 Minimum correlation of possible factor scores 0.43 0.10 > fa(five.data, nfactors=2, fm="ml", rotate="varimax") Factor Analysis using method = ml Call: fa(r = five.data, nfactors = 2, rotate = "varimax", fm = "ml") Standardized loadings (pattern matrix) based upon correlation matrix ML1 ML2 h2 u2 com 国語 0.30 0.59 0.44 0.56 1.5 社会 0.06 0.52 0.27 0.73 1.0 英語 0.42 0.54 0.47 0.53 1.9 数学 0.82 0.17 0.70 0.30 1.1 理科 0.56 0.22 0.36 0.64 1.3 ML1 ML2 SS loadings 1.27 0.99 Proportion Var 0.25 0.20 Cumulative Var 0.25 0.45 Proportion Explained 0.56 0.44 Cumulative Proportion 0.56 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 10 and the objective function was 0.96 with Chi Square of 247.98 The degrees of freedom for the model are 1 and the objective function was 0 The root mean square of the residuals (RMSR) is 0.01 The df corrected root mean square of the residuals is 0.02 The harmonic number of observations is 263 with the empirical chi square 0.21 with prob < 0.65 The total number of observations was 263 with Likelihood Chi Square = 0.3 with prob < 0.59 Tucker Lewis Index of factoring reliability = 1.03 RMSEA index = 0 and the 90 % confidence intervals are 0 0.133 BIC = -5.27 Fit based upon off diagonal values = 1 Measures of factor score adequacy ML1 ML2 Correlation of (regression) scores with factors 0.85 0.74 Multiple R square of scores with factors 0.71 0.55 Minimum correlation of possible factor scores 0.43 0.10 > fa(five.data, nfactors=2, fm="uls", rotate="varimax") Factor Analysis using method = uls Call: fa(r = five.data, nfactors = 2, rotate = "varimax", fm = "uls") Standardized loadings (pattern matrix) based upon correlation matrix ULS1 ULS2 h2 u2 com 国語 0.29 0.60 0.44 0.56 1.5 社会 0.06 0.51 0.27 0.73 1.0 英語 0.42 0.55 0.48 0.52 1.9 数学 0.83 0.17 0.71 0.29 1.1 理科 0.56 0.22 0.36 0.64 1.3 ULS1 ULS2 SS loadings 1.26 1.00 Proportion Var 0.25 0.20 Cumulative Var 0.25 0.45 Proportion Explained 0.56 0.44 Cumulative Proportion 0.56 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 10 and the objective function was 0.96 with Chi Square of 247.98 The degrees of freedom for the model are 1 and the objective function was 0 The root mean square of the residuals (RMSR) is 0.01 The df corrected root mean square of the residuals is 0.02 The harmonic number of observations is 263 with the empirical chi square 0.19 with prob < 0.66 The total number of observations was 263 with Likelihood Chi Square = 0.31 with prob < 0.58 Tucker Lewis Index of factoring reliability = 1.029 RMSEA index = 0 and the 90 % confidence intervals are 0 0.134 BIC = -5.26 Fit based upon off diagonal values = 1 Measures of factor score adequacy ULS1 ULS2 Correlation of (regression) scores with factors 0.85 0.74 Multiple R square of scores with factors 0.72 0.55 Minimum correlation of possible factor scores 0.44 0.11 > > fa(five.data, nfactors=2, fm="gls", rotate="varimax") Factor Analysis using method = gls Call: fa(r = five.data, nfactors = 2, rotate = "varimax", fm = "gls") Standardized loadings (pattern matrix) based upon correlation matrix GLS1 GLS2 h2 u2 com 国語 0.30 0.60 0.44 0.56 1.5 社会 0.06 0.51 0.27 0.73 1.0 英語 0.42 0.54 0.47 0.53 1.9 数学 0.82 0.17 0.70 0.30 1.1 理科 0.56 0.22 0.36 0.64 1.3 GLS1 GLS2 SS loadings 1.26 0.99 Proportion Var 0.25 0.20 Cumulative Var 0.25 0.45 Proportion Explained 0.56 0.44 Cumulative Proportion 0.56 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 10 and the objective function was 0.96 with Chi Square of 247.98 The degrees of freedom for the model are 1 and the objective function was 0 The root mean square of the residuals (RMSR) is 0.01 The df corrected root mean square of the residuals is 0.02 The harmonic number of observations is 263 with the empirical chi square 0.19 with prob < 0.66 The total number of observations was 263 with Likelihood Chi Square = 0.31 with prob < 0.58 Tucker Lewis Index of factoring reliability = 1.029 RMSEA index = 0 and the 90 % confidence intervals are 0 0.134 BIC = -5.26 Fit based upon off diagonal values = 1 Measures of factor score adequacy GLS1 GLS2 Correlation of (regression) scores with factors 0.84 0.74 Multiple R square of scores with factors 0.71 0.55 Minimum correlation of possible factor scores 0.43 0.11 > > fa(five.data, nfactors=2, fm="pa", rotate="varimax") Factor Analysis using method = pa Call: fa(r = five.data, nfactors = 2, rotate = "varimax", fm = "pa") Standardized loadings (pattern matrix) based upon correlation matrix PA1 PA2 h2 u2 com 国語 0.30 0.60 0.44 0.56 1.5 社会 0.07 0.51 0.27 0.73 1.0 英語 0.43 0.54 0.48 0.52 1.9 数学 0.81 0.17 0.68 0.32 1.1 理科 0.57 0.21 0.37 0.63 1.3 PA1 PA2 SS loadings 1.26 0.98 Proportion Var 0.25 0.20 Cumulative Var 0.25 0.45 Proportion Explained 0.56 0.44 Cumulative Proportion 0.56 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 10 and the objective function was 0.96 with Chi Square of 247.98 The degrees of freedom for the model are 1 and the objective function was 0 The root mean square of the residuals (RMSR) is 0.01 The df corrected root mean square of the residuals is 0.02 The harmonic number of observations is 263 with the empirical chi square 0.21 with prob < 0.65 The total number of observations was 263 with Likelihood Chi Square = 0.32 with prob < 0.57 Tucker Lewis Index of factoring reliability = 1.029 RMSEA index = 0 and the 90 % confidence intervals are 0 0.135 BIC = -5.25 Fit based upon off diagonal values = 1 Measures of factor score adequacy PA1 PA2 Correlation of (regression) scores with factors 0.84 0.74 Multiple R square of scores with factors 0.70 0.55 Minimum correlation of possible factor scores 0.39 0.10 > set.data <- read.csv("i://r//set_data.csv") > head(set.data) q1 q2 q3 q4 q5 q6 q7 q8 q9 1 3 4 3 3 4 4 5 5 5 2 4 4 3 4 4 3 4 4 4 3 4 5 3 5 5 5 5 5 5 4 3 4 1 4 3 5 2 5 2 5 4 4 3 4 4 4 4 5 5 6 3 4 1 3 3 3 3 5 3 > fa.parellel(set.data, fm="ml") fa.parellel(set.data, fm = "ml") でエラー: 関数 "fa.parellel" を見つけることができませんでした > fa.parallel(set.data, fm="ml") Parallel analysis suggests that the number of factors = 3 and the number of components = 1 > eigen.result <- fa.parallel(set.data, fm="ml") Parallel analysis suggests that the number of factors = 3 and the number of components = 1 > eigen.result$pc.values [1] 4.1766560 1.0261862 0.8859122 0.8348285 0.6412555 0.5623923 0.3629904 0.3531334 [9] 0.1566455 > eigen.result$fa.values [1] 3.674453895 0.425458809 0.215007552 [4] 0.044625036 -0.002145536 -0.050397496 [7] -0.171665733 -0.230024745 -0.348227333 > mean(eigen.result$fa.values) [1] 0.3952316 > VSS(set.data) Very Simple Structure Call: vss(x = x, n = n, rotate = rotate, diagonal = diagonal, fm = fm, n.obs = n.obs, plot = plot, title = title, use = use, cor = cor) VSS complexity 1 achieves a maximimum of 0.82 with 1 factors VSS complexity 2 achieves a maximimum of 0.85 with 2 factors The Velicer MAP achieves a minimum of 0.04 with 1 factors BIC achieves a minimum of NA with 3 factors Sample Size adjusted BIC achieves a minimum of NA with 4 factors Statistics by number of factors vss1 vss2 map dof chisq prob sqresid 1 0.82 0.00 0.044 27 1.8e+02 2.6e-24 3.9 2 0.59 0.85 0.063 19 6.5e+01 6.4e-07 3.1 3 0.48 0.76 0.072 12 1.8e+01 1.2e-01 2.6 4 0.54 0.77 0.118 6 3.2e+00 7.8e-01 1.8 5 0.52 0.69 0.227 1 3.3e-02 8.6e-01 1.3 6 0.47 0.70 0.304 -3 2.7e-07 NA 1.7 7 0.46 0.66 0.525 -6 4.2e-08 NA 1.7 8 0.46 0.66 1.000 -8 3.3e-11 NA 1.6 fit RMSEA BIC SABIC complex eChisq SRMR 1 0.82 0.150 28.8 114.4 1.0 1.0e+02 7.4e-02 2 0.85 0.099 -40.6 19.7 1.5 4.0e+01 4.6e-02 3 0.88 0.046 -48.6 -10.6 1.7 1.3e+01 2.6e-02 4 0.92 0.000 -30.1 -11.0 1.8 1.4e+00 8.7e-03 5 0.94 0.000 -5.5 -2.3 1.9 6.3e-03 5.8e-04 6 0.92 NA NA NA 2.0 5.4e-08 1.7e-06 7 0.92 NA NA NA 2.1 1.0e-08 7.4e-07 8 0.92 NA NA NA 2.1 6.5e-12 1.9e-08 eCRMS eBIC 1 0.0858 -47.7 2 0.0640 -65.5 3 0.0457 -53.7 4 0.0213 -31.9 5 0.0035 -5.5 6 NA NA 7 NA NA 8 NA NA > > fa.loading <- fa(set.data, nfactors=6, rotate="varimax")$loadings > print(fa.loading, cut=0.3, digits=3) Loadings: MR1 MR2 MR4 MR3 MR6 MR5 q1 0.756 0.301 q2 0.372 0.474 0.338 q3 0.652 q4 0.929 q5 0.561 0.334 0.324 q6 0.770 q7 0.523 q8 0.580 q9 0.556 MR1 MR2 MR4 MR3 MR6 MR5 SS loadings 2.043 1.397 0.893 0.835 0.245 0.054 Proportion Var 0.227 0.155 0.099 0.093 0.027 0.006 Cumulative Var 0.227 0.382 0.481 0.574 0.601 0.608 > fa.loading <- fa(set.data, nfactors=3, rotate="varimax")$loadings > print(fa.loading, cut=0.3, digits=3) Loadings: MR1 MR2 MR3 q1 0.949 q2 0.411 0.406 q3 0.512 q4 0.925 q5 0.534 0.328 0.455 q6 0.741 0.394 q7 0.487 q8 0.537 q9 0.442 MR1 MR2 MR3 SS loadings 1.939 1.636 1.374 Proportion Var 0.215 0.182 0.153 Cumulative Var 0.215 0.397 0.550 > fa.result <- fa(set.data, nfactors=2, rotate="none") > print(fa.resutl, digits=3) print(fa.resutl, digits = 3) でエラー: オブジェクト 'fa.resutl' がありません > print(fa.result, digits=3) Factor Analysis using method = minres Call: fa(r = set.data, nfactors = 2, rotate = "none") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 h2 u2 com q1 0.733 0.513 0.801 0.199 1.79 q2 0.606 0.151 0.390 0.610 1.12 q3 0.489 0.340 0.354 0.646 1.78 q4 0.823 -0.271 0.751 0.249 1.21 q5 0.776 -0.098 0.612 0.388 1.03 q6 0.829 -0.344 0.805 0.195 1.33 q7 0.511 -0.074 0.266 0.734 1.04 q8 0.418 -0.049 0.177 0.823 1.03 q9 0.459 0.020 0.211 0.789 1.00 MR1 MR2 SS loadings 3.757 0.611 Proportion Var 0.417 0.068 Cumulative Var 0.417 0.485 Proportion Explained 0.860 0.140 Cumulative Proportion 0.860 1.000 Mean item complexity = 1.3 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 36 and the objective function was 3.774 with Chi Square of 951.739 The degrees of freedom for the model are 19 and the objective function was 0.259 The root mean square of the residuals (RMSR) is 0.046 The df corrected root mean square of the residuals is 0.064 The harmonic number of observations is 257 with the empirical chi square 39.949 with prob < 0.00332 The total number of observations was 257 with Likelihood Chi Square = 64.857 with prob < 6.44e-07 Tucker Lewis Index of factoring reliability = 0.9046 RMSEA index = 0.0985 and the 90 % confidence intervals are 0.0718 0.1235 BIC = -40.576 Fit based upon off diagonal values = 0.987 Measures of factor score adequacy MR1 MR2 Correlation of (regression) scores with factors 0.959 0.848 Multiple R square of scores with factors 0.920 0.719 Minimum correlation of possible factor scores 0.840 0.438 > > fa.plot(fa.result) > fa.plot(fa.result, labels=colnames(set.data)) > fa.result <- fa(set.data, nfactors=2, rotate="varimax") > print(fa.result, digits=3) Factor Analysis using method = minres Call: fa(r = set.data, nfactors = 2, rotate = "varimax") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 h2 u2 com q1 0.284 0.849 0.801 0.199 1.22 q2 0.397 0.482 0.390 0.610 1.93 q3 0.190 0.564 0.354 0.646 1.23 q4 0.823 0.272 0.751 0.249 1.22 q5 0.682 0.383 0.612 0.388 1.57 q6 0.871 0.217 0.805 0.195 1.12 q7 0.455 0.244 0.266 0.734 1.53 q8 0.365 0.209 0.177 0.823 1.59 q9 0.357 0.289 0.211 0.789 1.92 MR1 MR2 SS loadings 2.643 1.725 Proportion Var 0.294 0.192 Cumulative Var 0.294 0.485 Proportion Explained 0.605 0.395 Cumulative Proportion 0.605 1.000 Mean item complexity = 1.5 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 36 and the objective function was 3.774 with Chi Square of 951.739 The degrees of freedom for the model are 19 and the objective function was 0.259 The root mean square of the residuals (RMSR) is 0.046 The df corrected root mean square of the residuals is 0.064 The harmonic number of observations is 257 with the empirical chi square 39.949 with prob < 0.00332 The total number of observations was 257 with Likelihood Chi Square = 64.857 with prob < 6.44e-07 Tucker Lewis Index of factoring reliability = 0.9046 RMSEA index = 0.0985 and the 90 % confidence intervals are 0.0718 0.1235 BIC = -40.576 Fit based upon off diagonal values = 0.987 Measures of factor score adequacy MR1 MR2 Correlation of (regression) scores with factors 0.923 0.887 Multiple R square of scores with factors 0.852 0.787 Minimum correlation of possible factor scores 0.705 0.573 > > fa.result <- fa(set.data, nfactors=2, rotate="quartimin") > print(fa.result, digits=3) Factor Analysis using method = minres Call: fa(r = set.data, nfactors = 2, rotate = "quartimin") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 h2 u2 com q1 -0.004 0.898 0.801 0.199 1.00 q2 0.276 0.419 0.390 0.610 1.73 q3 -0.001 0.596 0.354 0.646 1.00 q4 0.862 0.008 0.751 0.249 1.00 q5 0.651 0.194 0.612 0.388 1.18 q6 0.940 -0.075 0.805 0.195 1.01 q7 0.439 0.116 0.266 0.734 1.14 q8 0.347 0.108 0.177 0.823 1.19 q9 0.305 0.206 0.211 0.789 1.76 MR1 MR2 SS loadings 2.727 1.641 Proportion Var 0.303 0.182 Cumulative Var 0.303 0.485 Proportion Explained 0.624 0.376 Cumulative Proportion 0.624 1.000 With factor correlations of MR1 MR2 MR1 1.000 0.596 MR2 0.596 1.000 Mean item complexity = 1.2 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 36 and the objective function was 3.774 with Chi Square of 951.739 The degrees of freedom for the model are 19 and the objective function was 0.259 The root mean square of the residuals (RMSR) is 0.046 The df corrected root mean square of the residuals is 0.064 The harmonic number of observations is 257 with the empirical chi square 39.949 with prob < 0.00332 The total number of observations was 257 with Likelihood Chi Square = 64.857 with prob < 6.44e-07 Tucker Lewis Index of factoring reliability = 0.9046 RMSEA index = 0.0985 and the 90 % confidence intervals are 0.0718 0.1235 BIC = -40.576 Fit based upon off diagonal values = 0.987 Measures of factor score adequacy MR1 MR2 Correlation of (regression) scores with factors 0.950 0.923 Multiple R square of scores with factors 0.902 0.851 Minimum correlation of possible factor scores 0.803 0.702 > > fa.result <- fa(set.data, nfactors=2, rotate="quartimin") > print(fa.result, digits=3) Factor Analysis using method = minres Call: fa(r = set.data, nfactors = 2, rotate = "quartimin") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 h2 u2 com q1 -0.004 0.898 0.801 0.199 1.00 q2 0.276 0.419 0.390 0.610 1.73 q3 -0.001 0.596 0.354 0.646 1.00 q4 0.862 0.008 0.751 0.249 1.00 q5 0.651 0.194 0.612 0.388 1.18 q6 0.940 -0.075 0.805 0.195 1.01 q7 0.439 0.116 0.266 0.734 1.14 q8 0.347 0.108 0.177 0.823 1.19 q9 0.305 0.206 0.211 0.789 1.76 MR1 MR2 SS loadings 2.727 1.641 Proportion Var 0.303 0.182 Cumulative Var 0.303 0.485 Proportion Explained 0.624 0.376 Cumulative Proportion 0.624 1.000 With factor correlations of MR1 MR2 MR1 1.000 0.596 MR2 0.596 1.000 Mean item complexity = 1.2 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 36 and the objective function was 3.774 with Chi Square of 951.739 The degrees of freedom for the model are 19 and the objective function was 0.259 The root mean square of the residuals (RMSR) is 0.046 The df corrected root mean square of the residuals is 0.064 The harmonic number of observations is 257 with the empirical chi square 39.949 with prob < 0.00332 The total number of observations was 257 with Likelihood Chi Square = 64.857 with prob < 6.44e-07 Tucker Lewis Index of factoring reliability = 0.9046 RMSEA index = 0.0985 and the 90 % confidence intervals are 0.0718 0.1235 BIC = -40.576 Fit based upon off diagonal values = 0.987 Measures of factor score adequacy MR1 MR2 Correlation of (regression) scores with factors 0.950 0.923 Multiple R square of scores with factors 0.902 0.851 Minimum correlation of possible factor scores 0.803 0.702 > fa.result Factor Analysis using method = minres Call: fa(r = set.data, nfactors = 2, rotate = "quartimin") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 h2 u2 com q1 0.00 0.90 0.80 0.20 1.0 q2 0.28 0.42 0.39 0.61 1.7 q3 0.00 0.60 0.35 0.65 1.0 q4 0.86 0.01 0.75 0.25 1.0 q5 0.65 0.19 0.61 0.39 1.2 q6 0.94 -0.08 0.80 0.20 1.0 q7 0.44 0.12 0.27 0.73 1.1 q8 0.35 0.11 0.18 0.82 1.2 q9 0.31 0.21 0.21 0.79 1.8 MR1 MR2 SS loadings 2.73 1.64 Proportion Var 0.30 0.18 Cumulative Var 0.30 0.49 Proportion Explained 0.62 0.38 Cumulative Proportion 0.62 1.00 With factor correlations of MR1 MR2 MR1 1.0 0.6 MR2 0.6 1.0 Mean item complexity = 1.2 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 36 and the objective function was 3.77 with Chi Square of 951.74 The degrees of freedom for the model are 19 and the objective function was 0.26 The root mean square of the residuals (RMSR) is 0.05 The df corrected root mean square of the residuals is 0.06 The harmonic number of observations is 257 with the empirical chi square 39.95 with prob < 0.0033 The total number of observations was 257 with Likelihood Chi Square = 64.86 with prob < 6.4e-07 Tucker Lewis Index of factoring reliability = 0.905 RMSEA index = 0.099 and the 90 % confidence intervals are 0.072 0.124 BIC = -40.58 Fit based upon off diagonal values = 0.99 Measures of factor score adequacy MR1 MR2 Correlation of (regression) scores with factors 0.95 0.92 Multiple R square of scores with factors 0.90 0.85 Minimum correlation of possible factor scores 0.80 0.70 > print(fa.result$Structure, digits=3) Loadings: MR1 MR2 q1 0.531 0.895 q2 0.526 0.584 q3 0.354 0.595 q4 0.867 0.522 q5 0.767 0.582 q6 0.895 0.485 q7 0.507 0.377 q8 0.412 0.315 q9 0.428 0.388 MR1 MR2 SS loadings 3.434 2.734 Proportion Var 0.382 0.304 Cumulative Var 0.382 0.685 > fa.result <- fa(set.data, nfactors=3, rotate="varimax") > print(fa.result, digits=3) Factor Analysis using method = minres Call: fa(r = set.data, nfactors = 3, rotate = "varimax") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 MR3 h2 u2 com q1 0.209 0.949 0.206 0.986 0.0141 1.19 q2 0.248 0.411 0.406 0.395 0.6048 2.63 q3 0.170 0.512 0.170 0.320 0.6803 1.45 q4 0.925 0.262 0.235 0.980 0.0202 1.30 q5 0.534 0.328 0.455 0.599 0.4009 2.65 q6 0.741 0.223 0.394 0.754 0.2463 1.73 q7 0.260 0.159 0.487 0.330 0.6700 1.77 q8 0.135 0.100 0.537 0.317 0.6832 1.20 q9 0.172 0.209 0.442 0.269 0.7311 1.76 MR1 MR2 MR3 SS loadings 1.939 1.636 1.374 Proportion Var 0.215 0.182 0.153 Cumulative Var 0.215 0.397 0.550 Proportion Explained 0.392 0.330 0.278 Cumulative Proportion 0.392 0.722 1.000 Mean item complexity = 1.7 Test of the hypothesis that 3 factors are sufficient. The degrees of freedom for the null model are 36 and the objective function was 3.774 with Chi Square of 951.739 The degrees of freedom for the model are 12 and the objective function was 0.072 The root mean square of the residuals (RMSR) is 0.026 The df corrected root mean square of the residuals is 0.046 The harmonic number of observations is 257 with the empirical chi square 12.901 with prob < 0.376 The total number of observations was 257 with Likelihood Chi Square = 17.967 with prob < 0.117 Tucker Lewis Index of factoring reliability = 0.9803 RMSEA index = 0.0456 and the 90 % confidence intervals are 0 0.0836 BIC = -48.622 Fit based upon off diagonal values = 0.996 Measures of factor score adequacy MR1 MR2 MR3 Correlation of (regression) scores with factors 0.976 0.985 0.757 Multiple R square of scores with factors 0.953 0.971 0.573 Minimum correlation of possible factor scores 0.905 0.942 0.146 > fa.result <- fa(set.data, nfactors=3, rotate="promax", pro.m=2, fm="ml") > print(fa.result, digits=3) Factor Analysis using method = ml Call: fa(r = set.data, nfactors = 3, rotate = "promax", fm = "ml", pro.m = 2) Standardized loadings (pattern matrix) based upon correlation matrix ML2 ML1 ML3 h2 u2 com q1 0.027 0.986 -0.001 0.995 0.005 1.00 q2 0.128 0.358 0.311 0.407 0.593 2.24 q3 0.069 0.495 0.063 0.311 0.689 1.07 q4 0.963 0.074 -0.014 0.979 0.021 1.01 q5 0.460 0.158 0.338 0.599 0.401 2.11 q6 0.722 0.047 0.216 0.751 0.249 1.19 q7 0.204 0.065 0.392 0.305 0.695 1.57 q8 0.017 -0.026 0.586 0.341 0.659 1.01 q9 0.048 0.124 0.432 0.272 0.728 1.19 ML2 ML1 ML3 SS loadings 2.062 1.635 1.264 Proportion Var 0.229 0.182 0.140 Cumulative Var 0.229 0.411 0.551 Proportion Explained 0.416 0.330 0.255 Cumulative Proportion 0.416 0.745 1.000 With factor correlations of ML2 ML1 ML3 ML2 1.000 0.418 0.460 ML1 0.418 1.000 0.408 ML3 0.460 0.408 1.000 Mean item complexity = 1.4 Test of the hypothesis that 3 factors are sufficient. The degrees of freedom for the null model are 36 and the objective function was 3.774 with Chi Square of 951.739 The degrees of freedom for the model are 12 and the objective function was 0.066 The root mean square of the residuals (RMSR) is 0.028 The df corrected root mean square of the residuals is 0.048 The harmonic number of observations is 257 with the empirical chi square 14.042 with prob < 0.298 The total number of observations was 257 with Likelihood Chi Square = 16.557 with prob < 0.167 Tucker Lewis Index of factoring reliability = 0.9849 RMSEA index = 0.0401 and the 90 % confidence intervals are 0 0.0795 BIC = -50.032 Fit based upon off diagonal values = 0.995 Measures of factor score adequacy ML2 ML1 ML3 Correlation of (regression) scores with factors 0.990 0.997 0.818 Multiple R square of scores with factors 0.979 0.995 0.668 Minimum correlation of possible factor scores 0.958 0.990 0.337 > > fa.plot(fa.result, label=colnames(set.data)) > > head(five.data) 国語 社会 英語 数学 理科 1 3 3 4 5 5 2 4 3 4 4 4 3 5 3 5 5 5 4 4 1 4 5 5 5 4 3 4 4 5 6 3 1 4 5 5 > head(scale(five.data)) 国語 社会 英語 数学 理科 [1,] -1.2409697 0.1665481 -0.01741029 0.9374445 0.6698173 [2,] -0.1116443 0.1665481 -0.01741029 -0.4959736 -1.0079156 [3,] 1.0176810 0.1665481 1.12731614 0.9374445 0.6698173 [4,] -0.1116443 -1.6212947 -0.01741029 0.9374445 0.6698173 [5,] -0.1116443 0.1665481 -0.01741029 -0.4959736 0.6698173 [6,] -1.2409697 -1.6212947 -0.01741029 0.9374445 0.6698173 > s5.result <- fa(five.data, nfactors=2, rotate="varimax") > head(s5.result$scores) MR1 MR2 [1,] 0.8110161 -0.6000709 [2,] -0.5607036 0.0602164 [3,] 0.8489924 0.6955967 [4,] 0.9299796 -0.6795608 [5,] -0.2404849 0.1011289 [6,] 0.9522590 -1.1324947 > s5.result$loadings Loadings: MR1 MR2 国語 0.294 0.598 社会 0.512 英語 0.422 0.546 数学 0.827 0.169 理科 0.557 0.223 MR1 MR2 SS loadings 1.263 0.997 Proportion Var 0.253 0.199 Cumulative Var 0.253 0.452 > s5.result Factor Analysis using method = minres Call: fa(r = five.data, nfactors = 2, rotate = "varimax") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 h2 u2 com 国語 0.29 0.60 0.44 0.56 1.5 社会 0.06 0.51 0.27 0.73 1.0 英語 0.42 0.55 0.48 0.52 1.9 数学 0.83 0.17 0.71 0.29 1.1 理科 0.56 0.22 0.36 0.64 1.3 MR1 MR2 SS loadings 1.26 1.00 Proportion Var 0.25 0.20 Cumulative Var 0.25 0.45 Proportion Explained 0.56 0.44 Cumulative Proportion 0.56 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 10 and the objective function was 0.96 with Chi Square of 247.98 The degrees of freedom for the model are 1 and the objective function was 0 The root mean square of the residuals (RMSR) is 0.01 The df corrected root mean square of the residuals is 0.02 The harmonic number of observations is 263 with the empirical chi square 0.19 with prob < 0.66 The total number of observations was 263 with Likelihood Chi Square = 0.31 with prob < 0.58 Tucker Lewis Index of factoring reliability = 1.029 RMSEA index = 0 and the 90 % confidence intervals are 0 0.134 BIC = -5.26 Fit based upon off diagonal values = 1 Measures of factor score adequacy MR1 MR2 Correlation of (regression) scores with factors 0.85 0.74 Multiple R square of scores with factors 0.72 0.55 Minimum correlation of possible factor scores 0.44 0.11 > pa.result <- principal(five.data, nfactors=2, rotate="none") > print(pa.result,digits=3) Principal Components Analysis Call: principal(r = five.data, nfactors = 2, rotate = "none") Standardized loadings (pattern matrix) based upon correlation matrix PC1 PC2 h2 u2 com 国語 0.712 0.277 0.584 0.416 1.30 社会 0.498 0.722 0.769 0.231 1.78 英語 0.769 0.076 0.598 0.402 1.02 数学 0.735 -0.424 0.720 0.280 1.60 理科 0.684 -0.444 0.665 0.335 1.71 PC1 PC2 SS loadings 2.355 0.981 Proportion Var 0.471 0.196 Cumulative Var 0.471 0.667 Proportion Explained 0.706 0.294 Cumulative Proportion 0.706 1.000 Mean item complexity = 1.5 Test of the hypothesis that 2 components are sufficient. The root mean square of the residuals (RMSR) is 0.134 with the empirical chi square 94.842 with prob < 2.06e-22 Fit based upon off diagonal values = 0.853> > library(lavaan) This is lavaan 0.5-23.1097 lavaan is BETA software! Please report any bugs. 次のパッケージを付け加えます: ‘lavaan’ 以下のオブジェクトは ‘package:psych’ からマスクされています: cor2cov > model0 <- 'f1 =~ q1 + q2 + q3 + f2 =~ q4 + q5 + q6 + f3 =~ q7 + q8 + q9 + f1 ~~ f2 + f2 ~~ f3 + f3 ~~ f1' > model0 [1] "f1 =~ q1 + q2 + q3\nf2 =~ q4 + q5 + q6\nf3 =~ q7 + q8 + q9\nf1 ~~ f2\nf2 ~~ f3\nf3 ~~ f1" > fit0 <- sem(model0, data=set.data, estimator="ml") > summary(object=fit0, fit.measure=TRUE) lavaan (0.5-23.1097) converged normally after 33 iterations Number of observations 257 Estimator ML Minimum Function Test Statistic 60.107 Degrees of freedom 24 P-value (Chi-square) 0.000 Model test baseline model: Minimum Function Test Statistic 969.982 Degrees of freedom 36 P-value 0.000 User model versus baseline model: Comparative Fit Index (CFI) 0.961 Tucker-Lewis Index (TLI) 0.942 Loglikelihood and Information Criteria: Loglikelihood user model (H0) -2499.016 Loglikelihood unrestricted model (H1) -2468.963 Number of free parameters 21 Akaike (AIC) 5040.032 Bayesian (BIC) 5114.563 Sample-size adjusted Bayesian (BIC) 5047.987 Root Mean Square Error of Approximation: RMSEA 0.077 90 Percent Confidence Interval 0.053 0.101 P-value RMSEA <= 0.05 0.036 Standardized Root Mean Square Residual: SRMR 0.051 Parameter Estimates: Information Expected Standard Errors Standard Latent Variables: Estimate Std.Err z-value P(>|z|) f1 =~ q1 1.000 q2 0.708 0.076 9.254 0.000 q3 0.836 0.096 8.698 0.000 f2 =~ q4 1.000 q5 0.828 0.055 15.103 0.000 q6 0.970 0.048 20.296 0.000 f3 =~ q7 1.000 q8 0.516 0.092 5.614 0.000 q9 0.894 0.141 6.335 0.000 Covariances: Estimate Std.Err z-value P(>|z|) f1 ~~ f2 0.419 0.056 7.491 0.000 f2 ~~ f3 0.315 0.049 6.465 0.000 f1 ~~ f3 0.275 0.048 5.762 0.000 Variances: Estimate Std.Err z-value P(>|z|) .q1 0.226 0.051 4.386 0.000 .q2 0.445 0.047 9.374 0.000 .q3 0.781 0.079 9.829 0.000 .q4 0.123 0.023 5.316 0.000 .q5 0.352 0.035 10.018 0.000 .q6 0.149 0.023 6.359 0.000 .q7 0.434 0.055 7.873 0.000 .q8 0.280 0.028 10.000 0.000 .q9 0.527 0.058 9.153 0.000 f1 0.626 0.087 7.226 0.000 f2 0.667 0.072 9.285 0.000 f3 0.295 0.065 4.534 0.000 > > standardizeSolution(fit0) standardizeSolution(fit0) でエラー: 関数 "standardizeSolution" を見つけることができませんでした > standardizedSolution(fit0) lhs op rhs est.std se z pvalue 1 f1 =~ q1 0.857 0.036 23.502 0 2 f1 =~ q2 0.643 0.046 14.062 0 3 f1 =~ q3 0.599 0.048 12.398 0 4 f2 =~ q4 0.919 0.017 53.631 0 5 f2 =~ q5 0.752 0.030 24.802 0 6 f2 =~ q6 0.899 0.018 49.002 0 7 f3 =~ q7 0.636 0.057 11.249 0 8 f3 =~ q8 0.469 0.062 7.498 0 9 f3 =~ q9 0.556 0.059 9.459 0 10 f1 ~~ f2 0.649 0.049 13.345 0 11 f2 ~~ f3 0.711 0.060 11.877 0 12 f1 ~~ f3 0.640 0.071 8.963 0 13 q1 ~~ q1 0.265 0.063 4.239 0 14 q2 ~~ q2 0.587 0.059 9.985 0 15 q3 ~~ q3 0.641 0.058 11.074 0 16 q4 ~~ q4 0.156 0.031 4.954 0 17 q5 ~~ q5 0.435 0.046 9.544 0 18 q6 ~~ q6 0.192 0.033 5.820 0 19 q7 ~~ q7 0.595 0.072 8.261 0 20 q8 ~~ q8 0.780 0.059 13.321 0 21 q9 ~~ q9 0.691 0.065 10.560 0 22 f1 ~~ f1 1.000 0.000 NA NA 23 f2 ~~ f2 1.000 0.000 NA NA 24 f3 ~~ f3 1.000 0.000 NA NA > model2 <- 'f1 =~ q1 + q2 + q3 + f2 =~ q4 + q5 + q6 + f3 =~ q7 + q8 + q9 + f3 ~ f2 + f2 ~ f1 + q1 ~~ q3 + q4 ~~ q6 + q2 ~~ q8' > fit0 <- sem(model2, data=set.data, estimator="ml") > summary(object=fit0, fit.measure=TRUE) lavaan (0.5-23.1097) converged normally after 33 iterations Number of observations 257 Estimator ML Minimum Function Test Statistic 21.617 Degrees of freedom 22 P-value (Chi-square) 0.483 Model test baseline model: Minimum Function Test Statistic 969.982 Degrees of freedom 36 P-value 0.000 User model versus baseline model: Comparative Fit Index (CFI) 1.000 Tucker-Lewis Index (TLI) 1.001 Loglikelihood and Information Criteria: Loglikelihood user model (H0) -2479.771 Loglikelihood unrestricted model (H1) -2468.963 Number of free parameters 23 Akaike (AIC) 5005.542 Bayesian (BIC) 5087.171 Sample-size adjusted Bayesian (BIC) 5014.254 Root Mean Square Error of Approximation: RMSEA 0.000 90 Percent Confidence Interval 0.000 0.051 P-value RMSEA <= 0.05 0.944 Standardized Root Mean Square Residual: SRMR 0.024 Parameter Estimates: Information Expected Standard Errors Standard Latent Variables: Estimate Std.Err z-value P(>|z|) f1 =~ q1 1.000 q2 0.844 0.097 8.741 0.000 q3 0.762 0.099 7.720 0.000 f2 =~ q4 1.000 q5 1.047 0.084 12.463 0.000 q6 0.965 0.049 19.644 0.000 f3 =~ q7 1.000 q8 0.535 0.094 5.693 0.000 q9 0.916 0.144 6.353 0.000 Regressions: Estimate Std.Err z-value P(>|z|) f3 ~ f2 0.594 0.077 7.742 0.000 f2 ~ f1 0.782 0.095 8.244 0.000 Covariances: Estimate Std.Err z-value P(>|z|) .q1 ~~ .q3 0.168 0.057 2.925 0.003 .q4 ~~ .q6 0.157 0.035 4.477 0.000 .q2 ~~ .q8 0.080 0.025 3.217 0.001 Variances: Estimate Std.Err z-value P(>|z|) .q1 0.337 0.057 5.909 0.000 .q2 0.392 0.049 7.989 0.000 .q3 0.919 0.095 9.656 0.000 .q4 0.275 0.040 6.958 0.000 .q5 0.244 0.039 6.297 0.000 .q6 0.297 0.040 7.391 0.000 .q7 0.446 0.055 8.167 0.000 .q8 0.277 0.028 9.975 0.000 .q9 0.526 0.057 9.167 0.000 f1 0.514 0.084 6.090 0.000 .f2 0.200 0.044 4.556 0.000 .f3 0.102 0.037 2.740 0.006 > utils:::menuInstallPkgs() --- このセッションで使うために、CRAN のミラーサイトを選んでください --- 警告: 依存対象 (dependency) ‘locfit’ が利用できません 依存対象 (dependency) ‘abc.data’ もインストールします URL 'https://cran.ism.ac.jp/bin/windows/contrib/3.4/abc.data_1.0.zip' を試しています Content type 'application/zip' length 4906722 bytes (4.7 MB) downloaded 4.7 MB URL 'https://cran.ism.ac.jp/bin/windows/contrib/3.4/abc_2.1.zip' を試しています Content type 'application/zip' length 521052 bytes (508 KB) downloaded 508 KB パッケージ ‘abc.data’ は無事に展開され、MD5 サムもチェックされました パッケージ ‘abc’ は無事に展開され、MD5 サムもチェックされました ダウンロードされたパッケージは、以下にあります C:\Users\matsuo\AppData\Local\Temp\RtmpA14cBd\downloaded_packages > search() [1] ".GlobalEnv" "package:lavaan" "package:stats" [4] "package:graphics" "package:grDevices" "package:utils" [7] "package:datasets" "package:GPArotation" "package:psych" [10] "package:methods" "Autoloads" "package:base" > library(abc) 要求されたパッケージ abc.data をロード中です 要求されたパッケージ nnet をロード中です 要求されたパッケージ quantreg をロード中です 要求されたパッケージ SparseM をロード中です 次のパッケージを付け加えます: ‘SparseM’ 以下のオブジェクトは ‘package:base’ からマスクされています: backsolve 要求されたパッケージ MASS をロード中です エラー: パッケージ ‘locfit’ が ‘abc’ によって要求されましたが、見つけられませんでした > search() [1] ".GlobalEnv" "package:MASS" "package:quantreg" [4] "package:SparseM" "package:nnet" "package:abc.data" [7] "package:lavaan" "package:stats" "package:graphics" [10] "package:grDevices" "package:utils" "package:datasets" [13] "package:GPArotation" "package:psych" "package:methods" [16] "Autoloads" "package:base" > ls() [1] "datafile" "dd" "dd1" "dd2" [5] "df" "df_0" "df_1" "df_2" [9] "eigen.result" "eisukoku" "fa.loading" "fa.result" [13] "fit0" "five.data" "five.result" "goukei" [17] "kekka" "model0" "model2" "pa.result" [21] "risha" "s5.result" "set.data" "svm" [25] "svm.model" "x1" "x2" "y" > a.result <- fa(set.data, nfactors=2, rotate="quartimin") > a.result Factor Analysis using method = minres Call: fa(r = set.data, nfactors = 2, rotate = "quartimin") Standardized loadings (pattern matrix) based upon correlation matrix MR1 MR2 h2 u2 com q1 0.00 0.90 0.80 0.20 1.0 q2 0.28 0.42 0.39 0.61 1.7 q3 0.00 0.60 0.35 0.65 1.0 q4 0.86 0.01 0.75 0.25 1.0 q5 0.65 0.19 0.61 0.39 1.2 q6 0.94 -0.08 0.80 0.20 1.0 q7 0.44 0.12 0.27 0.73 1.1 q8 0.35 0.11 0.18 0.82 1.2 q9 0.31 0.21 0.21 0.79 1.8 MR1 MR2 SS loadings 2.73 1.64 Proportion Var 0.30 0.18 Cumulative Var 0.30 0.49 Proportion Explained 0.62 0.38 Cumulative Proportion 0.62 1.00 With factor correlations of MR1 MR2 MR1 1.0 0.6 MR2 0.6 1.0 Mean item complexity = 1.2 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 36 and the objective function was 3.77 with Chi Square of 951.74 The degrees of freedom for the model are 19 and the objective function was 0.26 The root mean square of the residuals (RMSR) is 0.05 The df corrected root mean square of the residuals is 0.06 The harmonic number of observations is 257 with the empirical chi square 39.95 with prob < 0.0033 The total number of observations was 257 with Likelihood Chi Square = 64.86 with prob < 6.4e-07 Tucker Lewis Index of factoring reliability = 0.905 RMSEA index = 0.099 and the 90 % confidence intervals are 0.072 0.124 BIC = -40.58 Fit based upon off diagonal values = 0.99 Measures of factor score adequacy MR1 MR2 Correlation of (regression) scores with factors 0.95 0.92 Multiple R square of scores with factors 0.90 0.85 Minimum correlation of possible factor scores 0.80 0.70 > > set_raw.data <- read.csv("i://r/set.csv") > head(set_raw.data) no q1 q2 q3 q4 q5 q6 q7 q8 q9 1 1 3 4 3 3 4 4 5 5 5 2 2 4 4 3 4 4 3 4 4 4 3 3 4 5 3 5 5 5 5 5 5 4 4 3 4 1 4 3 5 2 5 2 5 5 4 4 3 4 4 4 4 5 5 6 6 3 4 1 3 3 3 3 5 3 > nrow(set_raw.data) [1] 265 > set_raw.data[c(60,70,170),5:10] q4 q5 q6 q7 q8 q9 60 5 5 5 4 5 5 70 5 4 5 4 5 4 170 3 3 4 2 4 3 > set_raw.data[60:62,] no q1 q2 q3 q4 q5 q6 q7 q8 q9 60 60 4 5 3 5 5 5 4 5 5 61 61 5 5 1 5 NA 5 2 5 3 62 62 4 4 3 4 4 4 4 4 4 > set_naomit.data <- na.omit(set_raw.data) > set_naomit.data[60:62,] no q1 q2 q3 q4 q5 q6 q7 q8 q9 60 60 4 5 3 5 5 5 4 5 5 62 62 4 4 3 4 4 4 4 4 4 63 63 2 4 1 3 3 4 3 5 2 > nrow(set_naomit.data) [1] 257 > data1 <- set_naomit.data[c(2,3,4,5,6)] > head(data1) q1 q2 q3 q4 q5 1 3 4 3 3 4 2 4 4 3 4 4 3 4 5 3 5 5 4 3 4 1 4 3 5 4 4 3 4 4 6 3 4 1 3 3 > data2 <- set_naomit.data[-5] > head(data2) no q1 q2 q3 q5 q6 q7 q8 q9 1 1 3 4 3 4 4 5 5 5 2 2 4 4 3 4 3 4 4 4 3 3 4 5 3 5 5 5 5 5 4 4 3 4 1 3 5 2 5 2 5 5 4 4 3 4 4 4 5 5 6 6 3 4 1 3 3 3 5 3 >