Learn R Programming

interventionalDBN (version 1.2.2)

interventionalInference: Dynamic Bayesian Network inference with interventions.

Description

This function performs exact Bayesian inference for dynamic Bayesian networks using microarray timecourse data. Several intervention models can be chosen to take into account the effect of inhibitors.

Usage

interventionalInference(y, X0, X1, Z, max.indeg, g = NULL, Sigma = NULL, inferParents = NULL, allowSelfEdges = TRUE, perfectOut = FALSE, fixedEffectOut = FALSE, mechanismChangeOut = FALSE, perfectIn = FALSE, fixedEffectIn = FALSE, mechanismChangeIn = FALSE, priorType = "uninformed", priorGraph = NULL, priorStrength = 3, fittedValues = FALSE)

Arguments

y
an $n$ by $P$ matrix filled with the response values, where $n$ is the number of observations and $P$ is the number of nodes.
X0
an $n$ by $a$ matrix - the part of the design matrix that is the same for all models. $a$ is the number of parameters that are in all of the modesl.
X1
an $n$ by $P$ matrix - the part of the design matrix to undergo model selection. colnames(X1) provides the labels for the output.
Z
an $n$ by $P$ binary matrix. Entry $i,j$ is one if node $j$ is inhibited in sample $i$.
max.indeg
The maximum permitted in-degree for each node.
g
The constant $g$ in Zellner's g-prior. Defaults to $n$.
Sigma
an $n$ by $n$ covariance matrix of the responses, divided by $\sigma^2$. Faster if not specified, in which case the identity matrix is assumed.
inferParents
a vector of node indices specifying which nodes to infer parents for. If omitted, parents are inferred for all nodes.
allowSelfEdges
Should self-edges be allowed?
perfectOut
Apply perfect-out interventions?
fixedEffectOut
Apply fixed-effect-out interventions?
mechanismChangeOut
Apply mechanism-change-out interventions? Note: cannot be applied with perfect interventions.
perfectIn
Apply perfect-in interventions?
fixedEffectIn
Apply fixed-effect-in interventions?
mechanismChangeIn
Apply mechanism-change-in interventions? Note: cannot be applied with perfect interventions.
priorType
One of "uninformed", "Mukherjee" and "Hamming". In the structural Hamming distance prior, each difference from the edges in priorGraph incurs a prior penalty of exp(-priorStrength). In the Mukherjee-Speed prior, adding edges from outside priorGraph earns the same penalty as before, but if a prior edge is omitted a penalty is no longer incurred.
priorGraph
A $P$ by $P$ binary matrix specifying the prior graph. If $(i,j)=1$ then node $i$ influences node $j$. If omitted, an uninformed prior is used.
priorStrength
The prior strength parameter. Ignored (but don't set it to NA) if priorGraph is NULL. If specified as a vector then the value from that gives the highest marginal likelihood is chosen (Empirical Bayes).
fittedValues
Perform a second pass to calculate the fitted values?

Value

pep
A $P$ by $P$ matrix of posterior probabilities, where element $(i,j)$ gives the posterior probability that node $i$ influences node $j$.
MAP
A $P$ by $P$ binary matrix giving the maximum a posteriori network.
parentSets
A countGraphs(P,max.indeg) by $P$ binary matrix, where element $(m,p$=1) iff node $i$ is a parent in model $m$.
ll
A countGraphs(P,max.indeg) by $P$ matrix, where element $(m,p)$ gives the log-likelihood for model $m$ for node $p$.
lpost
A countGraphs(P,max.indeg) by $P$ matrix, where element $(m,p)$ gives the log-posterior probability for model $m$ for node $p$.
MAPprob
A $P$ vector where element $p$ gives the posterior probability of the maximum a posteriori model for node $p$.
MAPmodel
A $P$ vector where element $p$ gives the index of the maximum a posterior model for node $p$ (between 1 and countGraphs(P,max.indeg).
marginal.likelihood
A $P$ by length(priorStrength) matrix that gives the marginal likelihood for each node.
ebPriorStrength
Value of priorStrength with the largest marginal likelihood, if priorStrength is a vector; NULL otherwise.
yhat
The posterior expected fitted values, if fittedValues is TRUE.
inputs
A list containing the inputs to interventionalInference

Details

This function performs interventional inference with both -in and -out forms of the interventions. The targets of the interventions are specified in the matrix Z. This assumes that each node is the target of only one intervention - if this is not the case, you must use the interventionalInferenceAdvanced function. Certain combinations of interventions do not work together, in particular mixtures of perfect and mechanism change interventions. Perfect-in and perfect-out can be used together. Mechanism-change-in and mechanism-change-out could potentially be used together, but are not currently implemented.

References

Spencer, S.E.F, Hill, S.M. and Mukherjee, S. (2012) Dynamic Bayesian networks for interventional data. CRiSM pre-print 12-24. Mukherjee, S. and Speed, T.P. Network inference using informative priors. Proc. Nat. Acad. Sci. USA, 105, 14313-14318.

See Also

interventionalDBN-package, formatData

Examples

Run this code
library(interventionalDBN)
data(interventionalData)# loads interventionalData.
# Load your own data spreadsheet using myData<-read.csv("myDataFile.csv").

# Format the data for network inference
d<-formatData(interventionalData)

# Perform network inference without modelling interventions.
myNetwork0<-interventionalInference(d$y,d$X0,d$X1,max.indeg=3,fittedValues=TRUE)

# EGFRi is active in conditions 2 and 4, AKTi is active in conditions 3 and 4.
# Each condition has 8 timepoints.
Z<-matrix(0,32,15)
Z[9:16,1]<-1 # EGFR (node 1) is inhibited in condition 2
Z[25:32,1]<-1 # EGFR (node 1) is inhibited in condition 4
Z[17:24,8]<-1 # AKT (node 8) is inhibited in condition 3
Z[25:32,8]<-1 # AKT (node 8) is inhibited in condition 4

# Perform network inference with perfect-out and fixed-effect-out interventions.
myNetwork1<-interventionalInference(d$y,d$X0,d$X1,Z,max.indeg=3,
  perfectOut=TRUE,fixedEffectOut=TRUE)

# Perform network inference on with mechanism-change-out interventions.
myNetwork2<-interventionalInference(d$y,d$X0,d$X1,Z,max.indeg=3,
  mechanismChangeOut=TRUE)

# Perform network inference with Mukherjee Prior that prefers to omit self-edges.
myNetwork3<-interventionalInference(d$y,d$X0,d$X1,Z,max.indeg=3,
  perfectOut=TRUE,fixedEffectOut=TRUE,
  priorType="Mukherjee",priorGraph=matrix(1,15,15)-diag(rep(1,15)),priorStrength=2)
# Compare with self-edge peps with myNetwork1
diag(myNetwork1$pep)-diag(myNetwork3$pep)

# Perform network inference with Hamming Prior that prefers self-edges,
# and use Empirical Bayes to choose the priorStrength.
myNetwork4<-interventionalInference(d$y,d$X0,d$X1,Z,max.indeg=3,
  perfectOut=TRUE,fixedEffectOut=TRUE,
  priorType="Hamming",priorGraph=diag(rep(1,15)),priorStrength=0:10/2)
# You should always check to see if the Empirical Bayes appears to be working.
plotMaxML(myNetwork4)

# Now let's try using using the gradients as the response.
# Note that we have to tranfser Sigma this time, as it is no longer the identity.
d<-formatData(interventionalData,gradients=TRUE,initialIntercept=FALSE)
# There are now only 28 observations
Z<-Z[c(2:8,10:16,18:24,26:32),]

# Perform network inference on gradients with perfect-in interventions.
myNetwork5<-interventionalInference(d$y,d$X0,d$X1,Z,max.indeg=3,
  Sigma=d$Sigma,perfectIn=TRUE,fittedValues=TRUE)
  
# Perform network inference on gradients with perfect-in and -out plus fixed-effect out.
myNetwork6<-interventionalInference(d$y,d$X0,d$X1,Z,max.indeg=3,
  Sigma=d$Sigma,perfectIn=TRUE,perfectOut=TRUE)

Run the code above in your browser using DataLab