knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(MICr)
library(lavaan)
library(knitr)  # for kable.

In this vignette, we lay out a very simplified mediation model as a means of understanding what the MIC does.

XYZmodel <- lavaan("Y ~ .2*X +.6*Z
                    Z ~ .8*X")

The model's MIC looks like this:

kable(MIC(XYZmodel), caption="Simple Mediation MIC")

Note that Z->Y and X->Z remain identical, since there is only one path present to follow each link. However, X->Y is two paths: one direct and one indirect. The MIC path between them is the combination of the two. Also, because lavaan orders the manifest variables as Y, X, Z, the MIC does as well.

For ease of reporting, this can also be displayed as a MIC table.

MICTable(XYZmodel, caption="Simple Mediation MIC Table")

The table format has the easy ability to select using traditional data frame selection operators, but the MICTable function also has helpers. For example, if we only care about the causal influences on Z or on Y:

MICTable(XYZmodel, caption="Simple Mediation MIC Table: Effects on Y", to="Y")
MICTable(XYZmodel, caption="Simple Mediation MIC Table: Effects on Z", to="Z")

This allows us to identify the differences in the causal structure in a more direct and sensible way.



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