Learn R Programming

BDgraph (version 1.0)

prob.graph: Posterior probability of the graph

Description

According to the output of BDMCMC algorithm, this function gives us the posterior probability of the graphical models.

Usage

prob.graph(A, output)

Arguments

A
Upper truculer matrix which shows the starting graphs in which a_ij=1 if there is a link between notes i and j, otherwise a_ij=0
output
A list which is the result of BDMCMC algorithm

References

Mohammadi, A. and E. Wit (2012). Efficient birth-death MCMC inference for Gaussian graphical models, Journal of the Royal Statistical Society: Series B, submitted.

See Also

BDMCMC

Examples

Run this code
n=200; p=8
truK=diag(p)
for (i in 1:(p-1)) truK[i,i+1]=truK[i+1,i]=0.5
truK[1,p]=truK[p,1]=0.4
data=mvrnorm(n,c(rep(0,p)),solve(truK))
data(output.high)
  output <- output.high
output = BDMCMC(data)
A=0*truK
for (i in 1:(p-1)){
    for (j in (i+1):p){
       if (truK[i,j]!=0) {A[i,j]=1}
       }
    }
A[1,p]=1
prob.graph(A, output)

Run the code above in your browser using DataLab