lasso {inet}R Documentation

Estimate GGM with nodewise regression and the lasso.

Description

Estimate a Gaussian Graphical Model with lasso-regularized nodewise regression, where the regularization parameter is selected with cross-validation. This is a wrapper around the function cv.glmnet() from the glmnet package.

Usage

lasso(data, pbar = TRUE, nfolds = 10, rulereg = "and")

Arguments

data

An n x p matrix containing the data, where n are cases and p are variables

pbar

If pbar = TRUE, a progress bar will be displayed.

nfolds

Specifies the number of folds used to select the regularization parameter in each of the p nodewise regressions.

rulereg

Specifies how parameter estimates should be combined across nodewise regressions. The options are the AND-rule (requiring both estimates to be significant) or the OR-rule (only requiring one estimate to be significant). Defaults to rulereg = "and".

Value

The function returns a list with the following entries:

est

A p x p matrix with point estimates for all partial correlations

select

A p x p indicator matrix indicating which edges have been selected to be present.

ints

A p-vector of estimated intercepts.

Author(s)

Jonas Haslbeck <jonashaslbeck@gmail.com>

References

Friedman, J., Hastie, T., & Tibshirani, R. (2010). Regularization paths for generalized linear models via coordinate descent. Journal of statistical software, 33(1), 1.

Examples


# Toy example that runs relatively quickly
library(MASS)
p <- 5 # number of variables
data <- mvrnorm(n=100, mu=rep(0, p), Sigma = diag(p))
set.seed(1)
out <- lasso(data = data)

## Not run: 

# Fit GGM to PTSD data
set.seed(1)
out <- lasso(data = ptsd_data)


## End(Not run)


[Package inet version 0.1.0 Index]