Calculates one or more effect size estimates, along with associated standard errors and confidence intervals, if available, for a single-case data series.

batch_calc_ES(
dat,
grouping,
condition,
outcome,
aggregate = NULL,
weighting = "equal",
session_number = NULL,
baseline_phase = NULL,
intervention_phase = NULL,
ES = c("LRRd", "LRRi", "SMD", "Tau"),
improvement = "increase",
scale = "other",
intervals = NA,
observation_length = NA,
confidence = 0.95,
format = "long",
warn = TRUE,
...
)

## Arguments

dat

data frame containing SCD series for which effect sizes will be calculated.

grouping

A variable name or list of (unquoted) variable names that uniquely identify each data series.

condition

A variable name that identifies the treatment condition for each observation in the series.

outcome

A variable name for the outcome data. Default is

aggregate

A variable name of list of (unquoted) variable names that identify additional grouping variables. Effect sizes will be calculated separately for each unique value of these variables, after which the effect size estimates will be averaged across values of these variables (but not across the values of the grouping variables).

weighting

character string specifying the weighting scheme for use when variables are specified in aggregate. Available is "1/V", "equal" (the default), "Equal", "nA", "n_A", "nB", "n_B", "nAnB", "nA*nB", "nA*nB", "n_A*n_B", "n_A * n_B", "1/nA+1/nB", "1/nA + 1/nB", "1/n_A+1/n_B", or "1/n_A + 1/n_B". Note that "1/V" can only be used for effect sizes with known standard errors.

session_number

A variable name used to order the data within each series.

baseline_phase

character string specifying which value of condition corresponds to the baseline phase. If NULL (the default), the first observed value of condition within the series will be used.

intervention_phase

character string specifying which value of condition corresponds to the intervention phase. If NULL (the default), the second unique value of condition within the series will be used.

ES

character string or character vector specifying which effect size index or indices to calculate. Available effect sizes are "LRRd", "LRRi", "LRM", "LOR", "SMD", "NAP", "IRD", "PND", "PEM", "PAND", "Tau", "Tau-U", and "Tau-BC". Set to "all" for all available effect sizes. Set to "parametric" for all parametric effect sizes. Set to "NOM" for all non-overlap measures. Defaults to calculating the LRRd, LRRi, SMD, and Tau indices.

improvement

character string either indicating the direction of uniform improvement ("increase" or "decrease") or the variable name of a variable identifying the direction of improvement for each series. Default is "increase".

scale

character string indicating the common scale of the outcome variable across all of the series in the data set or the name of a variable within the dataset that identifies the outcome scale within each series. Possible values for the scale are "percentage" for a percentage with range 0-100, "proportion" for a proportion with range 0-1, "count" for a frequency count (0 or positive integers), "rate" for a standardized rate per minute. If a vector, the most frequent unique value will be used and missing values will be ignored. Defaults to NA.

intervals

for interval recording procedures. Either the total number of intervals per observation session common to all series in the dataset, or the name of a variable within the dataset that identifies the number of intervals for each observation. If a variable name, the mean number of intervals within each series will be used. Missing values will be ignored. Defaults to NA.

observation_length

Used for the log-response ratio. Either the common observation session length (in minutes) across all series in the dataset or a variable name containing the observation session length for each observation. If a variable name, the mean observation session length within each series will be used. Missing values will be ignored. Defaults to NA.

confidence

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

format

character string specifying whether to organize the results in "long" format or "wide" format. Defaults to "long".

warn

logical indicating whether warnings should be displayed. Default is TRUE.

...

further arguments used for calculating some of the effect size indices.

## Value

A tibble containing the estimate, standard error, and/or confidence interval for each specified effect size.

## Details

Calculates one or more effect size indices for each series in a dataset

## Examples


