File: mxMI.Rd

package info (click to toggle)
r-cran-openmx 2.21.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,412 kB
  • sloc: cpp: 36,577; ansic: 13,811; fortran: 2,001; sh: 1,440; python: 350; perl: 21; makefile: 5
file content (94 lines) | stat: -rwxr-xr-x 4,773 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
%
%   Copyright 2007-2021 by the individuals mentioned in the source code history
%
%   Licensed under the Apache License, Version 2.0 (the "License");
%   you may not use this file except in compliance with the License.
%   You may obtain a copy of the License at
% 
%        http://www.apache.org/licenses/LICENSE-2.0
% 
%   Unless required by applicable law or agreed to in writing, software
%   distributed under the License is distributed on an "AS IS" BASIS,
%   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%   See the License for the specific language governing permissions and
%   limitations under the License.

\name{mxMI}
\alias{mxMI}


\title{Estimate Modification Indices for MxModel Objects}

\description{
This function estimates the change in fit function value resulting from freeing currently fixed parameters.
}

\usage{
mxMI(model, matrices=NA, full=TRUE)
}


\arguments{
   \item{model}{An MxModel for which modification indices are desired.}
   \item{matrices}{Character vector.  The names of the matrices in which to search for modification}
   \item{full}{Logical.  Whether or not to return the full modification index in addition to the restricted.}
}

\details{
Modification indices provide an estimate of how much the fit function value would change if a parameter that is currently fixed was instead freely estimated.  There are two versions of this estimate: a restricted version and an full version.  The restricted version is reported as the MI and is much faster to compute.  The full version is reported as MI.Full.  The full version accounts for the \emph{total} change in fit function value resulting from the newly freed parameter.  The restricted version only accounts for the change in the fit function due to the movement of the new free parameter.  In particular, the restricted version does not account for the change in fit function value due to the other free parameters moving in response to the new parameter.

The algorithm respects fixed parameter labels.  That is, when a fixed parameter has a label and occurs in more than one spot, then that fixed parameter is freed in all locations in which it occurs to evaluate the modification index for that fixed parameter.

When the fit function is in minus two log likelihood units (e.g. \code{\link{mxFitFunctionML}}), then the MI will be approximately chi squared distributed with 1 degree of freedom.  Using a p-value of 0.01 has been suggested.  Hence, a MI greater than \code{qchisq(p=1-0.01, df=1)}, or 6.63, is suggestive of a modification.

Users should be cautious in their use of modification indices.  If a model was created with the aid of MIs, then it should \emph{always} be reported.  \emph{Do not pretend that you have a theoretical reason for part of a model that was put there because it was suggested by a modification index.  This is fraud.}  When using modification indices there are two options for best practices.  First, you can report the analyses as exploratory.  Document all the explorations that you did, and know that your results may or may not generalize.  Second, you can use cross-validation.  Reserve part of your data for exploration, and use the remaining data to test if the exploratory model generalizes to new data.
}

\value{
    A named list with components
    \describe{
        \item{MI}{The restricted modification index.}
        \item{MI.Full}{The full modification index.}
        \item{plusOneParamModels}{A list of models with one additional free parameter}
    }
}


\references{
S\ifelse{latex}{\out{\"o}}{\ifelse{html}{\out{ö}}{o}}rbom, D.  (1989).  Model Modification.  \emph{Psychometrika, 54}, 371-384.

The OpenMx User's guide can be found at \url{https://openmx.ssri.psu.edu/documentation/}.
}

\examples{
# Create a model
require(OpenMx)
data(demoOneFactor)
manifests <- names(demoOneFactor)
latents <- c("G")
factorModel <- mxModel("One Factor",
      type="RAM",
      manifestVars = manifests,
      latentVars = latents,
      mxPath(from=latents, to=manifests),
      mxPath(from=manifests, arrows=2),
      mxPath(from=latents, arrows=2,
            free=FALSE, values=1.0),
      mxPath(from = 'one', to = manifests),
      mxData(observed=cov(demoOneFactor), type="cov", numObs=500,
             means = colMeans(demoOneFactor)))
#No SEs for speed
factorModel <- mxOption(factorModel, 'Standard Errors', 'No')
factorRun <- mxRun(factorModel)

# See if it should be modified
# Notes
#  Using full=FALSE for faster performance
#  Using matrices= 'A' and 'S' to not get MIs for
#    the F matrix which is always fixed.
fim <- mxMI(factorRun, matrices=c('A', 'S'), full=FALSE)
round(fim$MI, 3)
plot(fim$MI, ylim=c(0, 10))
abline(h=qchisq(p=1-0.01, df=1)) # line of "significance"

}