MICTable: MICTable

Description Usage Arguments Details Value Examples

View source: R/MICTable.R

Description

Takes a set of models and compares them all, following the rules in Brick and Bailey (2019).

Usage

1
2
3
MICTable(..., minAbs = 0.01, minDiff = NA, splitByType = TRUE,
  standardize = FALSE, caption = NULL, print = c("exist", "sign",
  "scale"), from = NA, to = NA, se = NA, N = NA)

Arguments

...

MxModels from which to extract MICs

minAbs

the smallest absolute size of causal effect that is worth noticing (default .01)

minDiff

the smallest difference in effect that is worth considering a difference of scale (default minAbs)

splitByType

If TRUE, return a list of tables split by the type of difference (e.g. existence of causal pathway, sign of causal path, scale of path, none of the above). If FALSE, return a single table. Default TRUE.

standardize

If TRUE, return standardized values

print

A list of the tables to be printed. Set to FALSE to stop pretty-printing. By default, prints effects that differ by existence, sign, or scale. See details.

from

A list of sources: paths not from a listed source are not printed. Default NA (print all).

to

A list of the outcomes; paths not ending at a listed outcome are not printed. Default NA (print all).

se

Whether or not to return standard errors, and which to return. Model must be a run MxModel, but consult umxLav2RAM to create and run an MxModel using lavaan syntax. See details.

N

The expected N size for hypothetical standard errors

Details

Returns a comparison table comparing MICs from several models.

The print= argument can be used to trigger pretty-printing using kable from the knitr package. The value of the print= vector contains the list of tables to pretty-print. Each table printed will be reduced to the paths of interest, as defined by the from= and to= arguments. Possible values are: existence: Model-implied causal effects with absolute value > minAbs in at least one model that either do not exist or have absolute value < minAbs in at least one other sign: Model-implied causal effects that exist in all models, but are positive in at least one model and negative in at least one other scale: Model-implied causal effects that exist with the same sign in all models, but differ in scale by at least minDiff in two models other: Model-implied causal effects that do not differ by at least minDiff in any model all: All model-implied causal effects any: Model implied causal effects that differ that differ by sign, scale, or existence between at least two models Pretty-printing may be disabled by setting it to FALSE or an empty vector. If only one model is provided, "all" will print the entire model table; any other legal value will print all effects with an absolute value larger than minAbs. This functionality may be replicated using the kable() function if more precision is desired.

Standard errors are computed by the delta method using the mxSE function. Options for SE computation are FALSE (do not compute), "observed" (compute using existing data), "hypothetical" (compute assuming perfect model fit). Any other value (default) selects observed if the model has been run and has not been modified since running, and hypothetical otherwise. Observed computes the SE as a traditional standard error on the fitted model; this is best if the goal is to examine an existing model fit. Hypothetical SEs assume the model is correct. The function generates a covariance and means matrix from the model expectation and fits a new model using those values as data. It then computes SEs using the delta method from these observed data. If data exists in the model, the number of data rows specified there is used. If not, nHypo must be specified.

Value

If splitByType is FALSE, a single data frame containing all implied causal effects, as compared across all models.

If splitByType is TRUE (the default if more than one model is povided), five data frames: $exist contains causal effects that exist (|>minAbs|) in at least one model but do not exist in at least one other $sign contains causal effects that exist in all models, but with different signs in at least two models $scale contains causal effects with the same sign in all models, but which differ in scales (diff > minDiff) between at least two models $other causal effects that are identical between models $all contains the combined table, as would be returned if splitByType were FALSE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(lavaan)
XYZmodel <- lavaan("Y ~ .2*X +.6*Z
                    Z ~ .8*X")
# Print all paths
MICTable(XYZmodel, print="all")

# Print only sign, scale, and exist as separate tables:
MICTable(XYZmodel, print="all")

# Print only the nonzero influences of X:
MICTable(XYZmodel, from="X")

trbrick/MICr documentation built on March 7, 2020, 3:30 p.m.