A brief introduction to mgm
mgm is an R-package that implements the estimation of Mixed Graphical Models (MGMs) on repeated measurements from a multivariate system. MGMs are exponential family distributions and generalize well-known distributions such as the multivariate Gaussian distribution (all variables real-valued) or the Ising model (all variables binary-values) to the case of mixed variables.
This is useful, because measurements of a given system are often defined on different domains. For example, when tracking a patient in psychiatric research, measurements could be continuous such as the severity of symptoms (e.g. feeling irritated from 0 to 10, where 0 is not irritated at all, and 10 is extremely irritated). A measurement could also be categorical such as the type of social interaction (mother, colleagues, partner). Yet another type of variable would be the number of times a behavior is exhibited in a given time interval (washes hands 7 times in 1 hour).
In the following example, you will estimate an MGM based on data obtained from an ecological momentary assessment study (EMA) that followed a patient diagnosed with major depression over the course of 238 consecutive days. This example builds on an earlier study where the auto and cross-correlations in this dataset were studied over time to determine whether a Critical Slowing Down in the patient system state could provide an Early Warning Signal for the onset of a depressive episode.
The example uses a subset of variables from this study related to the mood of the patient (continuous variables), the type of activity he performed and the social interactions he was engaged in (both categorical). in the example, you will interpret the parameters of the estimated MGM and show how to communicate them using network visualizations. In addition, you will learn how the estimated MGM could be used to select an appropriate treatment for that patient.
Materials for working example