Creates plot showing sample log-odds of binary Y variable across levels of a
grouping variable, with customizable error bars. Observations with missing
values for y
and/or group
are dropped.
logodds_graph(y, group, error.bars = "none", alpha = 0.05,
p.legend = "chi", plot.list = NULL, lines.list = NULL,
axis.list = NULL, legend.list = NULL, ...)
Vector of values for binary response variable. Must take on 2
values, but can be any type (e.g. numeric, character, factor, logical).
Function plots log-odds of second value returned by table(y)
.
Vector of values indicating what group each y
observation
belongs to. Function plots group levels across x-axis in same order as
table(group)
.
Character string indicating what the error bars should
represent. Possible values are "exact.ci"
for exact 95% confidence
interval based on binomial distribution, "z.ci"
for approximate 95%
confidence interval based on Z distribution, and "none"
for no error
bars.
Numeric value indicating what alpha should be set to for
confidence intervals. Only used if error.bars
is "exact.ci"
or
"z.ci"
.
Character string controlling what p-value is printed in a
legend. Possible values are "chi"
for Chi-square test of association,
"fisher"
for Fisher's exact test, and "none"
for no legend at
all.
Optional list of inputs to pass to
plot
function.
Optional list of inputs to pass to
lines
function.
Optional list of inputs to pass to
axis
function.
Optional list of inputs to pass to
legend
function.
Additional arguments to pass to chisq.test
or
fisher.test
functions.
Plot showing log-odds of y
across levels of group
.