diff_in_medians: Calculate difference in medians

View source: R/test_stats.R

diff_in_mediansR Documentation

Calculate difference in medians

Description

This function takes a data frame, and group and outcome column names as input and returns the difference in median outcome between the two groups

Usage

diff_in_medians(df, group_col, outcome_col, treatment_value = NULL)

Arguments

df

A data frame

group_col

The name of the column in df that corresponds to the group label

outcome_col

The name of the column in df that corresponds to the outcome variable

treatment_value

The value of group_col to be considered 'treatment'

Value

The difference in median outcome between the two groups

Examples

data <- data.frame(group = c(rep(1, 4), rep(2, 4)),
                   outcome = c(rep(3, 4), rep(5, 4)))

diff_in_medians(df = data,
              group_col = "group",
              outcome_col = "outcome",
              treatment_value = 1)

permutest documentation built on Sept. 26, 2024, 5:07 p.m.