Estimating Time-Varying k-Order Mixed Graphical Models

Estimation of k-Order time-varying Mixed Graphical Models and mixed VAR(p) models via elastic-net regularized neighborhood regression. For details see Haslbeck & Waldorp (2020) .

Functions to estimate both stationary and time-varying k-order Mixed Graphical Models or mixed Vector Autoregressive (mVAR) models.

The developmental version can be installed using the devtools-package:




Changes in Version 1.2-5 o Bug fix in resample() o Improved input checks in mgmsampler() o Bug fix in prediction with mvar() objects o Allow for prediction with time-varying models in new data sets

Changes in Version 1.2-4 o Updated help files o Added two example data sets for higher-order (moderated) MGMs

Changes in Version 1.2-3 o Bug fix in bwSelect() o Added verbatim option in resample() to detect zero variance bootstrap samples o Fixed warning due to R 3.4.0: "Recycling array of length 1 in vector-array arithmetic is deprecatd.Use c() or as.vector() instead." o Bug fix: resampling did not work together with new mvar() arguments dayvar/beepvar since Version 1.2-2 o Added argument "moderators" to the mgm() function that allows to ... o Change default: in earlier versions if overparameterize=TRUE, all thresholds (intercepts) of categorical variables were set to zero. From this version on this threshold is estimated. The thresholds of categoricals can still be set to zero with the new argument "thresholdCat" o If scale=TRUE, now interaction terms (k>2 or moderation) are scaled after computing the design matrix to ensure that all predictors have the same mean and standard deviation, which avoids different penalization depending on the scaling of a predictor o Add CES-D depression dataset taken from Fried et al. (2015) to example datasets o Added function FactorGraph() that computes and plots a factor graph from stationary or time-varying MGMs. The factorgraph output has been removed from the mgm() and tvmgm() functions. o Added support of showInteraction() to continuous 3-way interactions o For all time-varying models the estimation points are now specified on the unit interval [0,1]; for tvmvar() models, 0 is associated with the first data point that is not trivially excluded due to the maximum lag

Changes in Version 1.2-2 o Add running time to output of resample() function o Added a note and references on the normalizability of MGMs o Added function plotRes() to plot summaries of sampling distributions resampled with the resample() function o The consecutiveness of measurements in mvar() and tvmvar() models now can be specified alternatively to the consec argument with the arguments beepvar and dayvar. This is tailored to the typical time stamps of ecological momentary assessment (EMA) studies, where the consecutiveness is defined by the number of notification on a given day (beepvar) and the number of that given day (dayvar). o New function showInteraction() retrieves details of interactions from mgm model objects o The print method now also shows number of rows in the VAR design matrix compared to the number of rows of the original data matrix. o All estimation functions require a matrix object as data input to avoid problems with properties of data.frame objects o Corrected row-order in dataset "symptom_data"
o In mVAR models we use an adjusted sample size that is equal to the number of rows in the design matrix. The adjusted sample size can be smaller than nrow(data) - max(lags) if measurements are not consecutive, or if non-uniform weighting is used. In earlier versions the sample size was only adjusted for non-uniform weighting. The adjusted sample size is used in the additional thresholding of parameter estimates (see ?mgm or ?mvar). o Added function resample() that fits any model class to a specified number of bootstrap samples and provides the bootstrapped sampling distribution in an array. For time series data, the block bootstrap is used, where the number of blocks can be specified.

Changes in Version 1.2-1 o Added consec argument to predict.mgm(), which allows prediction for VAR models in time series with unequal time intervals by excluding time points that are not preceded by enough measurements (see ?mvar)

Changes in Version 1.2-0 o The whole package has been rewritten from scratch to reduce susceptibility to bugs and to allow new features o Every function now has many input checks and associated informative error messages o Major syntax changes: mgmfit() -> mgm(), var.mgm() -> mvar(), tv.mgmfit() -> tvmgm() and tv_var.mgm() -> tvmvar() o The names of function arguments are now consistent across the package and therefore had to be changed considerably o There is no more missing argument in the estimation functions o All estimation functions allow to search a sequence of the (alpha) elastic net paramter, using the EBIC or cross-validation; so far alpha was fixed to 1 o mgm() and tvmgm() now presents all paramters involved in higher (than pairwise) order interactions in the output; this includes a factor-graph representation that is easy to visualize o The d parameter for the largest order of interaction in the neighborhood of a given node has been replaced with the k parameter, the largest order of interaction in the whole graph. Note that d = k - 1 o All estimation functions allow the standard parameterization for categorical variables, but also an overparameterization. This is necessary to correctly identify higher order interactions between categorical variables. o The sampling functions mgmsampler() and tvmgmsampler() were extended to k-order MGMs (before only pairwise / k = 2) o mvar() and tvmvar() now allow the specification of any number of lags o The new functions mvarsampler() and tvmvarsampler() now allow to sample from mVAR models any number of lags o There is no more function provided for resampling. Instead, we provide an interface with the bootnet package. o The function bwSelect() allows the selection of an optimal bandwidth parameter for timer-varying MGM or mVAR models using cross-validation o predict.mgm() now allows two different ways to predict from time-varying models, see ?predict.mgm o Fixed bug in mgmsampler() that was present in binary-Gaussian graphs o Fixed bug in predict.mgm() which caused the prediction of incorrect category labels in some situations o Fixed bug in mgm() which did not use the weight-argument in case of lambdaSel = 'CV' o Default for argument lambdaSel changed from 'EBIC' to 'CV'

Changes in Version 1.1-7 o The predict() function now returns the predicted probabilities in addition to the predicted category for categorical variables o Added a message for all estimation functions indicating where edge weights (if defined) can be found: fitobject$signs o Added a startup message with a link to report bugs o The predict() function now computes predicted values and a prediction error for each variable in the graph o The print() function now returns a small summary of the model type when printing a mgm object o Added subsampling scheme to evaluate edge-stability for non-time-varying models (MGM and mixed VAR) o Added summary() & plot() for the bootstrap object to summarize edge-stability o Added argument 'binary.sign': If binary.sign=TRUE, the sign of the interactions of all binary variables coded (0,1) with other binary variables and continuous variables will be returned in the sign matrix fit$signs

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.2-12 by Jonas Haslbeck, 4 months ago

Report a bug at

Browse source code at

Authors: Jonas Haslbeck

Documentation:   PDF Manual  

Task views: Time Series Analysis, gRaphical Models in R, Psychometric Models and Methods

GPL (>= 2) license

Imports glmnet, stringr, Hmisc, qgraph, gtools

Suggests testthat

Imported by bootnet, mDAG.

See at CRAN