data(McKissick)
batch_calc_ES(McKissick,
grouping = Case_pseudonym,
condition = Condition,
outcome = Outcome,
ES = c("LRRd","LRRi"),
improvement = "decrease",
scale = "count",
observation_length = 20,
format = "long")
#> # A tibble: 6 × 6
#>   Case_pseudonym ES       Est    SE CI_lower CI_upper
#>   <chr>          <chr>  <dbl> <dbl>    <dbl>    <dbl>
#> 1 Period 1       LRRd  -0.807 0.198  -1.19    -0.419
#> 2 Period 1       LRRi   0.807 0.198   0.419    1.19
#> 3 Period 2       LRRd  -0.610 0.349  -1.29     0.0736
#> 4 Period 2       LRRi   0.610 0.349  -0.0736   1.29
#> 5 Period 3       LRRd  -0.748 0.353  -1.44    -0.0550
#> 6 Period 3       LRRi   0.748 0.353   0.0550   1.44

data(Schmidt2007)
batch_calc_ES(dat = Schmidt2007,
grouping = c(Behavior_type, Case_pseudonym, Phase_num),
condition = Condition,
outcome = Outcome,
ES = c("LRRi","LRRd"),
improvement = direction,
scale = Metric,
bias_correct = TRUE,
confidence = NULL,
format = "wide")
#> # A tibble: 12 × 7
#>    Behavior_type      Case_pseudonym Phase_num LRRi_Est LRRi_SE LRRd_Est LRRd_SE
#>    <chr>              <chr>              <int>    <dbl>   <dbl>    <dbl>   <dbl>
#>  1 Disruptive Behavi… Albert                 1   1.75     0.210 -1.75      0.210
#>  2 Disruptive Behavi… Albert                 2   0.947    0.538 -0.947     0.538
#>  3 Disruptive Behavi… Faith                  1   1.61     0.324 -1.61      0.324
#>  4 Disruptive Behavi… Faith                  2   1.65     0.376 -1.65      0.376
#>  5 Disruptive Behavi… Lilly                  1   1.17     0.227 -1.17      0.227
#>  6 Disruptive Behavi… Lilly                  2   1.43     0.310 -1.43      0.310
#>  7 On Task Behavior   Albert                 1   0.421    0.162 -1.56      0.511
#>  8 On Task Behavior   Albert                 2   0.0525   0.117 -0.871     0.940
#>  9 On Task Behavior   Faith                  1   0.323    0.129 -1.72      0.393
#> 10 On Task Behavior   Faith                  2   0.241    0.201 -1.17      0.917
#> 11 On Task Behavior   Lilly                  1   0.0147   0.114 -0.00904   0.364
#> 12 On Task Behavior   Lilly                  2   0.604    0.672 -2.70      0.534

# Aggregate across phase-pairs
batch_calc_ES(dat = Schmidt2007,
grouping = c(Behavior_type, Case_pseudonym),
aggregate = Phase_num,
weighting = "1/V",
condition = Condition,
outcome = Outcome,
ES = c("LRRi", "LRRd", "SMD", "Tau"),
improvement = direction,
scale = "count",
bias_correct = TRUE,
confidence = NULL,
format = "long")
#> # A tibble: 24 × 5
#>    Behavior_type       Case_pseudonym ES       Est     SE
#>    <chr>               <chr>          <chr>  <dbl>  <dbl>
#>  1 Disruptive Behavior Albert         LRRd  -1.64  0.195
#>  2 Disruptive Behavior Albert         LRRi   1.64  0.195
#>  3 Disruptive Behavior Albert         SMD    1.11  0.324
#>  4 Disruptive Behavior Albert         Tau    0.999 0.0133
#>  5 Disruptive Behavior Faith          LRRd  -1.63  0.245
#>  6 Disruptive Behavior Faith          LRRi   1.63  0.245
#>  7 Disruptive Behavior Faith          SMD    1.35  0.341
#>  8 Disruptive Behavior Faith          Tau    0.942 0.0697
#>  9 Disruptive Behavior Lilly          LRRd  -1.26  0.183
#> 10 Disruptive Behavior Lilly          LRRi   1.26  0.183
#> # … with 14 more rows