Calculates the within-case standardized mean difference effect size index

SMD(
A_data,
B_data,
condition,
outcome,
baseline_phase = NULL,
intervention_phase = NULL,
improvement = "increase",
std_dev = "baseline",
bias_correct = TRUE,
confidence = 0.95
)

## Arguments

A_data

vector of numeric data for A phase. Missing values are dropped.

B_data

vector of numeric data for B phase. Missing values are dropped.

condition

vector identifying the treatment condition for each observation in the series.

outcome

vector of outcome data for the entire series.

baseline_phase

character string specifying which value of condition corresponds to the baseline phase. Defaults to first observed value of condition.

intervention_phase

character string specifying which value of condition corresponds to the intervention phase. Defaults to second unique value of condition.

improvement

character string indicating direction of improvement. Default is "increase".

std_dev

character string controlling how to calculate the standard deviation in the denominator of the effect size. Set to "baseline" (the default) to use the baseline standard deviation. Set to "pool" to use the pooled standard deviation.

bias_correct

logical value indicating whether to use bias-correction (i.e., Hedges' g). Default is TRUE

confidence

confidence level for the reported interval estimate. Set to NULL to omit confidence interval calculations.

## Value

A list containing the estimate, standard error, and confidence interval.

## Details

The standardized mean difference parameter is defined as the difference between the mean level of the outcome in phase B and the mean level of the outcome in phase A, scaled by the within-case standard deviation of the outcome in phase A. The parameter is estimated using sample means and sample standard deviations and (optionally) making a small-sample correction.

By default, the scaling factor is estimated using the sample standard deviation in phase A (the baseline phase) only. Set std_dev = "pool" to use the sample standard deviation pooled across both phases. Hedges' (1981) small-sample bias correction is applied by default.

## Examples

A <- c(20, 20, 26, 25, 22, 23)
B <- c(28, 25, 24, 27, 30, 30, 29)
SMD(A_data = A, B_data = B, bias_correct = FALSE)
#>    ES      Est        SE  CI_lower CI_upper baseline_SD
#> 1 SMD 1.959294 0.8237984 0.3446789 3.573909    2.503331
SMD(A_data = A, B_data = B)
#>    ES      Est        SE  CI_lower CI_upper baseline_SD
#> 1 SMD 1.649932 0.6340935 0.4071314 2.892732    2.503331
SMD(A_data = A, B_data = B, std_dev = "pool")
#>    ES      Est        SE  CI_lower CI_upper pooled_SD
#> 1 SMD 1.876247 0.6374216 0.6269241 3.125571  2.431752