PDF Psych Manual Compress

Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

Package ‘psych’

June 29, 2016


Version 1.6.7
Date 2016-06-29
Title Procedures for Psychological, Psychometric, and Personality
Research
Author William Revelle <[email protected]
<[email protected]>
du>
Maintainer William Revelle <revelle@northwestern.
<[email protected]>
edu>
Description A general purpose toolbox for personality, psychometric theory and experimental psy-
chology.. Functions are primarily for multivariate
chology multivariate analysis
analysis and scale construction
construction using fac-
tor analysis, principal component analysis, cluster analysis and reliability analysis, although oth-
ers provide basic descriptive
descriptive statistics. Item Response
Response Theory is done using factor analy-
sis of tetrachoric and polychoric correlations. Functions for analyzing data at multi-levels in-
clude within and between group statistics,
statistics, including correlations and factor analysis
analysis.. Func-
tions for simulating particular item and test structures are included. Several func-
tions serve as a useful front end for structural equation
equation modeling. Graphical displays of path dia-
grams, factor analysis and structural equation models are created using basic graph-
ics. Some of the functions are written to support a book on psychometrics as well as publica-
tions in personality research. For more information, see the personality-project.org/r webpage.
License GPL (>= 2)
Imports mnormt,parallel,stats,graphics,grDevices
mnormt,parallel,stats,graphics,grDevices,methods
,methods
Suggests GPArotation, sem, lavaan, Rcsdp, graph, Rgraphviz
LazyData true

URL http://personality-project.org/r/psych
http://personality-project.org/r/psych-manual.pdf
NeedsCompilation no
Depends R (>= 2.10)

R topics documented:
documented:
00.psych . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
ability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
affect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
alpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Bechtoldt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
bestScales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
bfi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

1
2 R topics documented:

bi.bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
biplot.psych . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
block.random . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
blot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
bock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
burt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
circ.tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
cities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
cluster.fit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
cluster.loadings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
cluster.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
cluster2keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
cohen.kappa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
comorbidity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
cor.ci . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
cor.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
cor.smooth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
cor.wt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
cor2dist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
corFiml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
corr.test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
correct.cor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
cortest.bartlett . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
cortest.mat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
cosinor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
count.pairwise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
cta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
cubits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
cushny . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
densityBy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
describe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
describeBy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
df2latex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
draw.tetra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
dummy.code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Dwyer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
eigen.loadings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
ellipses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
epi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
epi.bfi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
error.bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
error.bars.by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
error.crosses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
errorCircles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
fa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
fa.diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
fa.extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
fa.multi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
fa.parallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
fa.sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
factor.congruence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
R topics documented: 3

factor.fit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
factor.model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
factor.residuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
factor.rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
factor.scores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
factor.stats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
factor2cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
fisherz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
galton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
geometric.mean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
glb.algebraic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Gleser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Gorsuch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Harman . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Harman.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Harman.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Harman.political . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
harmonic.mean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
headTail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
heights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
ICC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
iclust . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
ICLUST.cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
iclust.diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
ICLUST.graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
ICLUST.rgraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
ICLUST.sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
income . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
interp.median . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
iqitems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
irt.1p . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
irt.fa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
irt.item.diff.rasch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
irt.responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
kaiser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
KMO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
logistic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
lowerUpper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
make.keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
mardia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
mat.sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
matrix.addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
mediate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
mixed.cor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
msq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
mssd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
multi.hist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
neo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
omega . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
omega.graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
outlier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
p.rep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
4 R topics documented:

paired.r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
pairs.panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
parcels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
partial.r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
peas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
phi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
phi.demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
phi2tetra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
plot.psych . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
polar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
polychor.matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
predict.psych . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
principal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
print.psych . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Promax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
psych.misc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
r.test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
rangeCorrection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
read.clipboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
rescale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
residuals.psych . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
reverse.code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
sat.act . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
scaling.fits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
scatter.hist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Schmid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
schmid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
score.alpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
score.irt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
s core.multiple.choice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
scoreItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
scoreOverlap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
scrub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
SD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
setCor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
sim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
sim.anova . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
sim.congeneric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
sim.hierarchical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
sim.item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
sim.multilevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
sim.structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
sim.VSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
simulation.circ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
smc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
spider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
splitHalf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
statsBy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
structure.diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
structure.list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
superMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
table2matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
00.psych 5

test.psych . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
tetrachoric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
thurstone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
tr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Tucker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
vegetables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
VSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
VSS.parallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
VSS.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
VSS.scree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
winsor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
withinBetween . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
Yule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328

Index 332

00.psych A package for personality,


personality, psychometric,
psychometric, and psychologic
psychological
al resear
research
ch

Description

Overview of the psych package.


