plot_OR_by_level: Statified OR Plot with Confidence Intervals

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Statified OR Plot with Confidence Intervals

Usage

1
2
3
plot_OR_by_level(dat, factor.var1, prop.var, alpha = 0.05,
  factor.var2 = NULL, ylab = "Proportion", ref.group = 1,
  include.ref.group.effect = TRUE)

Arguments

dat

a data frame of patient characteristics from a study.

factor.var1

string indicating the first factor variable to stratify by (what will be on the x-axis)

prop.var

string indicating the outcome variable to calculate the proportion of. Must be binary or logical

alpha

the confidence level to use for the confidence interval construction. by default it uses 0.05 => 95% confidence intervals.

factor.var2

string indicating the second factor variable to stratify by (what will be designated by color), default is NULL which ignores this argument.

Details

This function produces a plot

Value

a ggplot of the ORs of the outcome stratified by factor.var1 and (optionally) factor.var2.

Author(s)

Jesse D. Raffa

See Also

ggplot

Examples

1
2
3
4
5
set.seed(1)
require(ggplot2); require(dplyr)
N <- 100;
dataf <- data.frame(outcome=sample(c(0,1),N,replace=TRUE),age=c(runif(N-1,0,100),NA),sex=as.factor(sample(c(0,1),N,replace=TRUE)),cholesterol=rnorm(N,100,30),rx=as.factor(sample(c(0,1),N,replace=TRUE)))
plot_OR_by_level(dataf,"sex","outcome",factor.var2="rx")

jraffa/MIMICbook documentation built on May 19, 2019, 11:51 p.m.