interventionalInference: Dynamic Bayesian Network inference with interventions.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/interventionalInference.R

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

1
2
3
4
5
6
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 σ^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?

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.

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

Author(s)

Simon Spencer

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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)

Example output

n = 32 
4 conditions:
  Cell line 1 : 32 samples.
  Inhibitor DMSO : 8 samples.
  Inhibitor EGFRi : 8 samples.
  Inhibitor AKTi : 8 samples.
  Inhibitor EGFRi+AKTi : 8 samples.
  Stimulus EGF : 32 samples.
  Time 0 : 4 samples.
  Time 1 : 4 samples.
  Time 2 : 4 samples.
  Time 3 : 4 samples.
  Time 4 : 4 samples.
  Time 5 : 4 samples.
  Time 6 : 4 samples.
  Time 7 : 4 samples.
n = 32 , nodes = 15 
a = 2 
Processing 576 models Thu Feb 15 19:00:21 2018 
Estimated duration 0.006641853 minutes.
Actual duration 0.00287329 minutes.
Renormalising...
Calculating posterior edge probabilities...
Second pass to calculate fitted values.
Processing 576 models Thu Feb 15 19:00:21 2018 
Estimated duration 0.001730164 minutes.
Actual duration 0.001817445 minutes.
There were 30 warnings (use warnings() to see them)
n = 32 , nodes = 15 
a = 2 
Processing 576 models Thu Feb 15 19:00:22 2018 
Estimated duration 0.002505203 minutes.
Actual duration 0.002237006 minutes.
Renormalising...
Calculating posterior edge probabilities...
n = 32 , nodes = 15 
a = 2 
Processing 576 models Thu Feb 15 19:00:22 2018 
Estimated duration 0.002322327 minutes.
Actual duration 0.00212299 minutes.
Renormalising...
Calculating posterior edge probabilities...
n = 32 , nodes = 15 
a = 2 
Calculating Mukherjee prior distances...
Processing 576 models Thu Feb 15 19:00:22 2018 
Estimated duration 0.002428505 minutes.
Actual duration 0.00226171 minutes.
Renormalising...
Calculating posterior edge probabilities...
        EGFR          SRC        STAT5          Mek         MAPK       p90RSK 
0.0046655008 0.0321807546 0.0193949190 0.4521366353 0.1640169488 0.3428126799 
         PDK          AKT          GSK         TSC2          BAD         mTOR 
0.0299131972 0.0002571015 0.0264121878 0.0419788332 0.0244489213 0.0214989373 
      p70S6K           S6        FOXO3 
0.0137144364 0.0287549737 0.0165578318 
n = 32 , nodes = 15 
a = 2 
Calculating Hamming prior distances...
Processing 576 models Thu Feb 15 19:00:22 2018 
Estimated duration 0.002620583 minutes.
Actual duration 0.002297449 minutes.
Renormalising...
Calculating posterior edge probabilities...
n = 28 
4 conditions:
  Cell line 1 : 28 samples.
  Inhibitor DMSO : 7 samples.
  Inhibitor EGFRi : 7 samples.
  Inhibitor AKTi : 7 samples.
  Inhibitor EGFRi+AKTi : 7 samples.
  Stimulus EGF : 28 samples.
  Time 1 : 4 samples.
  Time 2 : 4 samples.
  Time 3 : 4 samples.
  Time 4 : 4 samples.
  Time 5 : 4 samples.
  Time 6 : 4 samples.
  Time 7 : 4 samples.
n = 28 , nodes = 15 
a = 1 
Processing 576 models Thu Feb 15 19:00:22 2018 
Estimated duration 0.005882149 minutes.
Actual duration 0.00575312 minutes.
Renormalising...
Calculating posterior edge probabilities...
Second pass to calculate fitted values.
Processing 576 models Thu Feb 15 19:00:23 2018 
Estimated duration 0.005549492 minutes.
Actual duration 0.005937044 minutes.
n = 28 , nodes = 15 
a = 1 
Processing 576 models Thu Feb 15 19:00:23 2018 
Estimated duration 0.007381874 minutes.
Actual duration 0.006840448 minutes.
Renormalising...
Calculating posterior edge probabilities...

interventionalDBN documentation built on May 30, 2017, 8:24 a.m.