
Last chance! 50% off unlimited learning
Sale ends in
Making text subtitle for contingency analysis (Pearson's chi-square test for independence for between-subjects design or McNemar's test for within-subjects design)
subtitle_contingency_tab(data, main, condition, counts = NULL,
nboot = 100, paired = FALSE, stat.title = NULL,
conf.level = 0.95, conf.type = "norm", simulate.p.value = FALSE,
B = 2000, k = 2, messages = TRUE, ...)
A dataframe (or a tibble) from which variables specified are to be taken. A matrix or tables will not be accepted.
The variable to use as the rows in the contingency table.
The variable to use as the columns in the contingency table.
A string naming a variable in data containing counts, or NULL
if each row represents a single observation (Default).
Number of bootstrap samples for computing effect size (Default:
100
).
Logical indicating whether data came from a within-subjects
design study (Default: FALSE
). If TRUE
, McNemar test subtitle will be
returned. If FALSE
, Pearson's chi-square test will be returned.
Title for the effect being investigated with the chi-square
test. The default is NULL
, i.e. no title will be added to describe the
effect being shown. An example of a stat.title
argument will be something
like "main x condition"
or "interaction"
.
Scalar between 0 and 1. If unspecified, the defaults return
95%
lower and upper confidence intervals (0.95
).
A vector of character strings representing the type of
intervals required. The value should be any subset of the values "norm"
,
"basic"
, "perc"
, "bca"
. For more, see ?boot::boot.ci
.
a logical indicating whether to compute p-values by Monte Carlo simulation.
an integer specifying the number of replicates used in the Monte Carlo test.
Number of digits after decimal point (should be an integer)
(Default: k = 2
).
Decides whether messages references, notes, and warnings are
to be displayed (Default: TRUE
).
Additional arguments.
# NOT RUN {
# without counts data
subtitle_contingency_tab(
data = mtcars,
main = am,
condition = cyl,
nboot = 15
)
# with counts data
# in case of no variation, a `NULL` will be returned.
library(jmv)
as.data.frame(HairEyeColor) %>%
dplyr::filter(.data = ., Sex == "Male") %>%
subtitle_contingency_tab(
data = .,
main = Hair,
condition = Sex,
counts = Freq
)
# }
Run the code above in your browser using DataLab