| NetworkMotif | R Documentation |
NetworkMotif quantifies the uncertainty of a given network structure among the response
variables: it returns the proportion of posterior draws in which every edge of the motif is present,
that is, the posterior probability that all edges of the motif are present simultaneously. The input
draws are the GammaPst output of RGM.
NetworkMotif(Gamma, GammaPst)
Gamma |
A p * p binary matrix (numeric 0/1 or logical) with a zero diagonal, specifying the motif: |
GammaPst |
A p * p * n_pst array of posterior draws of the causal edge indicators, the |
A number between 0 and 1: the proportion of posterior draws that contain all edges of Gamma.
Ni, Y., Ji, Y., & Müller, P. (2018). Reciprocal graphical models for integrative gene regulatory network analysis. Bayesian Analysis, 13(4), 1095-1110. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/17-BA1087")}.
# Simulate a cascade Y1 -> Y2 -> Y3 with two own instruments per response
set.seed(9154)
n = 2000; p = 3; k = 6
A = matrix(0, p, p); A[2, 1] = 0.3; A[3, 2] = -0.3 # A[i, j]: effect of Y_j on Y_i
D = matrix(0, p, k)
for (i in 1:p) D[i, (2 * i - 1):(2 * i)] = 1
X = matrix(rnorm(n * k), n, k)
Y = (X %*% t(D) + matrix(rnorm(n * p), n, p)) %*% t(solve(diag(p) - A))
X = scale(X); Y = scale(Y) # the model has no intercept
# Fit MR.RGM (a short chain to keep the example fast; the defaults are the recommended length)
fit = RGM(X = X, Y = Y, D = D, nIter = 2000, nBurnin = 1000, Thin = 2)
# Posterior probability of the cascade Y1 -> Y2 -> Y3 (both edges present)
Gamma = matrix(0, p, p); Gamma[2, 1] = 1; Gamma[3, 2] = 1
NetworkMotif(Gamma = Gamma, GammaPst = fit$GammaPst)
# Posterior probability of the feedback loop Y1 -> Y2 -> Y3 -> Y1
Gamma[1, 3] = 1
NetworkMotif(Gamma = Gamma, GammaPst = fit$GammaPst)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.