Learn R Programming

BDgraph (version 2.6)

compare: Comparing the results according to the true graph

Description

With this function we can compare the result from BD-MCMC algorithm or other approches, according to the true graph structure.

Usage

compare(true, estimate, estimate2 = NULL, colnames = NULL, plot = TRUE)

Arguments

true
adjacency matrix for the true graph in which $true_{ij}=1$ if there is a link between notes $i$ and $j$, otherwise $true_{ij}=0$.
estimate
adjacency matrix for estimated graph.
estimate2
adjacency matrix for second estimated graph.
colnames
a character vector giving the column names for the result table.
plot
logical: if TRUE (default) you will see the plot result.

Value

  • true positivethe number of correctly estimated links.
  • true negativethe number of true non-existing links which is correctly estimated.
  • false positivethe number of links which they are not in the true graph, but are incorrectly estimated.
  • false negativethe number of links which they are in the true graph, but are not estimated.
  • accuracythe number of true results (both true positives and true negatives) divided by the total number of true and false results.
  • balanced F-scorea weighted average of the "positive predictive" and "true positive rate". F-score value reaches its best value at 1 and worst score at 0.
  • positive predictivethe number of correctly estimated links divided by the total number of links in the estimated graph.
  • true positive ratethe number of correctly estimated links divided by the total number of links in the true graph.
  • false positive ratethe false positive value divided by the total number of links in the true graph.

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

bdgraph and select

Examples

Run this code
# generate the data from multivariate normal distribution
  data.sim <- bdgraph.sim(n = 100, p = 8, size = 9, vis = T)
  
  # selecting the best graph according to BD-MCMC algorithm
  output <- bdgraph(data.sim, meanzero = T, iter = 5000)
  compare(data.sim, output, colnames = c("true graph", "BDgraph"))

  # selecting the best graph by huge package
  huge.g <- huge(data.sim $ data, method = "mb")
  huge.g <- huge.select(huge.g)    
  
  # comparing the result by using "compare" function
  compare(data.sim, output, estimate2 = huge.g $ refit, colnames = c("true graph", "BDgraph", "huge"))

Run the code above in your browser using DataLab