Calculates the HPS effect size estimator based on data from an (AB)^k design, as described in Hedges, Pustejovsky, & Shadish (2012). Note that the data must contain one row per measurement occasion per subject.

effect_size_ABk(
  outcome,
  treatment,
  id,
  phase,
  time,
  data = NULL,
  phi = NULL,
  rho = NULL
)

Arguments

outcome

vector of outcome data or name of variable within data. May not contain any missing values.

treatment

vector of treatment indicators or name of variable within data. Must be the same length as outcome.

id

factor vector indicating unique cases or name of variable within data. Must be the same length as outcome.

phase

factor vector indicating unique phases (each containing one contiguous control condition and one contiguous treatment condition) or name of variable within data. Must be the same length as outcome.

time

vector of measurement occasion times or name of variable within data. Must be the same length as outcome.

data

(Optional) dataset to use for analysis. Must be data.frame.

phi

(Optional) value of the auto-correlation nuisance parameter, to be used in calculating the small-sample adjusted effect size

rho

(Optional) value of the intra-class correlation nuisance parameter, to be used in calculating the small-sample adjusted effect size

Value

A list with the following components

M_aMatrix reporting the total number of time points with data for all ids, by phase and treatment condition
M_dotTotal number of time points used to calculate the total variance (the sum of M_a)
D_barnumerator of effect size estimate
S_sqsample variance, pooled across time points and treatment groups
delta_hat_unadjunadjusted effect size estimate
phicorrected estimate of first-order auto-correlation
sigma_sq_wcorrected estimate of within-case variance
rhoestimated intra-class correlation
thetaestimated scalar constant
nuestimated degrees of freedom
delta_hatcorrected effect size estimate
V_delta_hatestimated variance of the effect size

Note

If phi or rho is left unspecified (or both), estimates for the nuisance parameters will be calculated.

References

Hedges, L. V., Pustejovsky, J. E., & Shadish, W. R. (2012). A standardized mean difference effect size for single case designs. Research Synthesis Methods, 3, 224-239. doi: 10.1002/jrsm.1052

Examples

data(Lambert)
effect_size_ABk(outcome = outcome, treatment = treatment, id = case, 
                phase = phase, time = time, data = Lambert)
#>                            est    se
#> unadjusted effect size  -2.525 0.202
#> adjusted effect size    -2.513 0.201
#> degree of freedom      164.492      
   
data(Anglesea)
effect_size_ABk(outcome = outcome, treatment = condition, id = case, 
                phase = phase, time = session, data = Anglesea)
#>                          est    se
#> unadjusted effect size 1.793 2.436
#> adjusted effect size   1.150 1.562
#> degree of freedom      2.340