paik {asbio} | R Documentation |
Paik diagrams
Description
Paik diagrams for the representation of Simpsons Paradox in three way tables.
Usage
paik(formula, counts, resp.lvl = 2, data, circle.mult = 0.4, xlab = NULL,
ylab = NULL, leg.title = NULL, leg.loc = NULL, show.mname = FALSE,...)
Arguments
formula |
A two sided formula, e.g. |
counts |
A vector of counts for the associated categorical variables in |
resp.lvl |
The level in Y of primary interest. See example below. |
data |
Dataframe containing variables in |
circle.mult |
Multiplier for circle radii in the diagram. |
xlab |
X-axis label. By default this is defined as the categories in the first explanatory variable, |
ylab |
Y-axis label. By default these will be proportions with respect to the specified level of interest in the response. |
leg.title |
Legend title. By default the conditioning variable name. |
leg.loc |
Legend location. A |
show.mname |
Logical, indicating whether or not the words "Marginal prop" should printed in the graph above the dotted line indicating marginal proportions. |
... |
Additional arguments from |
Author(s)
Ken Aho
References
Agresti, A. (2012) Categorical Data Analysis, 3rd edition. New York. Wiley.
Paik M. (1985) A graphical representation of a three-way contingency table: Simpson's paradox and correlation. American Statistician 39:53-54.
Examples
require(tcltk)
data(death.penalty)# from Agresti 2012
op <- par(mfrow=c(1,2), mar=c(4,4,0,0))
paik(verdict ~ d.race + v.race, counts = count, data = death.penalty,
leg.title = "Victims race", xlab = "Defendants race",
ylab = "Proportion receiving death penalty")
par(mar=c(4,2,0,2))
paik(verdict ~ v.race + d.race, counts = count, data = death.penalty,
xlab = "Victims race", leg.title = "Defendants race",leg.loc="topleft",
ylab = "", yaxt = "n")
par(op)
if(interactive()){
if(any(names(sessionInfo()$otherPkgs)=="asbio")) vignette(package = "asbio", "simpson")
}