Calculates the increasing or decreasing version of the log-response ratio effect size index, with or without bias correction (Pustejovsky, 2015)

LRRd(
A_data,
B_data,
condition,
outcome,
baseline_phase = NULL,
intervention_phase = NULL,
improvement = "decrease",
scale = "count",
observation_length = NULL,
intervals = NULL,
D_const = NULL,
bias_correct = TRUE,
pct_change = FALSE,
confidence = 0.95
)

LRRi(
A_data,
B_data,
condition,
outcome,
baseline_phase = NULL,
intervention_phase = NULL,
improvement = "increase",
scale = "count",
observation_length = NULL,
intervals = NULL,
D_const = NULL,
bias_correct = TRUE,
pct_change = FALSE,
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".

scale

character string indicating the scale of the outcome variable, with possible values "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.

observation_length

length of observation session (in minutes). If a vector, the mean observation session length will be used.

intervals

for interval recording procedures, the total number of intervals per observation session. If a vector, the mean number of intervals will be used.

D_const

constant used for calculating the truncated sample mean (see Pustejovsky, 2018). If a vector, the mean value will be used.

bias_correct

logical value indicating whether to use bias-correction. Default is TRUE.

pct_change

logical value indicating whether to convert the LRR estimate and confidence interval into percentage change.

confidence

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

## Value

A data.frame containing the estimate, standard error, and approximate confidence interval.

## Details

The response ratio parameter is the ratio of the mean level of the outcome during phase B to the mean level of the outcome during phase A. The log response ratio is the natural logarithm of the response ratio. This effect size is appropriate for outcomes measured on a ratio scale (so that zero corresponds to the true absence of the outcome. There are two versions of the LRR. The LRR-increasing (LRRi) is defined so that positive values correspond to therapeutic improvements. The LRR-decreasing (LRRd) is defined so that negative values correspond to therapeutic improvements. For outcomes measured as frequency counts or rates, the two versions will have the same magnitude but opposite sign; for outcomes measured as percentages or proportions, the LRRd and LRRi will differ in both sign and magnitude (Pustejovsky, 2018).

Without bias correction, the log response ratio is estimated as the natural logarithm of the phase B sample mean, minus the natural logarithm of the phase A sample mean. A delta-method bias correction to the estimator is used by default.

The standard error of LRR is calculated based on a delta-method approximation, allowing for the possibility of different degrees of dispersion in each phase. The confidence interval for LRR is based on a large-sample (z) approximation.

To account for the possibility of sample means of zero, a truncated mean is calculated following the method described in Pustejovsky (2018). Truncated sample variances are also calculated to ensure that standard errors will be strictly larger than zero. The truncation constant depends on the scale of the outcome, the length of the observation sessions used to measure the dependent variable, and (for interval recording procedures) the total number of intervals per session (or the total number of items for other percentage/proportion scales). The argument scale must be specified in order to calculate an appropriate truncation constant. For standardized rates, the argument observation_length must also be specified; for percentages or proportions, the argument intervals must be specified. For outcomes measured using continuous recording procedures, set intervals equal to 60 times the length of the observation session in minutes.

If pct_change is TRUE, then the LRR estimate and confidence interval are converted into percentage change using the formula Percentage change = 100 * (exp(LRR) - 1).

## References

Pustejovsky, J. E. (2015). Measurement-comparable effect sizes for single-case studies of free-operant behavior. Psychological Methods, 20(3), 342--359. doi:doi:10.1037/met0000019

Pustejovsky, J. E. (2018). Using response ratios for meta-analyzing single-case designs with behavioral outcomes. Journal of School Psychology, 16, 99-112. doi:doi:10.1016/j.jsp.2018.02.003

## Examples

A <- c(20, 20, 26, 25, 22, 23)
B <- c(28, 25, 24, 27, 30, 30, 29)
LRRd(A_data = A, B_data = B, bias_correct = FALSE)
#>     ES       Est         SE   CI_lower CI_upper
#> 1 LRRd 0.1958846 0.05557723 0.08695525 0.304814
LRRd(A_data = A, B_data = B)
#>     ES       Est         SE   CI_lower  CI_upper
#> 1 LRRd 0.1953962 0.05557723 0.08646679 0.3043255
LRRd(A_data = A, B_data = B, pct_change = TRUE)
#>             ES        Est         SE   CI_lower   CI_upper
#> 1         LRRd  0.1953962 0.05557723 0.08646679  0.3043255
#> 2 Pct_Change_d 21.5792546         NA 9.03151604 35.5710321