estimate_mdiff_contrast_bs: Estimate the mean difference for an independent groups...

Description Usage Arguments Value Details References See Also Examples

View source: R/estimate_mdiff_contrast_bs.R

Description

\loadmathjax

estimate_mdiff_contrast_bs returns the point estimate and confidence interval for the mean difference in a linear contrast: \mjdeqn \psi = \sum_i=1^ac_iM_i psi = sum(contrasts*means) Where there are a groups, and M is each group mean and c is each group weight; see Kline, equation 7.1

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
estimate_mdiff_contrast_bs(
  data = NULL,
  grouping_variable = NULL,
  outcome_variable = NULL,
  means = NULL,
  sds = NULL,
  ns = NULL,
  group_labels = NULL,
  grouping_variable_name = "My grouping variable",
  outcome_variable_name = "My outcome variable",
  contrast = NULL,
  conf_level = 0.95,
  assume_equal_variance = FALSE,
  save_raw_data = TRUE
)

Arguments

data

For raw data - a dataframe or tibble

grouping_variable

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

outcome_variable

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

means

For summary data - A vector of 2 or more means

sds

For summary data - A vector of standard deviations, same length as means

ns

For summary data - A vector of sample sizes, same length as means

group_labels

For summary data - An optional vector of group labels, same length as means

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.

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.

contrast

A vector of group weights.

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

Value

Returnsobject of class esci_estimate

Details

This is a friendly version of CI_mdiff_contrast_bs

References

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 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_contrast_bs(
 PlantGrowth, 
 group, 
 weight,
 contrast = c('ctrl' = -1, 'trt1' = 1)
)

rcalinjageman/esci2 documentation built on Dec. 22, 2021, 1:02 p.m.