Learn R Programming

flexclust (version 1.3-3)

propBarchart: Barchart for Proportions of Apriori Segments in Binary Data Matrix

Description

This function splits a binary data matrix into subgroups, computes the percentage of ones in each column and compares the proportions in the groups using prop.test. The p-values for all variables are adjusted for multiple testing and a barchart of group percentages is drawn highlighting variables with significant differences in proportion.

Usage

propBarchart(x, g, alpha=0.05, correct="holm",
             strip.prefix="", strip.labels=NULL, which=NULL, ...)

Arguments

x
A binary data matrix.
g
A factor specifying the groups.
alpha
Significance level for test of differences in proportions.
correct
Correction method for multiple testing, passed to p.adjust.
strip.prefix
Character string prepended to strips of the barchart (the remainder of the strip are group levels and group sizes). Ignored if strip.labels is specified.
strip.labels
Character vector of labels to use for strips of barchart.
which
Index numbers or names of variables to plot.
...
Passed on to barchart.

See Also

barplot-methods

Examples

Run this code
## create a binary matrix from the iris data plus a random noise column
 x <- apply(iris[,1:4], 2, function(z) z>median(z))
 x <- cbind(x, Noise=sample(0:1, 150, replace=TRUE))

 ## There are significant differences in all 4 original variables, Noise
 ## has most likely no significant difference (of course the difference
 ## will be significant in alpha percent of all random samples).
 propBarchart(x, iris$Species)

Run the code above in your browser using DataLab