Learn R Programming

BDgraph (version 2.3)

plotConvergency: Cumulative occupancy fractions for checking the convergency

Description

Plot the cumulative occupancy fractions for all possible edges. It is a tool for checking the convergency of the BDMCMC algorithm.

Usage

plotConvergency(output, skip = ceiling(length(output$allA) / 2000), verbose = TRUE)

Arguments

output
a list which is the result of BDMCMC algorithm from the 'bdmcmc', 'bdmcmc.low', or 'bdmcmc.high' functions.
skip
it is a option for getting fast result for a cumulative plot according to part of the iterations.
verbose
logical: if verbose = TRUE, tracing information printing is abled. The default value is TRUE.

Details

Note that a spending time for this function depences on the graph. It should be slow for the high-dimensional graphs. To make it faster you can choose bigger value for 'skip', as you can see in following example.

References

Mohammadi, A. and E. C. Wit (2012). Gaussian graphical model determination based on birth-death MCMC inference, arXiv:1210.5371v4. http://arxiv.org/abs/1210.5371v4

See Also

bdmcmc.low

Examples

Run this code
p <- 8 # number of nodes 
  # "truK" is the precision matrix of true graph
  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
  truK # precision matrix of the true graph
  
  # generate the data (200 observations) from multivariate normal 
  # distribution with mean zero and percision matrix "truK"
  data <- mvrnorm(200, c(rep(0,p)), solve(truK))  
  output <- bdmcmc(data, meanzero = T, iter = 2000, all.A = TRUE)
  
  # we run it for skip = 5. For skip = 1, it takes more time.
  plotConvergency(output, skip = 5)

Run the code above in your browser using DataLab