Learn R Programming

dst (version 1.8.0)

belplauEval: Evaluate A, B errors

Description

Calculate error A, B, and total error A+B by comparing two vectors as defined below. One vector represents the truth and the other represents a numerical quantity of importance.

  • Error A: out of all the comparisons between two elements, what proportion of errors are due to indicating an irrelevant element as more important than a relevant element

  • Error B: out of all the comparisons between two elements, what proportion of errors are due to indicating a relevant element as less important than an irrelevant element

  • Total error A+B: the sum of quantity A and quantity B

Usage

belplauEval(
  belplau_mat,
  true_order,
  var = "rplau",
  err = "A",
  is_belplau = TRUE
)

Value

A number in \([0,1]\) of error A, B, or total error A+B.

Arguments

belplau_mat

belplau matrix e.g. belplau(bca) or a numerical vector quantifying order of importance of the elements of the frame.

true_order

a binary vector representing the truth. 1 means relevant and 0 means not relevant.

var

= "rplau" column name of the belplau matrix to be used as ordering.

err

= "A" kind of error to be evaluated. Can also take value "B" or "A+B".

is_belplau

= TRUE whether bel_plau is indeed a belplau matrix or just a numerical vector quantifying order of importance of elements.

Author

Peiyuan Zhu

Examples

Run this code
x <- bca(tt = matrix(c(0,1,1,1,1,0,1,1,1),nrow = 3, 
byrow = TRUE), m = c(0.2,0.5, 0.3), 
cnames = c("a", "b", "c"), varnames = "x", idvar = 1)
belplau(x)
y <- bca(tt = matrix(c(1,0,0,1,1,1),nrow = 2, 
byrow = TRUE), m = c(0.6, 0.4),  
cnames = c("a", "b", "c"),  varnames = "y", idvar = 1)
xy <- nzdsr(dsrwon(x,y))
z<-belplau(xy,h=ttmatrixPartition(xy$infovar[2],xy$infovar[2]))
belplauEval(z,c(0,1,0))

Run the code above in your browser using DataLab