Learn R Programming

BDgraph (version 1.0)

BDMCMC.low: BDMCMC algorithm for low-dimensional graphs

Description

This function is the BDMCMC algorithm for model selection in Gussian grohical models based on birth-death MCMC methodology. The algorithm is quitly slow, so it is suitable only for low-dimensional problems (graphical models with less than 8 nodes).

Usage

BDMCMC.low(S, n = NULL, iter = 5000, burn = 2000, distance = 1, lambda_b = 1, b = 3, D = NULL, A = NULL, MC.iter = 10)

Arguments

S
It could be our data (matrix p*n) or it could be matrix S=x'x that x is our data.
n
Number of observations
iter
Number of iterations for BDMCMC algorithm, default is 5000
burn
Number of iterations as burn-in, default is 2000
distance
"distance" is the option for regularly saving part of the iterations. Default is 1 (for saving all the iterations).
lambda_b
Birth rates for brith-death process, default is 1
b
Value for prior distribution of precision matrix, default is 3
D
Positive definite matrix for prior distribution of precision matrix, default is identity matrix
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
MC.iter
Number of iterations for Monte Carlo approximation of normalizing constant, default is 10

Value

  • A list with components "Asample", "Ksample", "lambda.s" and "allA", each one with components:
  • AsampleA list which includes the adjacency matrix for all iterations after burn_in iterations
  • KsampleA list which includes the precision matrix for all iterations after burn_in iterations
  • lambda_sA vector which includes the waiting times for all iterations after burn_in iterations
  • allAA list which includes all adjacency matrix for all iterations include burn_in iterations to check the conversgency 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, BDMCMC.high and Phat.

Examples

Run this code
n=100; p=5
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.low)
  output <- output.low
output = BDMCMC.low(data)
# Posterior probability for all possible links in the graph
round(Phat(output),2)

Run the code above in your browser using DataLab