MGM Mixed Graphical Models

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).

Working example

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

PowerPoint Slides Introduction     PowerPoint Slides Practical     RMarkdown Code     RMarkdown HTML   

Network visualization of the parameters of the MGM estimated on the above-mentioned symptom time-series.

Variables 1-12 are continuous measures of symptom severity; variables 13 and 14 are categorical variables capturing the type of social interaction and behavior during the last time-interval, respectively. The width of an edge is proportional to the strength of the dependency. Green edges indicate positive relationships, red edges indicate negative relationships. Grey edges indicate that no sign is defined because the edge maps to more than one parameter. This is the case for interactions involving categorical variables.

Important to Note

  • Install R and RStudio
  • Install the development version of mgm like this:
    • library(devtools)
    • install_github(“jmbh/mgm”)
    • library(mgm)
  • Install the qgraph package like this:
    • install.packages(“qgraph”)

Futher analysis

The mgm package also implements the estimation of models that are not discussed in this CLUe training. Information on all implemented models can be found in this preprint.

Questions? Contact Jonas Haslbeck