Creates an (extended) fourfold display of a
fourfold(x,
color = c("#99CCFF", "#6699CC", "#FFA0A0", "#A0A0FF", "#FF0000", "#000080"),
conf_level = 0.95, std = c("margins", "ind.max", "all.max"),
margin = c(1, 2), space = 0.2, main = NULL, sub = NULL,
mfrow = NULL, mfcol = NULL, extended = TRUE, ticks = 0.15,
p_adjust_method = p.adjust.methods, newpage = TRUE,
fontsize = 12, default_prefix = c("Row", "Col", "Strata"),
sep = ": ", varnames = TRUE, return_grob = FALSE)
a length(dim(x)>3
,
dimensions 3:length(dim(x)
are silently raveled into a combined strata dimension
with k=prod(dim(x)[-(1:2)]))
.
a vector of length 6 specifying the colors to use for the
smaller and larger diagonals of each
confidence level used for the confidence rings on the odds ratios. Must be a single non-negative number less than 1; if set to 0, confidence rings are suppressed.
a character string specifying how to standardize the table.
Must be one of "margins"
, "ind.max"
, or
"all.max"
, and can be abbreviated by the initial letter.
If set to "margins"
, each margin
while preserving the
odds ratio. If "ind.max"
or "all.max"
, the tables are
either individually or simultaneously standardized to a maximal cell
frequency of 1.
a numeric vector with the margins to equate. Must be
one of 1
, 2
, or c(1, 2)
(the default), which
corresponds to standardizing only the row, only column, or both row and column in
each std
equals "margins"
.
the amount of space (as a fraction of the maximal radius of the quarter circles) used for the row and column labels.
character string for the fourfold plot title/subtitle.
a numeric vector with two components:
nr and nc, indicating that the displays for the
logical; if TRUE
, extended plots are plotted,
i.e., colors are brighter for significant log-odds ratios, and ticks
are plotted showing the direction of association for positive log-odds.
the length of the ticks. If set to 0, no ticks are plotted.
method to be used for p-value adjustments for
multi-stratum plots, as provided by link[stats]{p.adjust}
.
Use p_adjust_method="none"
to disable this adjustment.
The p-values are used for the ‘visual’
significance tests of the odds ratios.
logical; if TRUE
, grid.newpage()
is
called before plotting.
fontsize of main title. Other labels are scaled relative to this.
character vector of length 3 with default labels for possibly missing row/column/strata variable names.
default separator between variable names and levels for labels.
Logical; should the variable names be printed in the labeling of stratifed plots?
Logical; shall a snapshot of the display be returned as a grob object?
The fourfold display is designed for the display of
Following suitable standardization, the cell frequencies
Typically, the number
Friendly, M. (1994),
A fourfold display for 2 by 2 by
Friendly, M. (2000), Visualizing Categorical Data. SAS Institute, Cary, NC.
link[stats]{p.adjust}
for methods of p value adjustment
# NOT RUN {
data("UCBAdmissions")
## Use the Berkeley admission data as in Friendly (1995).
x <- aperm(UCBAdmissions, c(2, 1, 3))
dimnames(x)[[2]] <- c("Yes", "No")
names(dimnames(x)) <- c("Sex", "Admit?", "Department")
ftable(x)
## Fourfold display of data aggregated over departments, with
## frequencies standardized to equate the margins for admission
## and sex.
## Figure 1 in Friendly (1994).
fourfold(margin.table(x, c(1, 2)))
## Fourfold display of x, with frequencies in each table
## standardized to equate the margins for admission and sex.
## Figure 2 in Friendly (1994).
fourfold(x)
cotabplot(x, panel = cotab_fourfold)
## Fourfold display of x, with frequencies in each table
## standardized to equate the margins for admission. but not
## for sex.
## Figure 3 in Friendly (1994).
fourfold(x, margin = 2)
# }
Run the code above in your browser using DataLab