MInt is a package for learning direct interaction networks. It implements a Poisson-multivariate normal hierarchical model, which models covariates at the Poisson layer and accounts for direct interactions at the multivariate normal layer using an L1 penalized precision matrix.
The basic workflow for MInt includes creating a MInt model object with a design matrix and response matrix and then using this object to estimate the parameters of the Poisson-multivariate normal hierarchical model.
As an example, consider the example data located in the data
directory of this package. The files y.txt
and x.txt
contain a sample response matrix and design matrix, respectively. We’d like to use MInt to find evidence of direct interactions between the variables in the response after controlling for the covariates in the design matrix.
We begin by loading the MInt package and creating a MInt model object:
rm(list = ls()) # Clear workspace
library(MInt)
# Specify path to the design matrix
dFile <- system.file("extdata", "x.txt", package="MInt");
# Specify path to the response matrix
rFile <- system.file("extdata", "y.txt", package="MInt");
# Create the MInt model object
m <- mint(y=rFile, x=dFile, fmla = ~ feature1 + feature2)
The fmla
argument specifies that feature1
and feature2
of the design matrix additively influence each response variable. However, other specifications are possible depeneding on your data. If, for example, you believe there may be an interaction between feature1
and feature2
, you may consider passing fmla = ~ feature1 + feature2 + feature1*feature2
. In general, you can specify any formula you like, just as you could to any R function that accepts formula objects (e.g. glm
).
To estimate parameters of the model, we simply call:
m <- estimate(m)
## Iteration: 1 max(deltaP): 0.067014 Objective: -1061.913 Converged: FALSE
## Iteration: 2 max(deltaP): 0.015160 Objective: -1061.823 Converged: FALSE
## Iteration: 3 max(deltaP): 0.003953 Objective: -1061.813 Converged: FALSE
## Iteration: 4 max(deltaP): 0.001160 Objective: -1061.806 Converged: FALSE
## Iteration: 5 max(deltaP): 0.000396 Objective: -1061.8 Converged: FALSE
## Iteration: 6 max(deltaP): 0.000181 Objective: -1061.793 Converged: FALSE
## Iteration: 7 max(deltaP): 0.000122 Objective: -1061.787 Converged: FALSE
## Iteration: 8 max(deltaP): 0.000114 Objective: -1061.78 Converged: FALSE
## Iteration: 9 max(deltaP): 0.000111 Objective: -1061.774 Converged: FALSE
## Iteration: 10 max(deltaP): 0.000109 Objective: -1061.767 Converged: FALSE
## Iteration: 11 max(deltaP): 0.000108 Objective: -1061.761 Converged: FALSE
## Iteration: 12 max(deltaP): 0.000107 Objective: -1061.755 Converged: FALSE
## Iteration: 13 max(deltaP): 0.000106 Objective: -1061.749 Converged: FALSE
## Iteration: 14 max(deltaP): 0.000105 Objective: -1061.743 Converged: FALSE
## Iteration: 15 max(deltaP): 0.000104 Objective: -1061.737 Converged: FALSE
## Iteration: 16 max(deltaP): 0.000103 Objective: -1061.731 Converged: FALSE
## Iteration: 17 max(deltaP): 0.000102 Objective: -1061.725 Converged: FALSE
## Iteration: 18 max(deltaP): 0.000101 Objective: -1061.719 Converged: FALSE
## Iteration: 19 max(deltaP): 0.000100 Objective: -1061.713 Converged: TRUE
This will read in the data from the supplied file paths for the response and design matrix, initialize the optimizer, and perform inference. The MInt model object, m
, has now been updated to include the raw data, optimization details, and parameter estimates. The estimated precision matrix is given by m$param$P
. The corresponding partial correlation matrix is given by -cov2cor(m$param$P)
. A non-zero value in entry (i,j)
of these matrices is indicative of a direct interaction, whereas a zero value suggests variables i
and j
do not directly interact.
Let’s see how the estimated partial correlation matrix compares to the true one:
P_true <- as.matrix( read.csv(system.file("extdata", "P_true.txt", package="MInt"), header=FALSE) );
-cov2cor(P_true)
## V1 V2 V3
## [1,] -1.0 -0.8 0.0
## [2,] -0.8 -1.0 0.4
## [3,] 0.0 0.4 -1.0
-cov2cor(m$param$P)
## y1 y2 y3
## y1 -1.00000000 -0.7718095 0.08642571
## y2 -0.77189686 -1.0000000 0.48359664
## y3 0.08651228 0.4836316 -1.00000000
This package is maintained by Surojit Biswas: surojitbiswas@g.harvard.edu