The psych package has been developed at Northwestern University to include functions most use-
ful for personality
personality and psychological
psychological research.
research. Some of the funct
functions
ions (e.g.
(e.g.,, read.clipboard,
describe, pairs.panels, error.bars ) are useful for basic data entry and descriptive analyses.
Use help(package
help(package="psy
="psych")
ch") for a list of all functions.
functions. Two vignettes
vignettes are inclu
included
ded as part of the
package. The overview provides examples of using psych in many applications.
Psychometric applications include routines (fa for principal axes (fm="pa"), minimum residual
(fm="minres
(fm=" minres"),
"), maxim
maximumum likelihoo
likelihood
d (fm="mle")
(fm="mle") and weighted
weighted least
least squares
squares (fm="w
(fm="wls")
ls") factor
factor
analysis as well as functions to do Schmid Leiman transformations ( schmid) to transform a hi-
erarchical factor structure into a bifactor solution. Factor or components transformations to a target
matrix include the standard Promax transformation ( Promax), a transformation to a cluster target,
or to any simple target matrix ( target.rot) as well as the ability to call many of the GPAro-
tation
tation functions
functions.. Funct
Functions
ions for determining
determining the numbe
numberr of factors in a data matrix includ
includee Very
Very
Simple Structure (VSS) and Minimum Average Partial correlation (MAP). An alternative approach
to factor analysis is Item Cluster Analysis ( ICLUST). Reliability coefficients alpha ( score.items,
score.multiple.choice), beta (ICLUST) and McDonald’s omega (omega and omega.graph) as
well as Guttman’s six estimates of internal consistency reliability ( guttman) and the six measures
of Intraclass correlation coefficients ( ICC) discussed by Shrout and Fleiss are also available.
The scoreItems, and score.multiple.choice functions may be used to form single or multiple
scales from sets of dichotomous, multilevel, or multiple choice items by specifying scoring keys.
Additional functions make for more convenient descriptions of item characteristics. Functions un-
der deve
develop
lopmen
mentt includ
includee 1 and 2 par
parame
ameter
ter Ite
Item
m Respon
Response
se mea
measur
sures
es.. The tetrachoric, polychoric
and irt.fa functions are used to find 2 parameter descriptions of item functioning.
A number of procedures have been developed as part of the Synthetic Aperture Personality Assess-
ment (SAPA) project. These routines facilitate forming and analyzing composite scales equivalent
to using the raw data but doing so by adding within and between cluster/scale item correlations.
These functions include extracting clusters from factor loading matrices ( factor2cluster), syn-
thetically
thetically forming
forming clusters
clusters from correlatio
correlation
n matrices
matrices (cluster.cor), aand
nd find
finding
ing mul
multip
tiple
le ((mat.regress)
and partial ((
((partial.r) correlations from correlation matrices.
6 00.psych

Functions to generate simulated data with particular structures include sim.circ (for circumplex
structures), sim.item (for general structures) and sim.congeneric (for a specific demonstration
of congeneric measurement). The functions sim.congeneric and sim.hierarchical can be used
to create data sets with particular
particular structural
structural properties.
properties. A more general form for all of these is
sim.structural for gener
generating
ating general
general structural
structural models.
models. These
These are discussed
discussed in more detail in
the vignette (psych_for_sem).

Functions to apply various standard statistical tests include p.rep and its variants for testing the
probability of replication, r.con for the confidence intervals of a correlation, and r.test to test
single, paired, or sets of correlations.
In order to study diurnal or circadian variations in mood, it is helpful to use circular statistics. Func-
tions to find the circular mean ( circadian.mean), circular (phasic) correlations (circadian.cor)
and the correlation between linear variables and circular variables ( circadian.linear.cor) sup-
plement a function to find the best fitting phase angle ( cosinor) for measures taken with a fixed
period (e.g., 24 hours).
The most recent development version of the package is always available for download as a source
file from the repository at http://personality-project.org/r/src/c
http://personality-project.org/r/src/contrib/ontrib/.

Details

Two vignettes (overview.pdf)


(overview.pdf) and psych_for_sem.pdf) are useful introductions to the package. They
may be found as vignettes in R or may be downloaded from http://personality-project.org/
r/book/overview.pdf and http://personality-project.org/r/boo k/psych_for_sem.pdf.
http://personality-project.org/r/book/psych_for_sem.pdf
The psych package was originally a combination of multiple source files maintained at the http:
//personality-project.org/r repository: “useful.r", VSS.r., ICLUST.r, omega.r, etc.“useful.r"
is a set of routines for easy data entry (read.clipboard), simple descriptive statistics (describe),
and splom plots combined with correlations ( pairs.panels, adapted from the help files of pairs).
Those files have now been replaced with a single package.
The vss routines allow for testing the number of factors ( vss), showing plots (VSS.plot) of good-
ness of fit, and basic routines for estimating the number of factors/components to extract by using
the MAP ’s procedure, the examining the scree plot ( VSS.scree) or comparing with the scree of an
equivalent matrix of random numbers ( VSS.parallel).
In addition, there are routines for hierarchical factor analysis using Schmid Leiman tranformations
(omega, omega.graph) as well as Item Cluster analysis ( ICLUST, ICLUST.graph).
The more important functions in the package are for the analysis of multivariate data, with an
emphasis upon those functions useful in scale construction of item composites.
When given a set of items from a personality inventory, one goal is to combine these into higher
level item composites. This leads to several questions:
1) What are the basic properties of the data? describe reports basic summary statistics (mean,
sd, median, mad, range, minimum, maximum, skew, kurtosis, standard error) for vectors, columns
of matrices, or data.frames. describeBy provides descriptive statistics, organized by one or more
grouping
group variables.. pairs.panels sho
ing variables shows
ws scatte
scatterr plot
plot mat
matric
rices
es (SPLOM
(SPLOMs)
s) as well
well as histog
histogram
ramss and
the Pearson correlation for scales or items. error.bars will plot variable means with associated
confidence intervals. error.bars will plot confidence intervals for both the x and y coordinates.
corr.test will find the significance values for a matrix of correlations.
2) What is the most appropriate number of item composites to form? After finding either standard
Pearson correlations, or finding tetrachoric or polychoric correlations using a wrapper ( poly.mat)
for John Fox’s hetcor function, the dimensionality of the correlation matrix may be examined. The
number of factors/components problem is a standard question of factor analysis, cluster analysis,
or principal components analysis. Unfortunately, there is no agreed upon answer. The Very Simple
Structure (VSS) set of procedures has been proposed as on answer to the question of the optimal
00.psych 7

number of factors.
number factors. Other procedures (VSS.scree, VSS.parallel, fa.parallel, and MAP) also
procedures
address this question.
3) What are the best composites to form? Although this may be answered using principal compo-
nents (principal), principal axis (factor.pa) or minimum residual (factor.minres) factor anal-
ysis (all part of the fa function) and to show the results graphically ( fa.diagram), it is sometimes
fa.diagram)
more useful to address this question using cluster analytic techniques. Previous versions of ICLUST

(e.g., Revelle, 1979) have been shown to be particularly successful at forming maximally consistent
and independent
independent item composites. Graphical output from ICLUST.graph uses the Graphviz dot
composites. Graphical
language and allows one to write files suitable for Graphviz. If Rgraphviz is available, these graphs
can be done in R.
Graphical organizations of cluster and factor analysis output can be done using cluster.plot
which plots items by cluster/factor loadings and assigns items to that dimension with the highest
loading.
4) How well does a particular item composite reflect a single construct? This is a question of relia-
bility and general factor saturation. Multiple solutions for this problem result in (Cronbach’s) alpha
(alpha, score.items), (Revelle’s) Beta ( ICLUST), and (McDonald’s) omega (both omega hierar-
chical and omega total). Additional reliability estimates may be found in the guttman function.
This can also be examined by applying irt.fa Item Response Theory techniques using factor
analysis of the tetrachoric or polychoric correlation matrices and converting the results into the
standard
standard two parameter
parameter parameteri
parameterizatio
zation
n of item difficulty
difficulty and item discrimina
discrimination.
tion. Inform
Information
ation
functions for the items suggest where they are most effective.
5) For some applications, data matrices are synthetically combined from sampling different items
for different
different people. So called
called Synth
Synthetic
etic Aperture Personal
Personality
ity Assessem
Assessement
ent (SAPA)
(SAPA) techniques
techniques
allow the formation of large correlation or covariance matrices even though no one person has
taken all of the items. To analyze such data sets, it is easy to form item composites based upon the
covariance matrix of the items, rather than original data set. These matrices may then be analyzed
using a number
number of functions
functions (e.g., cluster.cor, factor.pa, ICLUST, principal, mat.regress,
and factor2cluster.
6) More typically, one has a raw data set to analyze. alpha will report several reliablity estimates
as well as item-whole correlations for items forming a single scale, score.items will score data
sets on multiple scales, reporting the scale scores, item-scale and scale-scale correlations, as well
as coefficient
coefficient alpha, alpha-1
alpha-1 and G6+. Using a ‘keys’ matrix (creat ed by make.keys or by hand),
(created
scales
scales can have
have ov
overl
erlapp
apping
ing or indepe
independe
ndent
nt ite
items.
ms. score.multiple.choice score
scoress multiple
multiple choice
choice
items or converts multiple choice items to dichtomous (0/1) format for other functions.
An additi
additiona
onall set of functi
functions
ons gen
genera
erate
te simula
simulated
ted dat
dataa to meet
meet certai
certain
n str
struct
uctura
urall pro
proper
pertie
ties.
s. sim.anova
produces data simulating a 3 way analysis of variance (ANOVA) or linear model with or with out
repeated measures. sim.item creates simple structure data, sim.circ will produce circumplex
structured data, sim.dichot produces circumplex or simple structured data for dichotomous items.
These item structures are useful for understanding the effects of skew,
skew, differential item endorsement
on factor and cluster analytic soutions. sim.structural will produce correlation matrices and data
matrices to match general structural models. (See the vignette).
When examining personality items, some people like to discuss them as representing items in a
two dimensional space with a circumplex structure. Tests of circumplex fit circ.tests have been
developed. When representing items in a circumplex, it is convenient to view them in polar coor-
dinates.
Additional functions for testing the difference between two independent or dependent correlation
r.test, to find the phi or Yule coefficients from a two by table, or to find the confidence interval
of a correlation coefficient.
Ten data sets are included: bfi represents 25 personality items thought to represent five factors of
personality, iqitems has 14 multiple choice iq items. sat.act has data on self reported test scores
8 00.psych

by age and gender. galton GaltoGalton’


n’ss data set of the heights
heights of parents
parents and their children
children.. peas
recreates the original Galton data set of the genetics of sweet peas. heights and cubits provide
even more Galton data, vegetables provides the Guilford preference matrix of vegetables. cities
provides airline miles between 11 US cities (demo data for multidimensional scaling).

Pack
Packagage:
e: psyc
psychh
Type: Package
Version
ersion:: 1.4.3
1.4.3
Dat
atee: 20
2014
14–M
–Maarc
rch–
h–25
25
License:
Lice nse: GPL version
version 2 or new
newer
er

Index:
psych A package for personality, psychometric, and psychological research.

Useful data entry and descriptive statistics

read.clipboard shortcut for reading from the clipboard


read.clipboard.csv shortcut for reading comma delimited files from clipboard
read.clipboard.lower shortcut for reading lower
lower triangular matrices from the clipboard

read.clipboard.upper
describe shortcut
Basic for reading
descriptiv
descriptive upper triangular
e statistics useful for matrices from the clipboard
psychometrics clipboard
describe.by Find summary statistics by groups
statsBy Find summary statistics by a grouping variable, including within and between correlation matrices
headtail combines the head and tail functions for showing data sets
pairs.panels SPLOM and correlations for a data matrix
corr.test Correlations, sample sizes, and p values for a data matrix
cor.plot graphically show the size of correlations in a correlation matrix
multi.hist Histograms and densities of multiple variables arranged in matrix form
skew Calculate skew for a vector,
vector, each column of a matrix, or data.frame
kurtosi Calculate kurtosis for a vector, each column of a matrix or dataframe
geometric.mean Find the geometric mean of a vector or columns of a data.frame
harmonic.mean Find the harmonic mean of a vector or columns of a data.frame
error.bars Plot means and error bars
error.bars.by Plot means and error bars for separate groups
error.crosses Two way error bars
interp.median Find the interpolated median, quartiles, or general quantiles.
rescale Rescale data to specified mean and standard deviation
table2df Convert
Convert a two dimensional table of counts to a matrix or data frame

Data reduction through cluster and factor analysis

fa Combined function for principal axis, minimum residual, weighted least squares,
and maximum likelihood factor analysis
factor.pa Do a principal Axis factor analysis (deprecated)
factor.minres Do a minimum residual factor analysis (deprecated)
factor.wls Do a weighted least squares factor analysis (deprecated)
fa.graph Show the results of a factor analysis or principal components analysis graphically
fa.diagram Show the results of a factor analysis without using Rgraphviz
00.psych 9

fa.sort Sort a factor or principal components output


fa.extension Apply the Dwyer extension for factor loadingss
principal Do an eigen value decomposition to find the principal components of a matrix
fa.parallel Scree test and Parallel analysis
fa.parallel.poly Scree test and Parallel analysis for polychoric matrices
factor.scores Estimate factor scores given a data matrix and factor loadings
guttman 8 different measures of reliability (6 from Guttman (1945)
irt.fa Apply factor analysis to dichotomous items to get IRIRT
T parameters
iclust Apply the ICLUST algorithm
ICLUST.graph Graph the output from ICLUST using the dot language
ICLUST.rgraph Graph the output from ICLUST using rgraphviz
kaiser Apply kaiser normalization before rotating
polychoric Find the polychoric correlations for items and find item thresholds
poly.mat Find the polychoric correlations for items (uses J. Fox’s
Fox’s hetcor)
omega Calculate the omega estimate of factor saturation (requires the GPArotation
GPArotation package)
omega.graph Draw a hierarchical or Schmid Leiman orthogonalized solution (uses Rgraphviz)
partial.r Partial variables from a correlation matrix
predict Predict factor/component scores for new data
schmid Apply the Schmid Leiman transformation to a correlation matrix
score.items Combine items into multiple scales and find alpha
score.multiple.choice Combine items into multiple scales
scales and find alpha and bas
basic
ic scale statistics
statistics
set.cor Find Cohen’s set correlation between two sets of variables
smc Find the Squared Multiple Correlation (used for initial communality estimates)
tetrachoric Find tetrachoric correlations and item thresholds
polyserial Find polyserial and biserial correlations for item validity studies
mixed.cor Form a correlation matrix from continuous, polytomous, and dichotomous items
VSS Apply the Very Simple Structure criterion to determine the appropriate number of factors.
VSS.parallel Do a parallel analysis to determine the number of factors for a random matrix
VSS.plot Plot VSS output
VSS.scree Show the scree plot of the factor/principal components
MAP Apply the Velicer Minimum Absolute Partial criterion for number of factors

Functions for reliability analysis (some are listed above as well).

alpha Find coefficient alpha and Guttman Lambda 6 for a scale (see also score.items)
score.items)
guttman 8 different measures of reliability (6 from Guttman (1945)
omega Calculate the omega estimates of reliability (requires the GPArotation
GPArotation package)
omegaSem Calculate the omega estimates of reliability using a Confirmatory model (requires the sem package)
ICC Intraclass correlation coefficients
score.items Combine items into multiple scales and find alpha
alpha
glb.algebraic The greates lo
lower
wer bound found by an algebraic
algebraic solution (requires Rcsdp).
Rcsdp). Written by Andreas Moeltner

Procedures particularly useful for Synthetic Aperture Personality Assessment

alpha Find coefficient alpha and Guttman Lambda 6 for a scale (see also score.items
score.items))
make.keys Create the keys file for score.items or cluster
cluster.cor
.cor
correct.cor Correct a correlation matrix for unreliability
count.pairwise Count the number of complete
complete cases when doing pair wise correlations
cluster.cor find correlations of composite variables from larger matrix
10 00.psych

cluster.loadings find correla


correlations
tions of items with composite
composite variables from a larger matrix
eigen.loadings Find the loadings when doing an eigen value decomposition
fa Do a minimal residual or principal axis factor analysis and estimate factor scores
fa.extension Extend a factor analysis to a set of new variables
factor.pa Do a Principal Axis factor analysis and estimate factor scores
factor2cluster extract cluster definitions from factor loadings
factor.congruence Factor congruence coefficient
factor.fit How well does a factor model fit a correlation matrix
factor.model Reproduce a correlation matrix based upon the factor model
factor.residuals Fit = data - model
factor.rotate “hand rotate" factors
guttman 8 different measures of reliability
mat.regress standardized multiple regression from raw or correlation matrix input
polyserial polyserial and biserial correlations with massive missing data
tetrachoric Find tetrachoric correlations and item thresholds

Functions for generating simulated data sets

sim The basic simulation functions


sim.anova Generate 3 independent variables and 1 or more dependent variables for demonstrating ANOVA
and lm designs
sim.circ Generate a two dimensional circumplex item structure
sim.item Generate a two dimensional simple structure with particular item characteristics
sim.congeneric Generate a one factor congeneric reliability structure
structure
sim.minor Simulate nfact major and nvar/2
nvar/2 minor factors
sim.structural Generate a multifactorial structural model
sim.irt Generate data for a 1, 2, 3 or 4 parameter logistic model
sim.VSS Generate simulated data for the factor model
phi.demo Create artificial data matrices for teaching purposes
sim.hierarchical Generate simula
simulated
ted correlation matrices
matrices with hierarchical
hierarchical or any structure
sim.spherical Generate three dimensional
dimensional spherical data (generalization
(generalization of circumplex
circumplex to 3 space)

Graphical functions (require Rgraphviz) – deprecated

structure.graph Draw a ssem


em or re
regression
gression graph
fa.graph Draw the factor structure from a factor or principal components analysis
omega.graph Draw the factor structure from an omega
omega analysis(either
analysis(either with or without the Schmid Leiman transformat
transformat
ICLUST.graph Draw the tree diagram from ICLUST

Graphical functions that do not require Rgraphviz

diagram A general set of diagram functions.


structure.diagram Draw a sem
sem or regression graph
fa.diagram Draw the factor structure from a factor or principal components analysis
omega.diagram Draw the factor structure from an omega
omega analysis(either
analysis(either with or without the Schmid Leiman transfor
transfor
ICLUST.diagram Draw the tree diagram from ICLUST
00.psych 11

plot.psych A call to plot various types of output (e.g. from irt.fa, fa, omega, iclust
cor.plot A heat map display of correlations
spider Spider and radar plots (circular displays of correlations)

Circular statistics (for circadian data analysis)

circadian.cor Find the correlation with e.g., mood and time of day
circadian.linear.cor Correlate a circular value
value with a linear value
circadian.mean Find the circular mean of each column of a a data set
cosinor Find the best fitting phase angle for a circular data set

Miscellaneous functions

comorbidity Convert
Convert base rate and comorbity to phi, Yule and tetrachoric
df2latex Conv
Convert
ert a data.frame or matrix to a LaTeX
LaTeX table
dummy.code Convert
Convert categorical data to dummy codes
fisherz Apply the Fisher r to z transform

fisherz2r
ICC Apply the correlation
Intraclass Fisher z to coefficients
r transform
cortest.mat Test for equality of two matrices (see also cortest.normal, cortest.jennrich )
cortest.bartlett Test whether a matrix is an an identity
identity matrix
paired.r Test for the difference of two paired or two independent correlations
r.con Confidence intervals for correlation coefficients
r.test Test of significance of r, differences between rs.
p.rep The probability of replication given a p, r, t, or F
phi Find the phi coefficient of correlation from a 2 x 2 table
phi.demo Demonstrate the problem of phi coefficients with varying cut points
phi2poly Given a phi coefficient, what is the polychoric correlation
phi2poly.matrix Given a phi coefficient, what
what is the polychoric correlation
correlation (works on matrices)
matrices)
polar Conv
Convert
ert 2 dimensional factor loadings to polar coordinates.
scaling.fits Compares alternative scaling solutions and gives goodness of fits
scrub Basic data cleaning
tetrachor Finds tetrachoric correlations
thurstone Thurstone Case V scaling
tr Find the trace of a square matrix
wkappa weighted and unweighted versions of Cohen’
Cohen’ss kappa
Yule Find the Yule Q coefficient of correlation
Yule.inv What is the two by two table that produces a Yule Q with set marginals?
Yule2phi What is the phi coefficient corresponding to a Yule Q with set marginals?
Yule2tetra Convert
Convert one or a matrix of Yule coefficients to tetrachoric coefficients.

Functions that are under development and not recommended for casual use

irt.item.diff.rasch IRT estimate of item difficulty with assumption that theta = 0


irt.person.rasch Item Response
Response Theory estimates of theta (ability) using a Rasch like model
12 00.psych

Data sets included in the psych package

bfi represents 25 personality items thought to represent five factors of personality


Thurstone 8 diffe
different
rent data sets with a bifactor structure
cities The airline distances between 11 cities (used to demonstrate MDS)
epi.bfi 13 personality scales
iqitems 14 multiple choice iq items
msq 75 mood items
sat.act Self reported
reported ACT
ACT aandnd SAT
SAT Verbal
Verbal aand
nd Quantitative
Quantitative scores by age and ge
gender
nder
Tucker Correlation matrix from Tuck
Tuckerer
galton Galton’s data set of the heights of parents and their children
heights Galton’s data set of the relationship between height and forearm (cubit) length
cubits Galton’s data table of height and forearm length
peas Galton‘s data set of the diameters of 700 parent and offspring sweet peas
vegetables Guilford‘s preferenc
preferencee matrix of
of vegetables
vegetables (used for thurstone)

A debugging function that may also be used as a demonstration of psych.

test.psych Run a test of the major functions


functions on 5 different d
data
ata sets. Primarily for development purposes.
Although the output can be used as a demo of the various functions.

Note

Development versions (source code) of this package are maintained at the repository http://
personality-project.org/r along with further documentation. Specify that you are download-
ing a source package.
Some functions require other packages. Specifically,
Specifically, omega and schmid require the GP
GPArotation
Arotation
package, ICLUST.rgraph and fa.graph require Rgraphviz but have alternatives using the diagram
functions. i.e.:

function requires
omega GPArotation
schmid GPArotation
poly.mat polychor
phi2poly polychor
polychor.matrix polychor
ICLUST.rgraph Rgraphviz
fa.graph Rgraphviz
structure.graph Rgraphviz
glb.algebraic Rcsdp

Author(s)

William Revelle
Department of Psychology
Northwestern University
ability 13

Evanston, Illiniois
http://personality-project.org/revelle.html

Maintainer: William Revelle <[email protected]>


<[email protected]>

References

A general guide to personality theory and research may be found at the personality-project http:
//personality-project.org. See also the short guide to R at http://personality-project.
org/r. In addition, see
Re
Reve
velle
lle,, W. (in prepar
preparati
ation)
on) An Introd
Introduct
uction
ion to Psycho
Psychomet
metric
ric Theory
Theory wit
with
h applic
applicati
ations
ons in R. Spr
Spring
inger
er..
at http://personality-project.org/r/book/

Examples
#See
#See the separa
separate
te man pages
#to test most
most of the psych packa
package
ge run the fol
follow
lowing
ing
#test.psych()

ability 16 ability items scored as correct or incorrec


incorrect.
t.

Description

16 multiple choice ability items 1525 subjects taken from the Synthetic Aperture Personality As-
sessment (SAPA) web based personality assessment project are saved as iqitems. Those data are
shown as examples of how to score multiple choice tests and analyses of response alternatives.
When scored correct or incorrect, the data are useful for demonstrations of tetrachoric based factor
analysis irt.fa and finding tetrachoric correlations.

Usage

data(iqitems)

Format

A dataitem
is the frame with 1525
number fromobservations
SAPA. on the following 16 variables. The number following the name

reason.4 Basic reasoning questions


reason.16 Basic reasoning question
reason.17 Basic reasoning question
reason.19 Basic reasoning question
letter.7 In the following alphanumeric series, what letter comes next?
letter.33 In the following alphanumeric series, what letter comes next?
letter.34 In the following alphanumeric series, what letter comes next
letter.58 In the following alphanumeric series, what letter comes next?
matrix.45 A matrix reasoning task
matrix.46 A matrix reasoning task
14 ability

matrix.47 A matrix reasoning task

matrix.55 A matrix reasoning task

rotate.3 Spatial Rotation of type 1.2

rotate.4 Spatial Rotation of type 1.2

rotate.6 Spatial Rotation of type 1.1

rotate.8 Spatial Rotation of type 2.3

Details

16 items were sampled from 80 items given as part of the SAPA (http://sapa-project.org)
project (Revelle, Wilt and Rosenthal, 2009; Condon and Revelle, 2014) to develop online measures
of ability.
ability. These
These 16 items reflect
reflect four lower order factors
factors (verbal reasoning,
reasoning, letter series,
series, matrix
reasoning, and spatial rotations. These lower level factors all share a higher level factor (’g’).

This data set may be used to demonstrate item response functions, tetrachoric correlations, or
irt.fa as well as omega estimates of of reliability and hierarchical structure.

In addition, the data set is a good example of doing item analysis to examine the empirical response
probabilities of each item alternative as a function of the underlying latent trait. When doing this,
it appears that two of the matrix reasoning problems do not have monotonically increasing trace
lines for the probability
probability correct
correct.. At moderately
moderately high ability (theta = 1) there is a decrease
decrease in the
probability correct from theta = 0 and theta = 2.

Source

The example data set is taken from the Synthetic Aperture Personality Assessment personality
and ability test at http://sapa-project.org. The data were collected with David Condon from
8/08/12 to 8/31/12.

References

Revelle,
Revelle, Willia
William,
m, Wilt, Joshua,
Joshua, and Rosentha
Rosenthal,
l, Allen (2010)
(2010) Perso
Personalit
nality
y and Cogn
Cognition:
ition: The Perso
Personalit
nality-
y-

Cognition Link. In Differences


book of Individual Gruszka, Alexandra and Matthews,
in Cognition: Gerald and
Attention, Memory andSzymura,
ExecutiveBlazej (Eds.)
Control, Hand-
Springer.

Condon, David and Revelle, William, (2014) The International Cognitive Ability Resource: Devel-
opment and initial validation of a public-domain measure. Intelligence, 43, 52-64.

Examples

data(ability)
#not
#not run
# ability.irt
ability.irt <- irt.f
irt.fa(abil
a(ability)
ity)
# ability.scor
ability.scores
es <- score.
score.irt(ab
irt(ability.
ility.irt,ab
irt,ability
ility)
)
affect 15

affect Two data sets of affect and arous


arousal
al scores as a function of personality
and movie conditions

Description

A recurring question in the study of affect is the proper dimensionality and the relationship to
various
various personality
personality dimensions
dimensions.. Here is a data set taken from two studies
studies of mood and arousal
using movies to induce affective states.

Usage

data(affect)

Details

These are data from two studies conducted in the Personality, Motivation and Cognition Laboratory
at Northwestern University. Both studies used a similar methodology:

Collection of pretest data using 5 scales from the Eysenck Personality Inventory and items taken
from the Motivational State Questionnaire (see msq. In addition, state and trait anxiety
anxiety measures
were given. In the “maps" study, the Beck Depression Inventory was given also.
Then subjects were randomly assigned to one of four movie conditions: 1: Frontline. A documen-
tary about the liberation of the Bergen-Belsen concentration camp. 2: Halloween. A horror film. 3:
National Geographic, a nature film about the Serengeti plain. 4: Parenthood. A comedy. Each film
clip was shown for 9 minutes. Following this the MSQ was given again.
Data from the MSQ were scored for Energetic and Tense Arousal (EA and TA) as well as Positive
and Negative Affect (PA and NA).
Study flat had 170 participants, study maps had 160.
These studies are described in more detail in various publications from the PMC lab. In particular,
Revelle
Revelle and Anderson,
Anderson, 1997 and Rafaeli
Rafaeli and Revelle
Revelle (2006). An analysi
analysiss of these data has also
appeared in Smillie et al. (2012).

Source

Data collected at the Personality, Motivation, and Cognition Laboratory, Northwestern University.

References

Revelle, William and Anderson, Kristen Joan (1997) Personality, motivation and cognitive perfor-
mance: Final report to the Army Research Institute on contract MDA 903-93-K-0008
Rafaeli, Eshkol and Revelle, William (2006), A premature consensus: Are happiness and sadness
truly opposite affects? Motivation and Emotion, 30, 1, 1-12.
Smillie, Luke D. and Cooper, Andrew and Wilt, Joshua and Revelle, William (2012) Do Extraverts
Get More Bang for the Buck? Refining the Affective-Reactivity Hypothesis of Extraversion. Jour-
nal of Personality and Social Psychology, 103 (2), 206-326.
16 alpha

Examples

data(affect)
describeBy(affect[-1],group="Film")
pairs.panels(affect[14:17],bg=c("red","black","white","blue")[affect$Film],pch=21,
main="
main="Aff
Affect
ect var
varies
ies by mov
movies
ies ")
errorCircles("EA2","TA2",data=affect,group="Film",labels=c("Sad","Fear","Neutral","Humor")

, main="
main="Ene
Eneget
getic
ic and Ten
Tense
se Aro
Arousa
usal
l by Mov
Movie
ie con
condit
dition
ion")
")
errorCircles(x="PA2",y="NA2",data=affect,group="Film",labels=c("Sad","Fear","Neutral","
Humor"
Humor"),
), main="
main="Pos
Positi
itive
ve and Neg
Negati
ative
ve Aff
Affect
ect by Mov
Movie
ie con
condit
dition
ion")
")

alpha Fi
Find
nd two estimates
estimates of reliabil
reliability:
ity: Cronbac
Cronbach’s
h’s alpha and Guttm
Guttman’
an’ss
Lambda 6.

Description

Internal consistency measures of reliability range from ω h to α to ω t . This function


function rep
reports
orts two
Cronbach’s coefficient α and Guttman’s λ6 . Also reported are item - whole correlations,
estimates: Cronbach’s
α if an item is omitted, and item means and standard deviations.

Usage

alpha(x, keys=
alpha(x, keys=NULL,
NULL,cumul
cumulative
ative=FALS
=FALSE,
E, titl
title=NUL
e=NULL,
L, max=1
max=10,na.
0,na.rm
rm = TRUE,
check.keys=FALSE,n.iter=1,delete=TRUE,use="p
check.keys=FALSE,n.iter=1,delete=TRUE,use="pairwise",warnings=TRUE,
airwise",warnings=TRUE,n.obs=NULL)
n.obs=NULL)

Arguments

x A data.frame or matrix of data, or a covariance or correlation matrix


keys If some items are to be reversed
reversed keyed,
keyed, then eithe
eitherr specify
specify the direction
direction of all
items or just a vector of which items to reverse
title Any text string to identify this run
cumulative should
should me
means
ans reflect
reflect the sum o
off items
items or the m
mean
ean of th
thee ite
items.
ms. The defau
default
lt
value is means.

max the number


faults to 10,of categories/item
passed to consider if reporting
to link{response.freque
link{response.frequencies}ncies} category frequencies. De-

na.rm The default is to remove missing values and find pairwise correlations
check.keys if TRUE,
TRUE, then
then find the first
first principal
principal compon
component
ent an
and
d revers
reversee key
key item
itemss with
negative loadings. Give a warning if this happens.
n.iter Number of iterations if bootstrapped confidence intervals are desired
delete Delete items with no variance and issue a warning
use Options
Options to pass to the cor function:
function: "every
"everything
thing",
", "all.
"all.obs",
obs", "comp
"complete.
lete.obs"
obs",,
"na.or.complete", or "pairwise.complete.obs". The default is "pairwise"
warnings By default print a warning and a message that items were reversed
reversed.. Suppress the
message if warnings = FALSE
n.obs If using correlation matrices as input, by specify the number of observations
observations,, we
can find confidence intervals
alpha 17

Details

Alpha is one of several estimates of the internal consistency reliability of a test.


Surprisingly,, more than a century after Spearman (1904) introduced the concept of reliability to psy-
Surprisingly
chologists, there are still multiple approaches for measuring it. Although very popular, Cronbach’s
α (1951) underestimates the reliability of a test and over estimates the first factor saturation.

α (Cronbach, 1951) is the same as Guttman’s λ3 (Guttman, 1945) and may be found by
n tr  )x
t r(V n Vx tr(
 tr(Vx ) −
λ3 = 1 − = =α
n 1 − Vx n 1 Vx −
Perhaps because it is so easy to calculate and is available in most commercial programs, alpha is
without doubt the most frequently reported measure of internal consistency reliability. Alpha is the
mean of all possible
possible spit half reliabil
reliabilities
ities (corr
(corrected
ected for test length). For a unifactoria
unifactoriall test, it is a
reasonable estimate of the first factor saturation, although if the test has any microstructure (i.e., if
it is “lumpy") coefficients β (Revelle, 1979; see ICLUST) and ω h (see omega) are more appropriate
estimates of the general factor saturation. ω t (see omega) is a better estimate of the reliability of the
total test.
Guttman’s Lambda 6 (G6) considers the amount of variance in each item that can be accounted for
the linear regression of all of the other items (the squared multiple correlation or smc), or more
precisely, the variance of the errors, e2j , and is

2
e (1 − r 2
j smc )
λ6 = 1 − =1 − .
Vx Vx

The squared multiple correlation is a lower bound for the item communality and as the number of
items increases, becomes a better estimate.
G6 is also sensitive to lumpyness in the test and should not be taken as a measure of unifactorial
structure. For lumpy tests, it will be greater than alpha. For tests with equal item loadings, alpha >
G6, but if the loadings are unequal or if there is a general factor, G6 > alpha. alpha is a generaliza-
tion of an earlier estimate of reliability for tests with dichotomous items developed by Kuder and
Richardson, known as KR20, and a shortcut approximation, KR21. (See Revelle, in prep).
Alpha and G6 are both positive functions of the number of items in a test as well as the average
intercorrel
intercorrelation
ation of the items in the test. When calculate
calculated
d from the item vari
variance
ancess and total test
variance, as is done here, raw alpha is sensitive to differences in the item variances. Standardized
alpha is based upon the correlations rather than the covariances.

A useful index of the quality of the test that is linear with the number of items and the average
correlation is the Signal/Noise ratio where
nr̄r¯
s/n =
1 nr̄r¯

(Cronbach and Gleser, 1964; Revelle and Condon (in press)).
More complete reliability analyses of a single scale can be done using the omega function which
finds ωh and ωt based upon a hierarchical factor analysis.
Alternative functions score.items and cluster.cor will also score multiple scales and report
more useful statistics. “Standardized" alpha is calculated from the inter-item correlations and will
differ from raw alpha.
Four alternativ
alternativee item-whole
item-whole correlations
correlations are reported,
reported, three are con
convent
ventional
ional,, one unique. raw
raw.r
.r
is the correlation
correlation of the item with the entire scale, not correct
correcting
ing for item overl
overlap.
ap. std.r is the
correlation of the item with the entire scale, if each item were standardized. r.drop is the correlation
18 alpha

of the ite
item
m with
with the scale
scale compos
composed
ed of the remain
remaining
ing ite
items.
ms. Althou
Although
gh eac
eachh of these
these are con
conven
ventio
tional
nal
statistics, they have the disadvantage that a) item overlap inflates the first and b) the scale is different
for each item when an item is dropped. Thus, Thus, the fourth altern
alternati
ative,
ve, r.cor,
r.cor, correct
correctss for the item
overlap by subtracting the item variance but then replaces this with the best estimate of common
variance, the smc. This is similar to a suggestion by Cureton (1966).
If some items are to be reversed keyed then they can be specified by either item name or by item
location. (Look at the 3rd and 4th examples
location. examples.).) Automatic
Automatic revreversal
ersal can
can also be done, and this is
based upon the sign of the loadings on the first principal component (Example 5). This requires the
check.keys option to be TRUE. Previous versions defaulted to have check.keys=TRUE, but some
users complained that this made it too easy to find alpha without realizing that some items had been
reversed (even
(even though a warning was issued!). Thus, I have set the default to be check.keys=F
check.keys=FALSE
ALSE
with a warning that some items need to be reversed (if this is the case). To suppress these warnings,
set warnings=FALSE.
Scores are based upon the simpl
Scores simplee averages
averages (or totals) of the items scored.
scored. Rev
Reversed
ersed items
items are
subtracted from the maximum + minimum item response for all the items.
When using raw data, standard errors for the raw alpha are calculated using equation 2 and 3 from
Duhhachek
Duhha chek and Iacobucci
Iacobucci (2004
(2004).
). This is proble
problematic
matic because
because some simulations
simulations suggest these
values are too small. It is probably better to use bootstrapped value
Bootstrapped resamples are found if n.iter > 1. These are returned as the boot object. They may be
plotted or described.

Value

total a list containing


raw_alpha alpha based upon the covariances
covariances
std.alpha The standarized alpha based upon the correlations
G6(smc) Guttman’s Lambda 6 reliability
average_r The average interitem correlation
mean For data matrices, the mean of the scale formed by summing the items
sd For data matrices, the standard deviation of the total score
alpha.drop A data frame with all of the above
above for the cas
casee of each item being remo
removed
ved one
by one.
item.stats A data frame including

n number of complete cases for the item


raw.r The correlation of each item with the total score, not corrected for item overlap.
std.r The correlation of each item with the total score (not corrected for item overlap)
if the items were all standardized
r.cor Item whole correlation corrected for item overlap and scale reliability
r.drop Item whole correlation for this item against the scale without this item
mean for data matrices, the mean of each item
sd For data matrices, the standard deviation of each item
response.freq For data matric
matrices,
es, the frequency
frequency of each item
item response (if less than 2
20)
0)
boot a 6 column by n.iter matrix of boot strapped resampled values
Unidim An index of unidimensionality
Fit The fit of the off diagonal matrix
alpha 19

Note

By default, items that correlate negatively with the overall scale will be reverse coded. This option
may be turned off by setting check.keys = FALSE. If items are reversed, then each item is subtracted
from the minimum item response + maximum item response where min and max are taken over all
items.. Thus,
items Thus, if the items inte
intention
ntionally
ally differ
differ in range, the scores will be off by a cons
constant.
tant. See
scoreItems for a solution.
Two experimenta
experimentall measures of Goodness
Goodness of Fit are returned in the outpu
output:t: Unidi
Unidim
m and Fit. They
are not printed or displayed,
displayed, but are available
available for analysis.
analysis. The first is an index of how well the
modeled average correlations actually reproduce the original correlation matrix. The second is how
well the modeled correlations reproduce the off diagonal elements of the matrix. Both are indices
of squared residuals compared to the squared original correlations. These two measures are under
development and might well be modified or dropped in subsequent versions.

Author(s)

William Revelle

References

Cronbach, L.J. (1951) Coefficient


Cronbach, Coefficient alpha and the internal
internal strucuture
strucuture of tests
tests.. Psychometr
Psychometrika,
ika, 16,
297-334.

Cureton, E. (1966). Corrected item-test correlations. Psychometrika, 31(1):93-96.


Cronbach, L.J. and Gleser G.C. (1964)The signal/noise ratio in the comparison of reliability coeffi-
cients. Educational and Psychological Measurement, 24 (3) 467-480.
Duhachek, A. and Iacobucci,
Duhachek, Iacobucci, D. (2004). Alpha’s
Alpha’s standard
standard error (ase): An accurat
accuratee and precise
confidence interval estimate. Journal of Applied Psychology, 89(5):792-808.
Guttman, L. (1945). A basis for analyzing test-retest reliability. Psychometrika, 10 (4), 255-282.
Re
Reve
velle
lle,, W. (in prepar
preparati
ation)
on) An introd
introduct
uction
ion to psycho
psychomet
metric
ric theory
theory wit
with
h applic
applicati
ations
ons in R. Spr
Spring
inger
er..
(A
(Available
vailable online at http://personality-project.org/r/boo
http://personality-project.org/r/book k).
Revelle, W. Hierarchical Cluster Analysis and the Internal Structure of Tests. Multivariate Behav-
ioral Research, 1979, 14, 57-74.
Revelle, W.
Revelle, W. and Condon, D.C. Reliability
Reliability.. In Irwing, P.,
P., Booth, T. and Hughes,
Hughes, D. (Eds). the
Wiley-Blackwell Handbook of Psychometric Testing (in press).
Revelle, W. and Zinbarg, R. E. (2009) Coefficients alpha, beta, omega and the glb: comments on
Sijtsma. Psychometrika, 74 (1) 1145-154.

See Also

omega, ICLUST, guttman, scoreItems, cluster.cor

Examples
set.se
set.seed(
ed(42)
42) #ke
#keep
ep the sam
same
e sta
starti
rting
ng val
values
ues
#four congeneric
congeneric measu
measures
res
r4 <- sim.congener
sim.congeneric()
ic()
alpha(r4)
#nine
#nine hierar
hierarchi
chical
cal mea
measur
sures
es -- sho
should
uld act
actual
ually
ly use ome
omega
ga
r9 <- sim.hierarch
sim.hierarchical(
ical()
)
alpha(r9)

# exampl
examples
es of two ind
indepe
epende
ndent
nt fac
factor
tors
s tha
that
t pro
produc
duce
e rea
reason
sonabl
able
e alp
alphas
has
20 Bechtoldt

#this is a case
#this case whe
where
re alp
alpha
ha is a poo
poor
r ind
indica
icator
tor of uni
unidim
dimens
ension
ionali
ality
ty
two.f <- sim.item(8)
sim.item(8)
#speci
#specify
fy which
which ite
items
ms to rev
revers
erse
e key by nam
name
e
alpha(two.f,keys=c("V1","V2","V7","V8"))
#by location
location
alpha(two.f,keys=c(1,2,7,8))
#automatic
#automatic reversal base upon first compon
component
ent
alpha(two.f)
#an example
example with dis
discre
crete
te item res
respon
ponses
ses -- show the fre
freque
quenci
ncies
es
items <- sim.congeneric(N=500,short=FALSE,low=-2,high=2,
catego
categoric
rical=
al=TRU
TRUE)
E) #50
#500
0 res
respon
ponses
ses to 4 dis
discre
crete
te ite
items
ms wit
with
h 5 catego
categorie
ries
s
a4 <- alpha(
alpha(ite
items$
ms$obs
observ
erved)
ed) #it
#item
em res
respon
ponse
se ana
analys
lysis
is of con
congen
generi
eric
c mea
measur
sures
es
a4
#summa
#summary
ry just
just giv
gives
es Alp
Alpha
ha
summary(a4)

Bechtoldt Seven data sets showing a bifactor solution.

Description

Holzinger-Swineford (1937) introduced the bifactor model of a general factor and uncorrelated
group factors. The Holzinger data sets are original 14 * 14 matrix from their paper as well as a 9
*9 matrix used as an example
example by Joreskog.
Joreskog. The Thurs
Thurstone
tone corre
correlatio
lation
n matrix is a 9 * 9 matri
matrix
x of
correlations of ability items. The Reise data set is 16 * 16 correlation matrix of mental health items.
The Bechtholdt data sets are both 17 x 17 correlation matrices of ability tests.

Usage

data(Thurstone)
data(Thurstone.33)
data(Holzinger)
data(Holzinger.9)
data(Bechtoldt)
data(Bechtoldt.1)
data(Bechtoldt.2)
data(Reise)

Details

Holzin
Hol zinger
ger and Swinef
Swineford
ord (1937)
(1937) int
introd
roduce
ucedd the bifact
bifactor
or model
model (one
(one gen
genera
erall factor
factor and se
seve
veral
ral gro
group
up
factors) for mental abilities. This is a nice demonstration data set of a hierarchical factor structure
that can be analyzed using the omega function or using sem. The bifactor model is typically used in
measures of cognitive ability.
There are several ways to analyze such data. One is to use the omega function to do a hierarchical
factoring using the schmid-leiman transformation.
transformation. Another is to a regular factor analysis and use
either a bifactor or biquartimin rotation. These latter two functions implement the Jennrich and
Bentler (2011) bifactor and biquartimin transformations.
The 14 variables are ordered to reflect 3 spatial tests, 3 mental speed tests, 4 motor speed tests, and
4 verbal tests. The sample size is 355.
Bechtoldt 21

Another data set from Holzinger (Holzinger.9) represents 9 cognitive abilities (Holzinger, 1939)
and is used as an example by Karl Joreskog (2003) for factor analysis by the MINRES algorithm
and also appears in the LISREL manual as example NPV.KM.
Another classic data set is the 9 variable Thurstone problem which is discussed in detail by R.
P. McDonald (1985, 1999) and and is used as example in the sem package as well as in the PROC
CALIS
CAL IS man
manual
ual for SAS.
SAS. These
These nine
nine tests
tests were
were groupe
grouped
d by Thu
Thurst
rstone
one and Thu
Thurst
rstone
one,, 194
1941
1 (ba
(base
sed
d on
other data) into three factors: Verbal Comprehension, Word Fluency, and Reasoning. The original
data came from Thurstone and Thurstone (1941) but were reanalyzed by Bechthold (1961) who
broke the data set into two. McDonald, in turn, selected these nine variables from the larger set of
17 found in Bechtoldt.2. The sample size is 213.
Another set of 9 cognitive variables attributed to Thurstone (1933) is the data set of 4,175 students
reported by Professor Brigham of Princeton to the College Entrance Examination Board. This set
does not show a clear bifactor solution but is included as a demonstration of the differences between
a maximimum likelihood factor analysis solution versus a principal axis factor solution.
More recent applications of the bifactor model are to the measurement of psychological status. The
Reise data set is a correlation matrix based upon >35,000 observations to the Consumer Assess-
ment of Health Care Provideers and Systems survey instrument. Reise, Morizot, and Hays (2007)
describe a bifactor solution based upon 1,000 cases.
The five factors from Reise et al. reflect Getting care quickly (1-3), Doctor communicates well (4-
7), Courteous and helpful staff (8,9), Getting needed care (10-13), and Health plan customer service
(14-16).
The two
two Bechto
Bechtoldt
ldt dat
dataa se
sets
ts are two sample
sampless fro
from
m Thurs
Thurston
tonee and Thu
Thurst
rstone
one (19
(1941)
41).. They includ
includee 17
variables, 9 of which were used by McDonald to form the Thurstone data set. The sample sizes are
212 and 213 respectively.
respectively. The six proposed factors reflect memory, verbal, words, space, number
and reasoning
reasoning with three markers
markers for all expect the rote memory
memory factor
factor.. 9 var
variable
iabless from this set
appear in the Thurstone data set.
Two more data sets with similar structures are found in the Harman data set.

• Bechtoldt.1: 17 x 17 correlation matrix of ability tes


tests,
ts, N = 212.
• Bechtoldt.2: 17 x 17 correlation matrix of ability tes
tests,
ts, N = 213.
• Holzi
Holzinger:
nger: 14 x 14 correlation
correlation matrix
matrix of ability tests,
tests, N = 355
• Holzinger
Holzinger.9:
.9: 9 x 9 correlation matrix of ability tests, N = 145
145
• Reise: 16 x 16 correlation matrix of health sa
satisfaction
tisfaction items. N = 35,000
• Thurs
Thurstone:
tone: 9 x 9 correlation
correlation matrix
matrix of ability tests,
tests, N = 213
• Thurstone.33: Another 9 x 9 correlation matrix of aability
bility items, N=4175

Source

Holzinger: Holzinger and Swineford (1937)


Reise: Steve Reise (personal communication)
sem help page (for Thurstone)

References

Bechtoldt, Harold,
Bechtoldt, Harold, (1961
(1961).
). An empirical
empirical study of the factor
factor analysis stability
stability hypothesi
hypothesis.
s. Psy-
chometrika, 26, 405-432.
Holzinger, Karl and Swineford, Frances (1937) The Bi-factor method. Psychometrika, 2, 41-54
Holzinger,, K., & Swineford,
Holzinger Swineford, F. (1939). A study in factor analysis
analysis:: The stability
stability of a bifactor
bifactor
solution. Supplementary Educational Monograph, no. 48. Chicago: University of Chicago Press.
22 bestScales

McDonald, Roderick P. (1999) Test theory: A unified treatment. L. Erlbaum Associates. Mahwah,
N.J.
Reise, Steven and Morizot, Julien and Hays, Ron (2007) The role of the bifactor model in resolving
dimensionality issues in health outcomes measures. Quality of Life Research. 16, 19-31.
Thurstone, Louis Leon (1933) The theory of multiple factors. Edwards Brothers, Inc. Ann Arbor

Thurstone, Louis
The University of Leon andPress.
Chicago Thurstone
Thurstone,, Thelma
Chicago, Il. (Gwinn). (1941) Factorial studies of intelligence
intelligence..

Examples

if(!require(
if(!require(GPArot
GPArotation
ation))
)) {messa
{message("I
ge("I am sorry, to run omega requires GPArot
GPArotation
ation")
")
} else {
#holz <- omega(Holzi
omega(Holzinger,4
nger,4,
, title = "14 abilit
ability
y tests from Holzin
Holzinger-Sw
ger-Swinefor
ineford")
d")
#bf <- omega(Reise,
omega(Reise,5,titl
5,title="16
e="16 health items from Reise"
Reise")
)
#omega(Reise
#omega(Reise,5,lab
,5,labels=c
els=colname
olnames(Reis
s(Reise),tit
e),title="16
le="16 healt
health
h items from Reise"
Reise")
)
thur.om
thur.om <- omega(Thurs
omega(Thurstone,t
tone,title="
itle="9
9 variab
variables
les from Thurstone") #compare with
thur.bf
thur.bf <- fa(Thu
fa(Thurstone
rstone,3,rot
,3,rotate="b
ate="biquart
iquartimin")
imin")
factor.congruence(thur.om,thur.bf)
}

bestScales A set of functions for factorial and empirical scale construction

Description

When constructing scales through rational, factorial, or empirical means, it is useful to examine the
content of the items that relate most highly to each other (e.g., the factor loadings of fa.lookup
of a set of items) , or to some specific set of criteria (e.g., bestScales). Giv Given
en a dictionar
dictionaryy of
item content, these routines will sort by factor loading or criteria correlations and display the item
content.

Usage

bestSc
bestScale
ales(x
s(x,
, cri
criter
teria,
ia, cut = 0.1
0.1,
, n.i
n.item
tem = 10, ove
overla
rlap
p = FAL
FALSE,
SE,
dictio
dic tionar
nary
y = NUL
NULL,
L, dig
digits
its = 2)
bestItems(x,criteria=1,cut=.3, abs=TRUE, dictionary=NULL,cor=TRU
bestItems(x,criteria=1,cut=.3, dictionary=NULL,cor=TRUE,digits=2)
E,digits=2)
lookup(x,y,criteria=NULL)
fa.lookup(f,dictionary,digits=2)
item.looku
item.lookup(f,
p(f,m,
m, dictionary
dictionary,cut=
,cut=.3,
.3, digits
digits = 2)

Arguments

x A data matrix or data frame depending upon the function.


y A data matrix or data frame or a vector
criteria Which
Which va
varia
riable
bless (by name
name or loc
locati
ation)
on) sho
should
uld be the emp
empiri
irical
cal target
target for bes
bestSc
tScale
aless
and bestItems
f The object returned from either a factor analysis (fa) or a principal components
analysis (principal)
cut Return all values in abs(x[,c1]) > cut.
bestScales 23

abs if TRUE,
TRUE, sort by absolute value in bestItems
dictionary a data.frame
data.frame with rownames corresponding to rorownames
wnames in the f$loadings ma-
trix or colnames of the data matrix or correlation matrix, and entries (may be
multiple columns) of item content.
m A data frame of item means

cor if x is not a square matrix, should correlations be found?


n.item How many items make up an empirical scale
overlap Are the correlations with other criteria fair game for bestScales
digits round to digits

Details

bestItems and lookup are simple helper functions to summarize correlation matrices or factor
loading matrices. bestItems will sort the specified column (criteria) of x on the basis of the (ab-
solute) value of the column. The return as a default
solute) default is just the rowname
rowname of the variab
variable
le with those
absolute
absolute values
values > cut. If there is a dictionary
dictionary of item content
content and item names, then include the
contents as a two column matrix with rownames corresponding to the item name and then as many
fields as desired for item content. (See the example dictionary bfi.dictionary).
lookup is used by bestItems and will find values in c1 of y that match
match those in x. It returns thos
thosee
rows of y of that match x. Suppose
Suppose that you have a "dictionary"
"dictionary" of the many variables
variables in a study
but you want to consider a small subset of them in a data set x. Then, you can find the entries in the
dictionary corresponding to x by lookup(rownames(x),y) If the column is not specified, then it will
match by rownames(y).
fa.lookup is used when examining the output of a factor analysis and one wants the correspond-
ing variable
variable names and contents.
contents. The returne
returnedd object may then be printe
printed
d in LaT
LaTex
ex by using the
df2latex function with the char option set to TRUE.

Similarly, given a correlation matrix, r, of the x variables, if you want to find the items that most
correlate with another item or scale, and then show the contents of that item from the dictionary,
bestItems(r,c1=column number or name of x, contents = y)
bestScales will find up to n.items that have absolute correlations with a criterion greater than cut.
If the overlap option is FALSE (default) the other criteria are not used.
item.lookup combines the output from a factor analysis fa with simple descriptive statistics (a

data frame
by item of means)
mean. with aa dictionary.
This allows Items are grouped
better understanding of how aby factor
scale loadings
works, > cut,
in terms of and then sorted
the meaning of
the item endorsements.

Value

bestScales returns the correlation of the empirically constructed scale with each criteria and the
items used in the scale. If a dictionary is specified, it also returns a list (value) that shows the item
content. Also returns the keys list so that scales can be found using cluster.cor or scoreItems.
bestItems returns a sorted list of factor loadings or correlations with the labels as provided in the
dictionary.
lookup is a very simple implementation of the match function.

fa.lookup takes a factor/cluster analysis object (or just a keys like matrix), sorts it using fa.sort
and then matches by row.name to the corresponding dictionary entries.
24 bfi

Note

To create a dictionary, create an object with row names as the item numbers, and the columns as the
item content. See the link{bfi.dictionary} as an example.

Note

Although empirical scale construction is appealing, it has the basic problem of capitalizing on
chance. Thus, be careful of over interpreting the results unless working with large samples.

Author(s)

William Revelle

References

Re
Reve
velle
lle,, W. (in prepar
preparati
ation)
on) An introd
introduct
uction
ion to psycho
psychomet
metric
ric theory
theory wit
with
h applic
applicati
ations
ons in R. Spr
Spring
inger
er..
(A
(Available
vailable online at http://personality-project.org/r/boo
http://personality-project.org/r/book k).

See Also

fa, iclust,principal

Examples

bs <- bestScales(bfi,criteria=c("gender","education","age"),dictionary=bfi.dictionary)
bs
f5 <- fa(bfi
fa(bfi,5)
,5)
m <- colMeans(bfi
colMeans(bfi,na.r
,na.rm=TRUE
m=TRUE)
)
item.lookup(f5,m,dictionary=bfi.dictionary[2])
fa.lookup(f5
fa.lookup(f5,dicti
,dictionary
onary=bfi.d
=bfi.diction
ictionary[2]
ary[2])
) #just show the item content, not the source of the items

bfi 25 Personality items repr


representing
esenting 5 factors

Description

25 personality self report items taken from the International Personality Item Pool (ipip.ori.org)
were included as part of the Synthetic Aperture Personality Assessment (SAPA) web based per-
sonality
sona lity assessment
assessment project.
project. The data from 2800 subjects
subjects are inclu
included
ded here as a demonstra
demonstration
tion
set for scale constructi
construction,
on, factor analysis,
analysis, and Item Response Theor
Theoryy analysis.
analysis. Three additional
additional
demographic variables (sex, education, and age) are also included.

Usage

data(bfi)
data(bfi.dictionary)
bfi 25

Format

A data frame with 2800 observations on the following 28 variables. (The q numbers are the SAPA
item numbers).
A1 Am indifferent to the feelings of others. (q_146)
A2 Inquire about others’ well-being. (q_1162)
A3 Know how to comfort others. (q_1206)
A4 Love children. (q_1364)
A5 Make people feel at ease. (q_1419)
C1 Am exacting in my work. (q_124)
C2 Continue until everything is perfect. (q_530)
C3 Do things according to a plan. (q_619)
C4 Do things in a half-way manner. (q_626)
C5 Waste my time. (q_1949)
E1 Don’t talk a lot. (q_712)
E2 Find it difficult to approach others. (q_901)
E3 Know how to captivate people. (q_1205)
E4 Make friends easily. (q_1410)
E5 Take charge. (q_1768)

N1 Get angry easily. (q_952)


N2 Get irritated easily. (q_974)
N3 Have frequent mood swings. (q_1099
N4 Often feel blue. (q_1479)
N5 Panic easily. (q_1505)
O1 Am full of ideas. (q_128)
O2 Avoid difficult reading material.(q_316)
O3 Carry the conversation to a higher level. (q_492)
O4 Spend time reflecting on things. (q_1738)
O5 Will not probe deeply into a subject. (q_1964)
gender Males = 1, Females =2
education 1 = HS, 2 = finished HS, 3 = some college, 4 = college graduate 5 = graduate degree
age age in years

Details

The first 25 items are organized


organized by five putative
putative factors: Agreeablen
Agreeableness,
ess, Conscientious
Conscientiousness
ness,, Ex-
Opennness. The scoring key is created using make.keys, the scores
traversion, Neuroticism, and Opennness.
are found using score.items.
These five factors are a useful example of using irt.fa to do Item Response Theory based latent
factor analysis of the polychoric correlation matrix. The endorsement plots for each item, as well
as the item information functions reveal that the items differ in their quality.
The item data were collected using a 6 point response scale: 1 Very Inaccurate 2 Moderately Inac-
curate 3 Slightly Inaccurate 4 Slightly Accurate 5 Moderately Accurate 6 Very Accurate
as par
partt of the Synthe
Synthetic
tic Apetur
Apeturee Person
Personali
ality
ty Assess
Assessmen
mentt (SAPA http://sapa-project.org) project.
(SAP
To see an example of the data collection technique, visit http://SAPA-project.org. The items
given were sampled from the International Personality Item Pool of Lewis Goldberg using the sam-
pling technique of SAPA. This is a sample data set taken from the much larger SAPA data bank.
26 bi.bars

Source

The items are from the ipip (Goldberg, 1999). The data are from the SAPA project (Revelle, Wilt
and Rosenthal, 2010) , collected Spring, 2010 ( http://sapa-project.org).

References

Goldberg, L.R. (1999) A broad-bandwidth, public domain, personality inventory measuring the
lower-level facets of several five-factor models. In Mervielde, I. and Deary, I. and De Fruyt, F. and
Ostendorf,
Ostendorf, F. (eds) Personalit
Personalityy psycholog
psychology
y in Europe.
Europe. 7. Ti
Tilbur
lburg g Univers
University
ity Press. Til
Tilbur
burg,
g, The
Netherlands.
Revelle, W.,
Revelle, W., Wilt, J., and Rose
Rosenthal
nthal,, A. (2010
(2010)) Personalit
Personality
y and Cogn
Cognition:
ition: The Perso
Personalit
nality-Cog
y-Cognition
nition
Link. In Gruszka, A. and Matthews, G. and Szymura, B. (Eds.) Handbook of Individual Differences
in Cognition: Attention, Memory and Executive Control, Springer.

See Also

bi.bars to show the data by age and gender, irt.fa for item factor analysis applying the irt model.

Examples

data(bfi)
describe(bfi)

keys.list <-
keys.list
list(agree=c("-A1","A2","A3","A4","A5"),conscientious=c("C1","C2","C3","-C4","-C5"),
extraversion=c("-E1","-E2","E3","E4","E5"),neuroticism=c("N1","N2","N3","N4","N5"),
openness
openness = c("O1"
c("O1","-O2
,"-O2","O3"
","O3","O4",
,"O4","-O5")
"-O5"))
)
keys <- make.keys(b
make.keys(bfi,key
fi,keys.list
s.list)
)

scores <- scoreI


scoreItems(
tems(keys[1
keys[1:27,],
:27,],bfi[1:
bfi[1:27])
27]) #don t scor
score
e age
age
scores
#show
#show the use of the fa.lo
fa.looku
okup
p wit
with
h a dic
dictio
tionar
nary
y
fa.lookup(keys,bfi.dictionary[,1:4])

bi.bars Draw pairs of bargraphs


bargraphs based on two groups

Description

When showing e.g., age or education distributions for two groups, it is convenient to plot them back
to back. bi.bars will do so.

Usage

bi.bars(x,grp,horiz,color,label=NULL,...)
biplot.psych 27

Arguments

x The data to be drawn


grp a grouping variable.
horiz horizontal (default) or vertical bars

color colors for the two groups – defaults to blue and red
label If specified, labels for the dependent axis
... Further parameters to pass to the graphing program

Details

A trivial, if useful, function to draw back to back histograms/barplots. One for each group.

Value

a graphic

Author(s)

William Revelle

Examples

data(bfi)
with(bfi,{bi
with(bfi,{bi.bars(
.bars(age,g
age,gender,
ender,ylab="
ylab="Age",m
Age",main="A
ain="Age
ge by males and female
females")
s")
bi.bars(education,gender,xlab="Education",main="Education by gender",horiz=FALSE)})

biplot.psych Dra
Draww biplots
biplots of facto
factorr or compo
component
nent scor
scores
es by facto
factorr or compo
component
nent
loadings

Description

Extends the biplot function to the output of fa , fa.poly or principal. Will plot factor scores and
factor loadings in the same graph. If the number of factors > 2, then all pairs of factors are plotted.
Factor
Fact or score histograms
histograms are plotted on the diagonal. object from fa,
diagonal. The input is the resulting object
principal, or }code{linkfa.poly with the scores=TRUE option. Points may be colored according
to other criteria.

Usage

## S3 me
meth
thod
od fo
for
r cl
clas
ass
s psych  

biplot(x, labels=NULL,cex=c(.75,1),main="Biplot
labels=NULL,cex=c(.75,1),main="Biplot from fa",
hist.col="cyan",xlim.s=c(-3,3),ylim.s=c(-3,3)
hist.col="cyan",xlim.s=c(-3,3),ylim.s=c(-3,3),xlim.f=c(-1,1),ylim.f=
,xlim.f=c(-1,1),ylim.f=c(-1,1),
c(-1,1),
maxpoints=100,adjust=1.2,col,pos,
maxpoints=100,adjust=1.2,col,pos, arrow.len = 0.1,pch=16,choose=NULL,
cuts=1,cutl=.0,group=NULL,...)
28 biplot.psych

Arguments

x The output from fa , fa.poly or principal with the scores=TRUE option


labels if NULL, draw the points with the plot character (pch) specified. To identify the
data points, specify labels= 1:n where n is the number of observations, or labels
=rownames(data) where data was the data set analyzed by the factor analysis.

cex A vector of plot sizes of the data labels and of the factor labels
main A main title for a two factor biplot
hist.col If plotting more than two factors, the color of the histogram of the factor scores
xlim.s x limits of the scores. Defaults to plus/minus three sigma
ylim.s y limits of the scores.Defaults to plus/minus three sigma
xlim.f x limits of the factor loadings.Defaults to plus/minus 1.0
ylim.f y limits of the factor loadings.Defaults to plus/minus 1.0
maxpoints When plotting
plotting 3 (or more)
more) dimen
dimensions
sions,, at w
what
hat size should
should we switch
switch from
from
plotting "o" to plotting "."
adjust an adjustment factor in the histogram
col a vector of colors for the data points and for the factor loading labels
pos If plotting
plotting labels,
labels, what position
position shou
should
ld they be in? 1=below
1=below,, 2=lef
2=left,
t, 3 top, 4
right. If missing, then the assumption is that labels should be printed instead of
data points.
arrow.len the length of the arrow head
pch The plotting character to use. pch=16 gives reasonable size dots. pch="." gives
tiny points. If adding colors, use pch between 21 and 25. (see examples).
choose Plot just the specified factors
cuts Do not label cases with abs(factor scores) < cuts) (Actually
(Actually,, the distance of the
x and y scores from 0)
cutl Do not label variables with communalities in the two space < cutl
group A vect
vector
or of a gr
grou
oupi
ping
ng vari
variab
able
le for
for the
the sc
scor
ores
es.. Sh
Show
ow a diff
differ
eren
entt co
colo
lorr an
and
d sy
symb
mbol
ol
for each group.
... more options for graphics

Details

Uses the generic biplot function to take the output of a factor analysis fa, fa.poly or principal com-
ponents analysis principal and plot the factor/component scores along with the factor/component
loadings.
This is an extension of the generic biplot function to allow more control over plotting points in a
two space and also to plot three or more factors (two at time).
This will work for objects produced by fa , fa.poly or principal if they applied to the original
data matrix. If however, one has a correlation matrix based upon the output from tetrachoric or
polychoric, and has done either fa or principal on the correlations, then obviously, we can not
do a biplot.
biplot. Howev
However er,, both of those functions produce
produce a weig
weights
hts matrix, which, in combinatio
combination
n
with the original data can be used to find the scores by using factor.scores. Since biplot.psych is
looking for two elements of the x object: x$loadings and x$scores, you can create the appropriate
object to plot. See the third example.
block.random 29

Author(s)

William Revelle

See Also

fa, fa.poly, principal, fa.plot, pairs.panels

Examples

#the standard
standard examp
example
le
data(USArrests)
fa2 <- fa(USArrests
fa(USArrests,2,sco
,2,scores=TR
res=TRUE)
UE)
biplot(fa2,labels=rownames(USArrests))

# pl
plot
ot th
the
e 3 fact
factor
or solu
soluti
tion
on
data(bfi)
fa3 <- fa(bfi[1:200
fa(bfi[1:200,1:15]
,1:15],3,sco
,3,scores=TR
res=TRUE)
UE)
biplot(fa3)
#j
#jus
ust
t pl
plot
ot fact
factor
ors
s 1 and
and 3 from
from that
that solu
soluti
tion
on
biplot(fa3,choose=c(1,3))

fa2 <- fa(bfi


fa(bfi[16
[16:25
:25],2
],2)
) #fa
#facto
ctor
r ana
analys
lysis
is
fa2$sc
fa2$score
ores
s <- fa2
fa2$sc
$score
ores[1
s[1:10
:100,]
0,] #ju
#just
st tak
take
e the first 100
#now
#now plot
plot with
with dif
differ
ferent
ent colors and sha
shapes
pes for mal
males
es and female
females
s
biplot(fa2,pch=c(24,21)[bfi[1:100,"gender"]],group =bfi[1:100,"gender"],
main="Biplot
main="Biplot of Consci
Conscientiou
entiousness
sness and Neurot
Neuroticism
icism by gender
gender")
")

r <- cor(bfi[1:20
cor(bfi[1:200,1:1
0,1:10],
0], use="p
use="pairwis
airwise")
e") #find the correl
correlations
ations
f2 <- fa(r,2
fa(r,2)
)
x <- li
list
st()
()
x$scores
x$scores <- factor
factor.scor
.scores(bfi
es(bfi[1:200
[1:200,1:10]
,1:10],f2)
,f2)
x$loadings
x$loadings <- f2$lo
f2$loadings
adings
class(
class(x)   
x) <- c( psych , fa ) 

biplot(x,mai
biplot(x,main="bip
n="biplot
lot from correl
correlation
ation matrix and factor scores")

block.random Create a block randomized structur


structuree for n independent variables

Description

Random assignment of n subjects with an equal number in all of N conditions may done by block
randomizat
rando mization,
ion, where the block size is the number
number of expe
experimen
rimental
tal conditio
conditions.
ns. The number of
Independen
Indep endentt Variables
ariables and the number
number of lev
levels
els in each IV are spec
specified
ified as input. The output is a
the block randomized design.

Usage

block.rand
block.random(n
om(n,
, ncond = NULL)
30 blot

Arguments

n The number
number of subjects
subjects to randomize.
randomize. Must be a multip
multiple
le of the numbe
numberr of
experimental conditions
ncond The numbe
numberr of conditions
conditions for each IV.
IV. Defa
Defaults
ults to 2 levels
levels for one IV.
IV. If more
than one IV, specify as a vector. If names are provided, they are used, otherwise
the IVs are labeled as IV1 ... IVn

Value

blocks A matrix of subject numbers, block number, and randomized levels for each IV

Note

Prepared for a course on Research Methods in Psychology http://personality-project.org/


revelle/syllabi/205/205.syllabus.html

Author(s)

William Revelle

Examples

br <- block.random
block.random(n=24
(n=24,c(2,3
,c(2,3))
))
pairs.panels(br)
br <- block.random
block.random(96,c
(96,c(time=
(time=4,drug
4,drug=3,sex
=3,sex=2))
=2))
pairs.panels(br)

blot Bond’s Logical Operations Test – BLOT

Description

35 items for 150 subjects from Bond’s Logical Operations Test. A good example of Item Response
Theory
Theo ry analysis using the Rasch model. One parameter
parameter (Rasch) analysis
analysis and two parameter
parameter IRT
analyses produce somewhat different results.

Usage

data(blot)

Format

A data frame with 150 observation


observationss on 35 variab
variables.
les. The BLOT
BLOT was develo
developed
ped as a paper
paper and
pencil test for children to measure Logical Thinking as discussed by Piaget and Inhelder.
bock 31

Details

Bond and Fox apply Rasch modeling to a variety of data sets. This one, Bond’s Logical Operations
Test, is used as an example of Rasch modeling for dichotomous items. In their text (p 56), Bond and
Fox report the results using WINSTEPS. Those results are consistent (up to a scaling parameter)
with
wit h tho
those
se found by the rasch
rasch fun
functi
ction
on in the ltm packag
package.e. The
The WIN
WINSTE
STEPS
PS seem
seem to produce
produce
difficulty estimates with a mean item difficulty of 0, whereas rasch from ltm has a mean difficulty
of -1.52. In addition, rasch seems to reverse the signs of the difficulty estimates when reporting the
coefficients and is effectively reporting "easiness".
However, when using a two parameter model, one of the items (V12) behaves very differently.
This data set is useful when comparing 1PL, 2PL and 2PN IRT models.

Source

The dat
dataa are tak
taken
en (with
(with kind
kind permis
permissio
sion
n fro
from
m Tr
Trev
evor
or Bond)
Bond) fro
from
m the web
webpag
pagee http:/
http://ho
/homes
mes.jc
.jcu.e
u.edu.
du.au/
au/~ed
~edtgb
tgb/bo
/book/
ok/dat
dataa
and read using read.fwf.

References

T.G. Bond. BLOT


BLOT:Bond’s
:Bond’s Logical
Logical Operations Test.
Test. Townsville, Australia: James Cook Univer-
Univer-
sity. (Original work published 1976), 1995.
T. Bond and C. Fox. (2007) Applying the Rasch model: Fundamental measurement in the human
sciences. Lawrence Erlbaum, Mahwah, NJ, US, 2 edition.

See Also

See also the irt.fa and associated plot functions.

Examples
data(blot)
#not
#not run
#library(ltm)
#bblot
#bblot.ra
.rasch
sch <- ras
rasch(
ch(blo
blot,
t, con
constr
strain
aint
t = cbi
cbind(
nd(nco
ncol(b
l(blot
lot)
) + 1, 1)) #a 1PL model
#blot.
#blot.2pl
2pl <- ltm(blot
ltm(blot~z1
~z1)
) #a 2PL model
#do the same
same thi
thing
ng with fun
functi
ctions
ons in psy
psych
ch
#b
#blo
lot.
t.fa
fa <- irt.
irt.fa
fa(b
(blo
lot)
t) # a 2PN
2PN mode
model
l
#plot(blot.fa)

bock Bock and Liberman (1970) data set of 1000 observations of the LSAT

Description

An example data set used by McDonald (1999) as well as other discussions of Item Response
Theory makes use of a data table on 10 items (two sets of 5) from the Law School Admissions Test
(LSAT). Included in this data set is the original table as well as the reponses for 1000 subjects on
the first set (Figure Classification) and second set (Debate).

Usage

data(bock)
32 bock

Format

A data frame with 32 observations on the following 8 variables.

index 32 response patterns

Q1 Responses to item 1

Q2 Responses to item 2

Q3 Responses to item 3

Q4 Responses to item 4

Q5 Responses to item 5

Ob6 count of observations for the section 6 test

Ob7 count of observations for the section 7 test

Two other data sets are derived


derived from the bock dataset.
dataset. These
These are con
convert
verted
ed using the table2df
function.

lsat6 reponses to 5 items for 1000 subjects on section 6

lsat7 reponses to 5 items for 1000 subjects on section 7

Details

The lsat6 data set is analy


analyzed
zed in the ltm packag
packagee as well as by McDo
McDonald
nald (1999).
(1999). lsat7 is another
1000 subjects on part 7 of the LSAT. Both sets are described by Bock and Lieberman (1970).
Both sets are useful examples of testing out IRT procedures and showing the use of tetrachoric
correlations and item factor analysis using the irt.fa function.

Source

R. Darrell Bock and M. Liebe


Lieberman
rman (1970). Fitting
Fitting a respo
response
nse model for dichotomo
dichotomously
usly scored
items. Psychometrika, 35(2):179-197.

References

R.P. McDonald. Test theory: A unified treatment. L. Erlbaum Associates, Mahwah, N.J., 1999.

Examples

data(bock)
responses <- table2df(bock.table[,2:6],count=bock.table[,7],
labs= paste("lsat6.",1:5,sep=""))
describe(responses)
## maybe str(bock.table)
str(bock.table) ; plot(b
plot(bock.ta
ock.table)
ble) ...
burt 33

burt 11 emotional variables from Burt (1915)

Description

Cyril Burt reported an early factor analysis with a circumplex structure of 11 emotional variables in
1915. 8 of these were subsequently used by Harman in his text on factor analysis. Unfortunately, it
seems as if Burt made a mistake for the matrix is not positive definite. With one change from .87 to
.81 the matrix is positive definite.

Usage

data(burt)

Format

A correlation matrix based upon 172 "normal school age children aged 9-12".
Sociality Sociality
Sorrow Sorrow
Tenderness Tenderness
Joy Joy
Wonder Wonder
Elation Elation
Disgust Disgust
Anger Anger
Sex Sex
Fear Fear
Subjection Subjection

Details

The Burt data set is interestin


interesting
g for sev
several
eral reaso
reasons.
ns. It seems to be an early examp
example
le of the orga-
nizaton of emotions into an affective circumplex, a subset of it has been used for factor analysis

examples
has one negative eigenvalue., and
(see Harman.Burt Withit the
is an example ofof
replacement howthetypos affect data.
correlation The Sorrow
between originaland
dataTender-
matrix
ness from .87 to .81, the matrix is positive definite.
Alternatively, using cor.smooth, the matrix
matrix can be made
made pos
positi
itive
ve definit
definitee as well,
well, althou
although
gh cor
cor.sm
.smoot
ooth
h
makes more (but smaller) changes.

Source

(retrieved from the web at http://www.biodiversitylibrary


http://www.biodiversitylibrary.org/item/95822#790)
.org/item/95822#790) Following a sugges-
tion by Jan DeLeeuw.

References

Burt, C.General and Specific Factors underlying the Primary Emotions. Reports of the British As-
sociation
sociation for the Advance
Advancement
ment of Science,
Science, 85th meeting,
meeting, held in Manchest
Manchester,
er, Septe
September
mber 7-11, 1915.
London,
Lond on, John Murray
Murray, 1916, p. 694-696
694-696 (retri
(retriev
eved
ed from the web at http:/
http://www
/www.biod
.biodive
iversity
rsitylibra
library
ry.org
.org/item
/item/9582
/95822#790
2#790))
34 circ.tests

See Also

Harman.Burt in the Harman dataset and cor.smooth

Examples

data(burt)
eigen(bur
eigen(burt)$
t)$val
values
ues #on
#one
e is neg
negati
ative!
ve!
burt.n
burt.new
ew <- bur
burt
t
burt.new[2,3
burt.new[2,3]
] <- burt.
burt.new[3,
new[3,2]
2] <- .81
eigen(burt.n
eigen(burt.new)$va
ew)$values
lues #all are ppositiv
ositive
e
bs <- cor.smooth(b
cor.smooth(burt)
urt)
round(burt.n
round(burt.new
ew - bs,3)

circ.tests Apply four tests of circump


circumplex
lex versus simple structur
structuree

Description

Rotations of factor analysis and principal components analysis solutions typically try to represent
correlatio
correlation
n matrices as simple structured.
structured. An alternativ
alternativee structure,
structure, appealing
appealing to some, is a cir-
cumplex structure where the variables are uniformly spaced on the perimeter of a circle in a two
dimensional space. Generating these data is straightforward, and is useful for exploring alternative
solutions to affect and personality structure.

Usage

circ.t
circ.test
ests(l
s(load
oads,
s, loa
loadin
ding
g = TRU
TRUE,
E, sor
sortin
ting
g = TRU
TRUE)
E)

Arguments

loads A matrix of loadings loads here


loading Are these loadings or a correlation matrix loading
sorting Should the variables be sorted sorting

Details

“A common model for representing psychological data is simple structure (Thurstone, 1947). Ac-
cording
cording to one common interpretation
interpretation,, data are simple
simple structured
structured when items or scales
scales have
have non-
zero factor loadings on one and only one factor (Revelle & Rocklin, 1979). Despite the common-
place application of simple structure, some psychological models are defined by a lack of simple
structure. Circumplexes (Guttman, 1954) are one kind of model in which simple structure is lack-
ing.
“A number of elementary requirements can be teased out of the idea of circumplex structure. First,
circumplex structure implies minimally that variables are interrelated; random noise does not a
circumple
circu mplex x make
make.. Secon
Second,
d, circumple
circumplex
x structure
structure implies that the domain
domain in question is optim
optimally
ally
represented by two and only two dimensions. Third, circumplex structure implies that variables do
not group or clump along the two axes, as in simple structure, but rather that there are always inter-
stitial variables between any orthogonal pair of axes (Saucier, 1992). In the ideal case, this quality
will be reflected in equal spacing of variables along the circumference of the circle (Gurtman, 1994;
circ.tests 35

Wiggins, Steiger, & Gaelick, 1981). Fourth, circumplex structure implies that variables have a con-
stant radius from the center of the circle, which implies that all variables have
have equal communality on
the two circumplex dimensions (Fisher, 1997; Gurtman, 1994). Fifth, circumplex structure implies
that all rotations are equally good representations of the domain (Conte & Plutchik, 1981; Larsen
& Diener, 1992). (Acton and Revelle, 2004)
Acton and Revelle reviewed the effectiveness of 10 tests of circumplex structure and found that
four did a particularly good job of discriminating circumplex structure from simple structure, or
circumplexes from ellipsoidal structures.
structures. Unfortunately
Unfortunately,, their work was done in Pascal and is not
easily available. Here we release R code to do the four most useful tests:
1 The Gap test of equal spacing
2 Fisher’s test of equality of axes
3 A test of indifference to Rotation
4 A test of equal Variance of squared factor loadings across arbitrary rotations.
To interpret the values of these various tests, it is useful to compare the particular solution to simu-
lated solutions representing pure cases of circumplex and simple structure. See the example output
from circ.simulation and compare these plots with the results of the circ.test.

Value

A list of four items is returned. These are the gap, fisher, rotation and variance test results.

gaps gap.test
fisher fisher.test
RT rotation.test
VT variance.test

Note

Of the 10 criterion discussed in Acton and Revelle (2004), these tests operationalize the four most
useful.

Author(s)

William Revelle

References

Acton, G. S. and Revelle, W. (2004) Evaluation of Ten Psychometric Criteria for Circumplex Struc-
ture. Methods of Psychological Research Online, Vol. 9, No. 1 http://personality-project.
org/revelle/publications/acton.revelle.mpr110_10.pdf

See Also

To understand
understand the results of the circ.
circ.test
testss it it best to compare
compare it to simulated
simulated values.
values. Thus,
Thus, see
circ.simulation, sim.circ
36 cities

Examples
circ.data
circ.data <- circ.s
circ.sim(24,
im(24,500)
500)
circ.fa <- fa(circ.dat
circ.fa fa(circ.data,2)
a,2)
plot(circ.fa,title="Circumplex Structure")
ct <- circ.tests(c
circ.tests(circ.f
irc.fa)
a)
#compare
#compare with non-c
non-circump
ircumplex
lex data

simp.data
simp.data <- item.s
item.sim(24,
im(24,500)
500)
simp.fa <- fa(simp.dat
simp.fa fa(simp.data,2)
a,2)
plot(simp.fa,title="Simple Structure")
st <- circ.tests(s
circ.tests(simp.f
imp.fa)
a)
res <- rbind(ct[1:4
rbind(ct[1:4],st[1
],st[1:4])
:4])
rownames(res
rownames(res)
) <- c("ci
c("circumpl
rcumplex","S
ex","Simple"
imple")
)
print(res,digits=2)

cities Distances between 11 US cities

Description

Airline distances between 11 US cities may be used as an example for multidimensional scaling or
cluster analysis.

Usage

data(cities)

Format

A data frame with 11 observations on the following 11 variables.


ATL Atlana, Georgia
BOS Boston, Massachusetts
ORD Chicago, Illinois
DCA Washington, District of Columbia
DEN Denver, Colorado
LAX Los Angeles, California
MIA Miami, Florida
JFK New York, New York
SEA Seattle, Washington
SFO San Francisco, California
MSY New Orleans, Lousianna

Details

An 11 x11
x11 ma
matr
trix
ix of di
dist
stan
ance
cess betw
betwee
een
n ma
majo
jorr US ai
airp
rpor
orts
ts.. This
This is a usef
useful
ul demo
demons
nstr
trat
atio
ion
n of mu
mult
ltip
iple
le
dimensional scaling.
city.location is a dataframe of longitude and latitude for those cities.
Note that the 2 dimensional MDS solution does not perfectly capture the data from these city dis-
tances. Boston, New York and Washington, D.C. are located slightly too far west, and Seattle and
LA are slightly too far south.
cluster.fit 37

Source

http://www.timeanddate.com/worldclock/distance.html

Examples

data(cities)
city.locatio
city.location[,1]
n[,1] <- -city.
-city.locati
location[,1]
on[,1]
#not
#not run
#a
#an
n ov
over
erla
lay
y map
map can
can be adde
added
d if the
the pack
packag
age
e maps
maps is avai
availa
labl
ble
e
#
#
#libary(maps)
#map("usa")
#title("Mult
#title("MultiDimen
iDimensiona
sional
l Scalin
Scaling
g of US cities
cities")
")
#points(city.location)

plot(city.location
plot(city.location,
, xlab="
xlab="Dimens
Dimension
ion 1", ylab="
ylab="Dimen
Dimension
sion 2",
main ="Multidimensiona
="Multidimensional
l scalin
scaling
g of US cities
cities")
")
city.l
city.loc
oc <- cmd
cmdsca
scale(
le(cit
cities
ies,
, k=2
k=2)
) #as
#ask
k for a 2 dim
dimens
ension
ional
al sol
soluti
ution
on rou
round(
nd(cit
city.l
y.loc,
oc,0)
0)
city.loc
city.loc <- -city.
-city.loc
loc
city.loc <- rescale(city.loc,apply(city.location,2,mean),apply(city.location,2,sd))
points(city.loc,type="n")
text(city.loc,labels=names(cities))

cluster.fit cluster Fit: fit of the cluster model to a correlatio


correlation
n matrix

Description

How well does the cluster model found by ICLUST fit the original correlation
correlation matri
matrix?
x? A similar
algorithm factor.fit is found in VSS . This function is internal to ICLUST but has more general
use as well.
In general, the cluster model is a Very
Very Simple Structure model of complexity
complexity one. That is, every
item is assumed to represent only one factor/cluster. Cluster fit is an analysis of how well this model
reproduces a correlation matrix. Two measures of fit are given: cluster fit and factor fit. Cluster fit
assumes
assumes that variable
variabless that define different
different clusters
clusters are ortho
orthogonal
gonal.. Fact
Factor
or fit take
takess the loadings
generated by a cluster model, finds the cluster loadings on all clusters, and measures the degree of
fit of this somewhat more complicated model. Because the cluster loadings are similar to, but not
identical to factor loadings, the factor fits found here and by factor.fit will be similar.

Usage

cluster.fi
cluster.fit(or
t(origina
iginal,
l, load, clust
clusters,
ers, diago
diagonal
nal = FALSE
FALSE)
)

Arguments

original The original correlation matrix being fit


load Clust
Cluster
er loadings
loadings – that is, the correlatio
correlation
n of indi
individua
viduall items with the clusters,
clusters,
corrected for item overlap
clusters The cluster structure
diagonal Should we fit the diagonal as well?
38 cluster.loadings

Details

The cluster
cluster model is similar
similar to the factor model:
model: R is fitted by C’C. Where C <- Cluster defini
definition
tion
matrix x the loading matrix. How well does this model approximate the original correlation matrix
and how does this compare to a factor model?
The fit statistic is a comparison of the original (squared) correlations to the residual correlations.
Fit = 1 - r*2/r2 where r* is the residual correlation of data - model and model = C’C.

Value

clusterfit The cluste


clusterr model
model is a reduced
reduced form
form of tthe
he fa
factor
ctor loadin
loading
g matrix.
matrix. That is, it is
the product of the elements of the cluster matrix * the loading matrix.
factorfit How well does the complete loading matrix reproduce the correlation matrix?

Author(s)

Maintainer: William Revelle <[email protected]


<[email protected]>
du>

References

http://personality-project.org/r/r.ICLUST.html

See Also

VSS, ICLUST, factor2cluster, cluster.cor, factor.fit

Examples

r.mat<- Harman74.cor$cov
iq.clus
iq.clus <- ICLUST
ICLUST(r.ma
(r.mat,nclu
t,nclusters
sters =2)
fit <- cluster.fit(r.mat,iq.clus$loadings,iq.clus$clusters)
fit

cluster.loadings Find item by cluster correlatio


correlations,
ns, correcte
corrected
d for overlap and reliability

Description

Given a n x n correlation matrix and a n x c matrix of -1,0,1 cluster weights for those n items on c
clusters, find the correlation of each item with each cluster. If the item is part of the cluster, correct
for item overlap. Part of the ICLUST set of functions, but useful for many item analysis problems.

Usage

cluster.lo
cluster.loadin
adings(ke
gs(keys,
ys, r.mat,
r.mat, correct
correct = TRUE,SMC=T
TRUE,SMC=TRUE)
RUE)
cluster.loadings 39

Arguments

keys Cluster keys: a matrix of -1,0,1 cluster weights


r.mat A correlation matrix
correct Correct for reliability

SMC Use the squared multiple correlation as a communality estimate, otherwise use
the greatest correlation for each variable

Details

Given a set of items to be scored as (perhaps overlapping) clusters and the intercorrelation matrix
of the items,
items, find the clusters
clusters and then the correlatio
correlations
ns of each item with each cluster.
cluster. Correct
Correct for
item overlap by replacing the item variance with its average within cluster inter-item correlation.
Although part of
Although of ICLUST
ICLUST,, this may be
be used in an
any SAPA (http://sapa-project.org) application
y SAPA
where we are interested in item- whole correlations of items and composite scales.
These loadings are particularly interpretable when sorted by absolute magnitude for each cluster
(see ICLUST.sort).

Value
loadings A matrix of item-cluster correlations (loadings)
cor Correlation matrix of the clusters
corrected Correlation matrix of the clusters, raw correlations below the diagonal, alpha on
diagonal, corrected for reliability above the diagonal
sd Cluster standard deviations
alpha alpha reliabilities of the clusters
G6 G6* Modified estimated of Guttman Lambda 6
count Number of items in the cluster

Note

Although part of ICLUST, this may be used in any SAPA application where we are interested in
item- whole correlations of items and composite scales.

Author(s)

Maintainer: William Revelle <[email protected]


<[email protected]>
du>

References

ICLUST: http://personality-project.org/r/r.ICL
http://personality-project.org/r/r.ICLUST.html
UST.html

See Also

ICLUST, factor2cluster, cluster.cor


40 cluster.plot

Examples

r.mat<- Harman74.cor$cov
clusters <- matrix(c(1,1,1,rep(0,24),1,1,1,1,rep(0,17)),ncol=2)
cluster.loadings(clusters,r.mat)

cluster.plot Plot factor/cluster loadings and assign items to clusters by their high-
est loading.

Description

Cluster analysis and factor analysis are procedures for grouping items in terms of a smaller number
of (latent)
(latent) factors or (observed
(observed)) clusters.
clusters. Graph
Graphical
ical presentation
presentationss of clust
clusters
ers typically
typically sho
show
w tree
structures, although they can be represented in terms of item by cluster correlations.
.plot plots items by their cluster loadings (taken, e.g., from ICLUST) or factor loadings ((taken,
Cluster.plot
Cluster taken,

eg., from
highest fa ). Clus
Cluster
(absolute) ter membership
member
cluster ship
loading formay
eachbeitem.
assigned apriori
apriori or may be determin
determined
ed in terms of the

If the input is an object of class "kmeans", then the cluster centers are plotted.

Usage

cluster.pl
cluster.plot(i
ot(ic.res
c.results,
ults, cluster = NULL, cut = 0, label
labels=NUL
s=NULL,
L,
title = "Cluster plot",pch=18,pos,show.points=TRUE,choose=NULL,...)
plot",pch=18,pos,show.points=TRUE,choose=NULL,...)
fa.plot(ic
fa.plot(ic.res
.results,
ults, cluster = NULL, cut = 0, label
labels=NUL
s=NULL,tit
L,title,
le,
jiggle=FALSE,amount=.02,pch=18,pos,show.poin
jiggle=FALSE,amount=.02,pch=18,pos,show.points=TRUE,choose=NULL,...
ts=TRUE,choose=NULL,...)
)
factor.plo
factor.plot(ic
t(ic.resu
.results,
lts, cluster
cluster = NULL, cut = 0, label
labels=NUL
s=NULL,tit
L,title,ji
le,jiggle=
ggle=FALSE
FALSE,
,
amount=.02,pch=18,pos,show.points=TRUE,...)
amount=.02,pch=18,pos,show.points=TRUE,...) #deprecated

Arguments

ic.results A factor
factor analysis
analysis or cluster
cluster analysi
analysiss output
output inc
includin
luding
g the lo
loading
adings,
s, or a matrix
matrix
of item by cluster correlations. Or the output from a kmeans cluster analysis.
cluster A vector of cluster membership
cut Assign items to clusters if the absolute loadings are > cut
labels If row.name
row.namess exist
exist they will be added
added to
to the
the plot, or, if they don’
don’t,
t, llabels
abels can
be specified.
specified. If labels =NULL
=NULL,, and there are no row names, then varia
variables
bles are
labeled by row number.)
title Any title
jiggle When plotti
plotting
ng with factor
factor loadings
loadings that are almos
almostt identical
identical,, it is sometimes
sometimes
useful to "jiggle" the points by jittering them. The default is to not jiggle.
amount if jiggle=TRUE,
jiggle=TRUE, then how much should the points be jittered?
pch factor and clusters are shown with different pch values, starting at pch+1

You might also like