# confusion: Confusion matrix In jmbh/mMRF: Estimating mixed Markov random fields

## Description

Computes accuracy, sensitivity, specificity and precision from a true and an estimated adjacency matrix.

## Usage

 `1` ```confusion(tg, eg) ```

## Arguments

 `tg` p x p adjacenty matrix of the true graph `eg` p x p adjacenty matrix of the estimated graph

## Value

A list containing accuracy, sensitivity, specificity and precision of the estimated graph in reference to the true graph.

Jonas Haslbeck

## Examples

 ``` 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 ```

jmbh/mMRF documentation built on May 18, 2017, 2:30 a.m.