Loading required packages
require(foreign) # Read data stored SPSS
## Loading required package: foreign
require(psych)
## Loading required package: psych
#Setting Directory
setwd("~/CES-D")
#Importing SPSS file .sav
base.dat <- read.spss("PD10.sav", to.data.frame = T)
## Warning in read.spss("PD10.sav", to.data.frame = T): PD10.sav: Unrecognized
## record type 7, subtype 18 encountered in system file
## re-encoding from latin1
#Sum CESD itens in order to find NA
base.dat$scaleSum <- rowSums(base.dat[,267:286])
#Creating a subset for analysis without NA
base.CESD <- subset(base.dat, subset=!is.na(base.dat$scaleSum))
#Creating a subset only with CESD
fullScale <- base.CESD[ , 267:286]
## KMO
KMO(fullScale)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = fullScale)
## Overall MSA = 0.91
## MSA for each item =
## F1r F2r F3r F4r F5r F6r F7r F8r F9r F10r F11r F12r F13r F14r F15r
## 0.92 0.91 0.93 0.73 0.93 0.93 0.95 0.78 0.95 0.93 0.92 0.85 0.91 0.94 0.87
## F16r F17r F18r F19r F20r
## 0.85 0.89 0.91 0.89 0.94
# Bartlett Test
bartlett.test(fullScale)
##
## Bartlett test of homogeneity of variances
##
## data: fullScale
## Bartlett's K-squared = 23.704, df = 19, p-value = 0.2077
# Parallel Analysis
faParalel <- fa.parallel.poly(fullScale, fm="minres", fa="both")
## Warning: fa.parallel.poly is deprecated. Please use the fa.parallel
## function with the cor='poly' option.
##
##
##
## See the graphic output for a description of the results
## Parallel analysis suggests that the number of factors = 4 and the number of components = 2
#Polycoric Correlation Matrix
polyAll <- polychoric(fullScale)
PCA2u <- principal(polyAll$rho, nfactors = 2)
print.psych(PCA2u, digits=2, cut= .4)
## Principal Components Analysis
## Call: principal(r = polyAll$rho, nfactors = 2)
## Standardized loadings (pattern matrix) based upon correlation matrix
## PC1 PC2 h2 u2 com
## F1r 0.61 0.41 0.59 1.2
## F2r 0.54 0.30 0.70 1.0
## F3r 0.59 0.39 0.61 1.2
## F4r 0.71 0.51 0.49 1.0
## F5r 0.63 0.40 0.60 1.0
## F6r 0.74 0.61 0.39 1.2
## F7r 0.63 0.41 0.59 1.0
## F8r 0.62 0.38 0.62 1.0
## F9r 0.69 0.50 0.50 1.1
## F10r 0.69 0.51 0.49 1.1
## F11r 0.62 0.42 0.58 1.2
## F12r 0.75 0.67 0.33 1.4
## F13r 0.41 0.21 0.79 1.4
## F14r 0.69 0.59 0.41 1.4
## F15r 0.63 0.42 0.58 1.1
## F16r 0.66 0.52 0.48 1.4
## F17r 0.62 0.39 0.61 1.0
## F18r 0.77 0.67 0.33 1.3
## F19r 0.71 0.54 0.46 1.1
## F20r 0.66 0.50 0.50 1.3
##
## PC1 PC2
## SS loadings 6.89 2.46
## Proportion Var 0.34 0.12
## Cumulative Var 0.34 0.47
## Proportion Explained 0.74 0.26
## Cumulative Proportion 0.74 1.00
##
## Mean item complexity = 1.2
## Test of the hypothesis that 2 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.06
##
## Fit based upon off diagonal values = 0.97
plot.psych(PCA2u)
PCA2 <- principal(polyAll$rho, nfactors = 2, rotate="oblimin")
## Loading required namespace: GPArotation
print.psych(PCA2, digits=2, cut= .4)
## Principal Components Analysis
## Call: principal(r = polyAll$rho, nfactors = 2, rotate = "oblimin")
## Standardized loadings (pattern matrix) based upon correlation matrix
## PC1 PC2 h2 u2 com
## F1r 0.66 0.41 0.59 1.5
## F2r 0.56 0.30 0.70 1.0
## F3r 0.60 0.39 0.61 1.0
## F4r 0.74 0.51 0.49 1.1
## F5r 0.66 0.40 0.60 1.0
## F6r 0.75 0.61 0.39 1.0
## F7r 0.66 0.41 0.59 1.0
## F8r 0.63 0.38 0.62 1.0
## F9r 0.70 0.50 0.50 1.0
## F10r 0.70 0.51 0.49 1.0
## F11r 0.63 0.42 0.58 1.0
## F12r 0.70 0.67 0.33 1.3
## F13r 0.45 0.21 0.79 1.7
## F14r 0.69 0.59 0.41 1.1
## F15r 0.65 0.42 0.58 1.0
## F16r 0.62 0.52 0.48 1.3
## F17r 0.65 0.39 0.61 1.1
## F18r 0.78 0.67 0.33 1.0
## F19r 0.72 0.54 0.46 1.0
## F20r 0.66 0.50 0.50 1.1
##
## PC1 PC2
## SS loadings 7.20 2.15
## Proportion Var 0.36 0.11
## Cumulative Var 0.36 0.47
## Proportion Explained 0.77 0.23
## Cumulative Proportion 0.77 1.00
##
## With component correlations of
## PC1 PC2
## PC1 1.00 -0.31
## PC2 -0.31 1.00
##
## Mean item complexity = 1.1
## Test of the hypothesis that 2 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.06
##
## Fit based upon off diagonal values = 0.97
plot.psych(PCA2)
PCA4u <- principal(polyAll$rho, nfactors = 4)
print.psych(PCA4u, digits=2, cut= .4)
## Principal Components Analysis
## Call: principal(r = polyAll$rho, nfactors = 4)
## Standardized loadings (pattern matrix) based upon correlation matrix
## PC1 PC3 PC4 PC2 h2 u2 com
## F1r 0.57 0.47 0.53 2.0
## F2r 0.72 0.57 0.43 1.2
## F3r 0.67 0.58 0.42 1.6
## F4r 0.70 0.54 0.46 1.2
## F5r 0.46 0.53 0.50 0.50 2.1
## F6r 0.48 0.54 0.66 0.34 3.0
## F7r 0.50 0.50 0.51 0.49 2.1
## F8r 0.63 0.46 0.54 1.3
## F9r 0.50 0.44 0.53 0.47 2.6
## F10r 0.45 0.51 0.49 3.3
## F11r 0.48 0.47 0.51 0.49 2.5
## F12r 0.75 0.70 0.30 1.5
## F13r 0.53 0.34 0.66 1.4
## F14r 0.42 0.58 0.65 0.35 2.7
## F15r 0.78 0.67 0.33 1.2
## F16r 0.66 0.56 0.44 1.6
## F17r 0.66 0.52 0.48 1.4
## F18r 0.40 0.72 0.80 0.20 2.1
## F19r 0.75 0.71 0.29 1.5
## F20r 0.63 0.58 0.42 2.0
##
## PC1 PC3 PC4 PC2
## SS loadings 3.11 3.02 2.87 2.38
## Proportion Var 0.16 0.15 0.14 0.12
## Cumulative Var 0.16 0.31 0.45 0.57
## Proportion Explained 0.27 0.27 0.25 0.21
## Cumulative Proportion 0.27 0.54 0.79 1.00
##
## Mean item complexity = 1.9
## Test of the hypothesis that 4 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.06
##
## Fit based upon off diagonal values = 0.97
plot.psych(PCA4u)
PCA4 <- principal(polyAll$rho, nfactors = 4, rotate="oblimin")
print.psych(PCA4, digits=2, cut= .4)
## Principal Components Analysis
## Call: principal(r = polyAll$rho, nfactors = 4, rotate = "oblimin")
## Standardized loadings (pattern matrix) based upon correlation matrix
## PC4 PC3 PC1 PC2 h2 u2 com
## F1r 0.54 0.47 0.53 1.9
## F2r 0.75 0.57 0.43 1.1
## F3r 0.66 0.58 0.42 1.3
## F4r 0.72 0.54 0.46 1.4
## F5r 0.43 0.47 0.50 0.50 2.1
## F6r 0.47 0.66 0.34 2.3
## F7r 0.47 0.44 0.51 0.49 2.1
## F8r 0.65 0.46 0.54 1.5
## F9r 0.45 0.53 0.47 2.0
## F10r 0.51 0.49 3.0
## F11r 0.41 0.43 0.51 0.49 2.2
## F12r 0.73 0.70 0.30 1.2
## F13r 0.57 0.34 0.66 1.4
## F14r 0.51 0.65 0.35 2.1
## F15r 0.83 0.67 0.33 1.0
## F16r 0.64 0.56 0.44 1.4
## F17r 0.66 0.52 0.48 1.1
## F18r 0.67 0.80 0.20 1.4
## F19r 0.77 0.71 0.29 1.1
## F20r 0.61 0.58 0.42 1.2
##
## PC4 PC3 PC1 PC2
## SS loadings 3.29 2.89 2.86 2.35
## Proportion Var 0.16 0.14 0.14 0.12
## Cumulative Var 0.16 0.31 0.45 0.57
## Proportion Explained 0.29 0.25 0.25 0.21
## Cumulative Proportion 0.29 0.54 0.79 1.00
##
## With component correlations of
## PC4 PC3 PC1 PC2
## PC4 1.00 0.40 0.47 -0.27
## PC3 0.40 1.00 0.38 -0.20
## PC1 0.47 0.38 1.00 -0.20
## PC2 -0.27 -0.20 -0.20 1.00
##
## Mean item complexity = 1.6
## Test of the hypothesis that 4 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.06
##
## Fit based upon off diagonal values = 0.97
plot.psych(PCA4)
fa2u <- fa.poly(fullScale, nfactors = 2, fm="minres")
print.psych(fa2u, digits=2, cut= .4)
## Factor Analysis using method = minres
## Call: fa.poly(x = fullScale, nfactors = 2, fm = "minres")
## Standardized loadings (pattern matrix) based upon correlation matrix
## MR1 MR2 h2 u2 com
## F1r 0.62 0.30 0.70 1.2
## F2r 0.52 0.25 0.75 1.0
## F3r 0.56 0.33 0.67 1.0
## F4r 0.53 0.23 0.77 1.1
## F5r 0.61 0.34 0.66 1.0
## F6r 0.71 0.60 0.40 1.1
## F7r 0.62 0.35 0.65 1.0
## F8r 0.43 0.17 0.83 1.0
## F9r 0.67 0.46 0.54 1.0
## F10r 0.68 0.47 0.53 1.0
## F11r 0.58 0.38 0.62 1.0
## F12r 0.80 0.72 0.28 1.0
## F13r 0.42 0.14 0.86 1.4
## F14r 0.65 0.57 0.43 1.2
## F15r 0.65 0.39 0.61 1.0
## F16r 0.65 0.49 0.51 1.0
## F17r 0.67 0.38 0.62 1.1
## F18r 0.74 0.68 0.32 1.1
## F19r 0.73 0.52 0.48 1.0
## F20r 0.61 0.46 0.54 1.1
##
## MR1 MR2
## SS loadings 6.46 1.74
## Proportion Var 0.32 0.09
## Cumulative Var 0.32 0.41
## Proportion Explained 0.79 0.21
## Cumulative Proportion 0.79 1.00
##
## With factor correlations of
## MR1 MR2
## MR1 1.00 -0.49
## MR2 -0.49 1.00
##
## Mean item complexity = 1.1
## Test of the hypothesis that 2 factors are sufficient.
##
## The degrees of freedom for the null model are 190 and the objective function was 8.85 with Chi Square of 4462.72
## The degrees of freedom for the model are 151 and the objective function was 1.51
##
## 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 513 with the empirical chi square 472.48 with prob < 8.4e-35
## The total number of observations was 513 with MLE Chi Square = 761.45 with prob < 3.5e-82
##
## Tucker Lewis Index of factoring reliability = 0.82
## RMSEA index = 0.09 and the 90 % confidence intervals are 0.083 0.095
## BIC = -180.83
## Fit based upon off diagonal values = 0.98
## Measures of factor score adequacy
## MR1 MR2
## Correlation of scores with factors 0.96 0.90
## Multiple R square of scores with factors 0.93 0.81
## Minimum correlation of possible factor scores 0.85 0.62
fa.diagram(fa2u)
fa2 <- fa.poly(fullScale, nfactors = 2, rotate = "oblimin", fm="minres")
print.psych(fa2, digits=2, cut= .4)
## Factor Analysis using method = minres
## Call: fa.poly(x = fullScale, nfactors = 2, rotate = "oblimin", fm = "minres")
## Standardized loadings (pattern matrix) based upon correlation matrix
## MR1 MR2 h2 u2 com
## F1r 0.62 0.30 0.70 1.2
## F2r 0.52 0.25 0.75 1.0
## F3r 0.56 0.33 0.67 1.0
## F4r 0.53 0.23 0.77 1.1
## F5r 0.61 0.34 0.66 1.0
## F6r 0.71 0.60 0.40 1.1
## F7r 0.62 0.35 0.65 1.0
## F8r 0.43 0.17 0.83 1.0
## F9r 0.67 0.46 0.54 1.0
## F10r 0.68 0.47 0.53 1.0
## F11r 0.58 0.38 0.62 1.0
## F12r 0.80 0.72 0.28 1.0
## F13r 0.42 0.14 0.86 1.4
## F14r 0.65 0.57 0.43 1.2
## F15r 0.65 0.39 0.61 1.0
## F16r 0.65 0.49 0.51 1.0
## F17r 0.67 0.38 0.62 1.1
## F18r 0.74 0.68 0.32 1.1
## F19r 0.73 0.52 0.48 1.0
## F20r 0.61 0.46 0.54 1.1
##
## MR1 MR2
## SS loadings 6.46 1.74
## Proportion Var 0.32 0.09
## Cumulative Var 0.32 0.41
## Proportion Explained 0.79 0.21
## Cumulative Proportion 0.79 1.00
##
## With factor correlations of
## MR1 MR2
## MR1 1.00 -0.49
## MR2 -0.49 1.00
##
## Mean item complexity = 1.1
## Test of the hypothesis that 2 factors are sufficient.
##
## The degrees of freedom for the null model are 190 and the objective function was 8.85 with Chi Square of 4462.72
## The degrees of freedom for the model are 151 and the objective function was 1.51
##
## 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 513 with the empirical chi square 472.48 with prob < 8.4e-35
## The total number of observations was 513 with MLE Chi Square = 761.45 with prob < 3.5e-82
##
## Tucker Lewis Index of factoring reliability = 0.82
## RMSEA index = 0.09 and the 90 % confidence intervals are 0.083 0.095
## BIC = -180.83
## Fit based upon off diagonal values = 0.98
## Measures of factor score adequacy
## MR1 MR2
## Correlation of scores with factors 0.96 0.90
## Multiple R square of scores with factors 0.93 0.81
## Minimum correlation of possible factor scores 0.85 0.62
fa.diagram(fa2)
fa4u <- fa.poly(fullScale, nfactors = 4, fm="minres")
print.psych(fa4u, digits=2, cut= .4)
## Factor Analysis using method = minres
## Call: fa.poly(x = fullScale, nfactors = 4, fm = "minres")
## Standardized loadings (pattern matrix) based upon correlation matrix
## MR2 MR3 MR1 MR4 h2 u2 com
## F1r 0.65 0.35 0.6456 1.1
## F2r 0.59 0.31 0.6898 1.0
## F3r 0.63 0.42 0.5815 1.2
## F4r 0.51 0.24 0.7553 1.7
## F5r 0.57 0.38 0.6163 1.0
## F6r 0.54 0.62 0.3786 1.6
## F7r 0.54 0.39 0.6143 1.1
## F8r 0.41 0.16 0.8404 1.1
## F9r 0.47 0.47 0.5331 1.4
## F10r 0.56 0.49 0.5138 1.1
## F11r 0.46 0.39 0.6076 1.3
## F12r 0.84 0.78 0.2194 1.0
## F13r 0.14 0.8631 3.0
## F14r 0.56 0.4401 3.5
## F15r 0.83 0.66 0.3411 1.0
## F16r 0.63 0.47 0.5282 1.1
## F17r 0.66 0.49 0.5137 1.2
## F18r 0.94 0.99 0.0066 1.0
## F19r 0.71 0.68 0.3151 1.1
## F20r 0.48 0.5220 2.7
##
## MR2 MR3 MR1 MR4
## SS loadings 3.63 1.90 2.06 1.89
## Proportion Var 0.18 0.09 0.10 0.09
## Cumulative Var 0.18 0.28 0.38 0.47
## Proportion Explained 0.38 0.20 0.22 0.20
## Cumulative Proportion 0.38 0.58 0.80 1.00
##
## With factor correlations of
## MR2 MR3 MR1 MR4
## MR2 1.00 -0.38 0.65 0.63
## MR3 -0.38 1.00 -0.42 -0.34
## MR1 0.65 -0.42 1.00 0.58
## MR4 0.63 -0.34 0.58 1.00
##
## Mean item complexity = 1.5
## Test of the hypothesis that 4 factors are sufficient.
##
## The degrees of freedom for the null model are 190 and the objective function was 8.85 with Chi Square of 4462.72
## The degrees of freedom for the model are 116 and the objective function was 0.8
##
## 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 513 with the empirical chi square 235.04 with prob < 4.3e-10
## The total number of observations was 513 with MLE Chi Square = 399.37 with prob < 8.6e-33
##
## Tucker Lewis Index of factoring reliability = 0.891
## RMSEA index = 0.07 and the 90 % confidence intervals are 0.062 0.076
## BIC = -324.51
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy
## MR2 MR3 MR1 MR4
## Correlation of scores with factors 0.93 0.92 1.00 0.91
## Multiple R square of scores with factors 0.87 0.84 0.99 0.83
## Minimum correlation of possible factor scores 0.73 0.67 0.98 0.66
fa.diagram(fa4u)
fa4 <- fa.poly(fullScale, nfactors = 4, rotate = "oblimin", fm="minres")
print.psych(fa4, digits=2, cut= .4)
## Factor Analysis using method = minres
## Call: fa.poly(x = fullScale, nfactors = 4, rotate = "oblimin", fm = "minres")
## Standardized loadings (pattern matrix) based upon correlation matrix
## MR2 MR3 MR1 MR4 h2 u2 com
## F1r 0.65 0.35 0.6456 1.1
## F2r 0.59 0.31 0.6898 1.0
## F3r 0.63 0.42 0.5815 1.2
## F4r 0.51 0.24 0.7553 1.7
## F5r 0.57 0.38 0.6163 1.0
## F6r 0.54 0.62 0.3786 1.6
## F7r 0.54 0.39 0.6143 1.1
## F8r 0.41 0.16 0.8404 1.1
## F9r 0.47 0.47 0.5331 1.4
## F10r 0.56 0.49 0.5138 1.1
## F11r 0.46 0.39 0.6076 1.3
## F12r 0.84 0.78 0.2194 1.0
## F13r 0.14 0.8631 3.0
## F14r 0.56 0.4401 3.5
## F15r 0.83 0.66 0.3411 1.0
## F16r 0.63 0.47 0.5282 1.1
## F17r 0.66 0.49 0.5137 1.2
## F18r 0.94 0.99 0.0066 1.0
## F19r 0.71 0.68 0.3151 1.1
## F20r 0.48 0.5220 2.7
##
## MR2 MR3 MR1 MR4
## SS loadings 3.63 1.90 2.06 1.89
## Proportion Var 0.18 0.09 0.10 0.09
## Cumulative Var 0.18 0.28 0.38 0.47
## Proportion Explained 0.38 0.20 0.22 0.20
## Cumulative Proportion 0.38 0.58 0.80 1.00
##
## With factor correlations of
## MR2 MR3 MR1 MR4
## MR2 1.00 -0.38 0.65 0.63
## MR3 -0.38 1.00 -0.42 -0.34
## MR1 0.65 -0.42 1.00 0.58
## MR4 0.63 -0.34 0.58 1.00
##
## Mean item complexity = 1.5
## Test of the hypothesis that 4 factors are sufficient.
##
## The degrees of freedom for the null model are 190 and the objective function was 8.85 with Chi Square of 4462.72
## The degrees of freedom for the model are 116 and the objective function was 0.8
##
## 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 513 with the empirical chi square 235.04 with prob < 4.3e-10
## The total number of observations was 513 with MLE Chi Square = 399.37 with prob < 8.6e-33
##
## Tucker Lewis Index of factoring reliability = 0.891
## RMSEA index = 0.07 and the 90 % confidence intervals are 0.062 0.076
## BIC = -324.51
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy
## MR2 MR3 MR1 MR4
## Correlation of scores with factors 0.93 0.92 1.00 0.91
## Multiple R square of scores with factors 0.87 0.84 0.99 0.83
## Minimum correlation of possible factor scores 0.73 0.67 0.98 0.66
fa.diagram(fa4)
### Alfa de Cronbach
#factor? <- fullscale[, c("?")]
#alpha(factor?, check.keys = TRUE)