View source: R/estimate_mdiff_ind_contrast.R
| estimate_mdiff_ind_contrast | R Documentation |
estimate_mdiff_ind_contrast returns the point estimate and
confidence interval for the 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 or median and c is each group
weight.
estimate_mdiff_ind_contrast(
data = NULL,
outcome_variable = NULL,
grouping_variable = NULL,
means = NULL,
sds = NULL,
ns = NULL,
contrast = 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
)
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 |
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 |
contrast |
A vector of group weights. |
grouping_variable_levels |
For summary data - An optional vector of group labels, same length as means |
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 |
Returnsobject of class esci_estimate
# 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_ind_contrast(
datasets::PlantGrowth,
weight,
group,
contrast = c('ctrl' = -1, 'trt1' = 1)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.