Computes accuracy, sensitivity, specificity and precision from a true and an estimated adjacency matrix.
p x p adjacenty matrix of the true graph
p x p adjacenty matrix of the estimated graph
A list containing accuracy, sensitivity, specificity and precision of the estimated graph in reference to the true graph.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#create some data from a mixed graphical model n <- 100 # number of samples type <- c("g", "c", "c") # one gaussian, two categorical lev <- c(1,3, 2) # the categorical variable have 3 and 2 categories, respectively graph <- matrix(0,3,3) graph[1,2] <- graph[2,1] <- .5 # we have an edge with weight .5 between node 1 and 2 thresh <- list(c(0), c(0,0,0), c(0,0)) # all thresholds are zero (for the categorical variables each categoriy has a threshold) data <- mMRFsampler(n, type, lev, graph, thresh, parmatrix=NA, nIter=1000) #fit a mixed graphical model fit <- mMRFfit(data, type, lev=lev, d=2) grapht <- graph grapht[grapht!=0] <- 1 #binarize true graph confusion(grapht, fit$adj) #compute derivatives of confusion matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.