Learn R Programming

BDgraph (version 2.7)

compare: Comparing the result

Description

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

Usage

compare(true, estimate, estimate2 = NULL, colnames = NULL, vis = FALSE)

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.
vis
logical: if TRUE you will see the plot result. The default is FALSE.

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
# generating the data from a random graph
  data.sim <- bdgraph.sim(n = 100, p = 8, size = 9, vis = TRUE)
  
  # selecting the best graph according to BD-MCMC algorithm
  output <- bdgraph(data.sim, mean = 0, iter = 5000)
  # comparing the result
  compare(data.sim, output, colnames = c("true", "BDgraph"), vis = TRUE)

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

Run the code above in your browser using DataLab