contCompare: Compare conditional distributions with continuous outcome...

View source: R/contCompare.R

contCompareR Documentation

Compare conditional distributions with continuous outcome with optional graph

Description

Compare conditional distributions with continuous outcome with optional graph

Usage

contCompare(
  data,
  group,
  outcome,
  compare = FALSE,
  baseline = "",
  FUN = "mean",
  quantile = 0.5,
  graph = FALSE,
  graphType = "diff"
)

Arguments

data

data frame

group

your x variable (a factor variable)

outcome

your continuous y variable

compare

do you want to compare conditional outcomes to a baseline level of x TRUE or FALSE

baseline

the omitted/baseline/reference level of x

FUN

a function describing an outcome c(mean, median, sd, var, iqr, quantile, min or max)

quantile

a vector to pass to quantile()

graph

a TRUE/FALSE indicator of whether or not to print a graph

graphType

if a graph will be plotted, print differences or ratios

Examples

library(car)
library(tidyverse)
contCompare(data = GSSvocab, group = educGroup, outcome = vocab, graph = FALSE)
contCompare(data = GSSvocab, group = educGroup, outcome = vocab, graph = TRUE,
graphType = "diff", compare = TRUE, baseline = "12 yrs")
contCompare(data = GSSvocab, group = educGroup, outcome = vocab, graph = TRUE,
graphType = "ratio", compare = TRUE, baseline = "16 yrs")
contCompare(data = GSSvocab, group = nativeBorn, outcome = age,
compare = FALSE, graph = TRUE, FUN = "median")

prox9974/soc429Code documentation built on June 16, 2022, 3:41 a.m.