estimate_mdiff_two: Estimate magnitude of difference between two independent...

View source: R/estimate_mdiff_two.R

estimate_mdiff_twoR Documentation

Estimate magnitude of difference between two independent groups.

Description

\loadmathjax

estimate_mdiff_two returns effect sizes estimating the magnitude of difference between two groups along a quantitative variable.

Usage

estimate_mdiff_two(
  data = NULL,
  outcome_variable = NULL,
  grouping_variable = NULL,
  comparison_mean = NULL,
  comparison_sd = NULL,
  comparison_n = NULL,
  reference_mean = NULL,
  reference_sd = NULL,
  reference_n = NULL,
  grouping_variable_levels = NULL,
  outcome_variable_name = "My outcome variable",
  grouping_variable_name = "My grouping variable",
  conf_level = 0.95,
  assume_equal_variance = FALSE,
  save_raw_data = TRUE,
  switch_comparison_order = FALSE
)

Arguments

data

For raw data - a dataframe or tibble

outcome_variable

For raw data - The column name of the outcome variable, or a vector of numeric data

grouping_variable

For raw data - The column name of the grouping variable, or a vector of group names

comparison_mean

For summary data, a numeric

comparison_sd

For summary data, numeric > 0

comparison_n

For summary data, a numeric integer > 0

reference_mean

For summary data, a numeric

reference_sd

For summary data, numeric > 0

reference_n

For summary data, a numeric integer > 0

grouping_variable_levels

For summary data - An optional vector of 2 group labels

outcome_variable_name

Optional friendly name for the outcome variable. Defaults to 'My outcome variable' or the outcome variable column name if a data frame is passed.

grouping_variable_name

Optional friendly name for the grouping variable. Defaults to 'My grouping variable' or the grouping variable column name if a data.frame is passed.

conf_level

The confidence level for the confidence interval. Given in decimal form. Defaults to 0.95.

assume_equal_variance

Defaults to FALSE

save_raw_data

For raw data; defaults to TRUE; set to FALSE to save memory by not returning raw data in estimate object

switch_comparison_order

Defaults to FALSE

Value

Returnsobject of class esci_estimate

Examples

# From Raw Data ------------------------------------
# Just pass in the data source, grouping column, and outcome column.
# You can pass these in by position, skipping the labels:

# Note... not sure if PlantGrowth dataset meets assumptions for this analysis
estimate_mdiff_two(
 datasets::PlantGrowth[PlantGrowth$group != 'trt2', ],
 weight,
 group
)


rcalinjageman/esci4 documentation built on May 18, 2023, 4:01 a.m.