Modification indices can be requested by adding the argument modindices =
TRUE
in the summary()
call, or by calling the function modindices()
directly. By default, modification indices are printed out for each
nonfree (or fixed-to-zero) parameter. The modification indices are
supplemented by the expected parameter
change (EPC) values (column epc
). The last three columns contain the
standardized EPC values (sepc.lv
: only standardizing the latent variables;
sepc.all
: standardizing all variables; sepc.nox
: standardizing all
but exogenous observed variables).
A typical use of the modindices()
function is as follows:
fit <- cfa(HS.model,
data = HolzingerSwineford1939)
modindices(fit, sort = TRUE, maximum.number = 5)
lhs op rhs mi epc sepc.lv sepc.all sepc.nox
30 visual =~ x9 36.411 0.577 0.519 0.515 0.515
76 x7 ~~ x8 34.145 0.536 0.536 0.859 0.859
28 visual =~ x7 18.631 -0.422 -0.380 -0.349 -0.349
78 x8 ~~ x9 14.946 -0.423 -0.423 -0.805 -0.805
33 textual =~ x3 9.151 -0.272 -0.269 -0.238 -0.238
This will print out the top 5 parameters (that can be added to the model) that result in the largest modification index, sorted from high to low.
The modindices()
function returns a data frame, which you can
sort or filter to extract what you want. For example, to see
only the modification indices for the factor loadings, you can use something
like this:
fit <- cfa(HS.model,
data = HolzingerSwineford1939)
mi <- modindices(fit)
mi[mi$op == "=~",]
lhs op rhs mi epc sepc.lv sepc.all sepc.nox
25 visual =~ x4 1.211 0.077 0.069 0.059 0.059
26 visual =~ x5 7.441 -0.210 -0.189 -0.147 -0.147
27 visual =~ x6 2.843 0.111 0.100 0.092 0.092
28 visual =~ x7 18.631 -0.422 -0.380 -0.349 -0.349
29 visual =~ x8 4.295 -0.210 -0.189 -0.187 -0.187
30 visual =~ x9 36.411 0.577 0.519 0.515 0.515
31 textual =~ x1 8.903 0.350 0.347 0.297 0.297
32 textual =~ x2 0.017 -0.011 -0.011 -0.010 -0.010
33 textual =~ x3 9.151 -0.272 -0.269 -0.238 -0.238
34 textual =~ x7 0.098 -0.021 -0.021 -0.019 -0.019
35 textual =~ x8 3.359 -0.121 -0.120 -0.118 -0.118
36 textual =~ x9 4.796 0.138 0.137 0.136 0.136
37 speed =~ x1 0.014 0.024 0.015 0.013 0.013
38 speed =~ x2 1.580 -0.198 -0.123 -0.105 -0.105
39 speed =~ x3 0.716 0.136 0.084 0.075 0.075
40 speed =~ x4 0.003 -0.005 -0.003 -0.003 -0.003
41 speed =~ x5 0.201 -0.044 -0.027 -0.021 -0.021
42 speed =~ x6 0.273 0.044 0.027 0.025 0.025
It is important to realize that the modindices()
function will only consider
fixed-to-zero parameters. If you have equality constraints in the
model, and you wish to examine what happens if you release all (or some) of
these equality constraints, use the lavTestScore()
function.