-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfactorana.qmd
More file actions
116 lines (87 loc) · 3.36 KB
/
factorana.qmd
File metadata and controls
116 lines (87 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
title: "Exploratory factor analysis (principal axis factoring)"
format: html
author:
- Melanie Viola Partsch
- Katharina Groskurth
- Matthias Blümke
- Isabelle Schmidt
keywords:
- Survey Data
- Measurement
- Validity
license: "CC BY-NC 4.0"
citation:
type: "document"
title: |
R Code for the Development and Validation of Measurement Instruments in the Social Sciences: Psychometric Analyses (Dimensionality, Reliability, Measurement Invariance)
container-title: GESIS, Cologne. Data File Version 1.0.0,
author:
- Melanie Viola Partsch
- Katharina Groskurth
- Matthias Blümke
- Isabelle Schmidt
doi: 10.7802/1.1982
issued: 2020
---
Load the required packages
```{r}
#| label: setup
library(rio)
library(psych)
packageVersion("rio")
packageVersion("psych")
```
Read the example data.
```{r}
#| label: read_data
example1 <- rio::import("example1.sav")
```
Build character vector with variable names for use below
```{r}
ext <- c(
"bfi2_1", "bfi2_6", "bfi2_11R", "bfi2_16R", "bfi2_21", "bfi2_26R",
"bfi2_31R", "bfi2_36R", "bfi2_41", "bfi2_46", "bfi2_51R",
"bfi2_56"
)
```
## Conduct parallel analysis, print eigen values and display screeplot
Function with arguments specified below corresponds to default:
- Eigenvalues are found based on the communalities of a one factor minres EFA solution;
- 20 resampled or simulated random datasets are used and the empirical eigen values are compared to the mean of the resampled or simulated eigenvalues;
- suitable for the use of continuous data
Alternatives to default settings:
- Find eigenvalues based on iterating for communalities starting with squared multiple correlations: specify `fm = NULL`, `nfactors = NULL`, `SMC = TRUE` (suggested number of factors reflects both major and minor factors; thus, suggested number of factors usually higher than when using default settings)
- Increase number of resampled or simulated datasets (e.g., to `n.iter = 100`) and choose a quantile of resampled/simulated data to compare the empirical eigenvalues against (e.g., `quant = .95`; the suggested number of factors likely might decrease with a high value for `quant`)
- When using categorical data: specify `cor = "poly"`
```{r}
fa.parallel(example1[ext],
fa = "fa",
fm = "minres", nfactors = 1, SMC = F,
n.iter = 20, # quant = .95,
cor = "cor"
)$fa.values
```
## Conduct EFA (principal axis factoring (PAF))
Function below specifies the following:
- extraction of 3 factors;
- orthogonal rotation using "varimax" rotation;
- using regression to find factor scores;
- using squared multiple correlations as initial communality estimates;
- suitable for the use of continuous data
Alternatives to default settings:
- no rotation (i.e., initial orthogonal solution): specify `rotate = "none"`
- oblique rotation: specify `rotation = "oblimin"` (corresponds to default) or `rotation = "promax"` (the latter includes Kaiser normalization)
- obtain oblique factor scores: use ten Berge's correlation-preserving approach and the pattern matrix to find factor scores: specify `scores = "tenBerge"`, `oblique.scores = TRUE`
- When using categorical data: specify `cor = "poly"`
```{r}
myPAF <- fa(example1[ext],
fm = "pa",
nfactors = 3,
rotate = "varimax",
scores = "regression", oblique.scores = F,
SMC = TRUE,
cor = "cor"
)
myPAF
```