woeBal | R Documentation |
Creates a weight of evidence balance sheet from a history of marginal distributions.
woeBal(hist, pos, neg, obs=NULL, title = "Evidence Balance Sheet",
col = rev(colorspread("slategray",ncol(hist),maxsat=TRUE)),
posCol="cyan", negCol="red", stripCol=c("white","lightgray"),
lcex = 0.65)
hist |
A matrix whose rows represent time points (after tests) and columns represent probabilities. |
pos |
An expression for selecting rows of the |
neg |
An expression for selecting the rows corresponding to
the complement of the hypothesis. (The default value is
|
obs |
An optional character vector of the same length as the
number of rows of |
title |
Title for plot |
col |
A list of color values for probability bars. |
posCol |
The color to be used for bars showing positive weights of evidence. |
negCol |
The color to be used for bars showing negative weights of evidence. |
stripCol |
The colors to be used for the time step labels. Setting this to a vector of two colors creates alternate color stripes. Set this to "white" to disable that effect. |
lcex |
Character expansion size for labels. |
This constructs a weight of evidence balance sheet (Madigan,
Mosurski, and Almond, 1997) showing the changes
to the probability distribution and weight of evidence for each
change in the probability. The probabilities are given in the
hist
argument in which each row should be a probability
distribution for the target variable. The labels for the plot are
taken from the row labels of the hist
argument.
Madigan, Mosurski and Almond (1997) note that the definition of weight
of evidence is somewhat problematic if the hypothesis variable is not
binary. In that case, they recommend partitioning the states into a
positive and negative set. The pos
and neg
are meant to describe that partition. They can be any expression
suitable for selecting columns from the hist
matrix. This
function calls woeHist()
to calculate weights of evidence.
The row names of hist
are printed left-justified in the
leftmost column. If observed values (obs
) are supplied, they
are printed right justified in the same column.
The midpoints of the bars (see barplot
) are
returned invisibly.
Starts a new plotting page and creates three side-by-side plots, one for the labels, one for the probability bars and one for the weight of evidence bars.
Russell Almond
Good, I. (1971) The probabilistic explication of information, evidence, surprise, causality, explanation and utility. In Proceedings of a Symposium on the Foundations of Statistical Inference. Holt, Rinehart and Winston, 108-141.
Madigan, D., Mosurski, K. and Almond, R. (1997) Graphical explanation in belief networks. Journal of Computational Graphics and Statistics, 6, 160-181.
Almond, R. G., Kim, Y. J., Shute, V. J. and Ventura, M. (2013). Debugging the Evidence Chain. In Almond, R. G. and Mengshoel, O. (Eds.) Proceedings of the 2013 UAI Application Workshops: Big Data meet Complex Models and Models for Spatial, Temporal and Network Data (UAI2013AW), 1-10. http://ceur-ws.org/Vol-1024/paper-01.pdf
Almond, R.G., Mislevy, R.J., Steinberg, L.S., Williamson, D.M. and Yan, D. (2015) Bayesian Networks in Educational Assessment. Springer. Chapter 7.
readHistory
, woeHist
,
barplot
, Colors
sampleSequence <- read.csv(system.file("testFiles","SampleStudent.csv",
package="CPTtools"),
header=TRUE,row.names=1)
woeBal(sampleSequence[,c("H","M","L")],c("H"),c("M","L"),lcex=1.25)
woeBal(sampleSequence[,c("H","M","L")],c("H"),c("M","L"),
obs=sampleSequence[,"Acc"],lcex=1.25)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.