logodds_graph: Graph Log-Odds of Binary Variable Across A Grouping Variable

Description Usage Arguments Value

View source: R/logodds_graph.R

Description

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.

Usage

1
2
3
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, ...)

Arguments

y

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).

group

Vector of values indicating what group each y observation belongs to. Function plots group levels across x-axis in same order as table(group).

error.bars

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.

alpha

Numeric value indicating what alpha should be set to for confidence intervals. Only used if error.bars is "exact.ci" or "z.ci".

p.legend

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.

plot.list

Optional list of inputs to pass to plot function.

lines.list

Optional list of inputs to pass to lines function.

axis.list

Optional list of inputs to pass to axis function.

legend.list

Optional list of inputs to pass to legend function.

...

Additional arguments to pass to chisq.test or fisher.test functions.

Value

Plot showing log-odds of y across levels of group.


dvmisc documentation built on May 2, 2019, 5:51 p.m.

Related to logodds_graph in dvmisc...