TestCases {rWMBAT}R Documentation

Uses Bayes Rule To Classify A Case

Description

Tests each of a set of data vectors by looking up P(data|class) in a probability table, then finding P(case|class) by multiplying each of those values in a product. Then uses Bayes' rule to calculate P(class|data) for each possible value of class. Reports this as an array of class probabilities for each case.

Usage

TestCases(p, prior, data)

Arguments

p 3-D double array of probabilities (c,d,v). The first dimension is the class, the second is the data value, the third is the variable number. The entry is P(var v=value d | class=value c)
prior double columns vector, prior probabilities for each cases in data
data double array of discrete integer (1:n) values, cases in rows and variables in columns

Value

2-D double array whose value is P(class=c|data) for each case. Cases are in rows, class in cols

Author(s)

Karl Kuschner, Qian Si and William Cooke, College of William and Mary, Dept. of Physics, 2009

References

http://kwkusc.people.wm.edu/dissertation/dissertation.htm

Examples

data(ptable, prior, testgrpbin) # load example input data from package
classprobtable <- TestCases (ptable, prior, testgrpbin)
         

[Package rWMBAT version 2.0 Index]