Skip to contents

Adds level, trend, and slope-change columns suitable for a piecewise multilevel model with time-series intervention coding inside a three-level meta-analytic structure.

Usage

process_scd_phases(data, structure, scd_type = "reversal")

Arguments

data

A data frame with a phase column.

structure

A list describing the hierarchical structure.

scd_type

Design type: "reversal", "multiple_baseline", "multiple_probe", "alternating" (alias "alternating_treatment"), "changing_criterion", or "AB".

Value

The data frame with piecewise regression columns added.

References

Huitema, B. E., & McKean, J. W. (2000). Design specification issues in time-series intervention models. Educational and Psychological Measurement, 60(1), 38-58.

Van den Noortgate, W., & Onghena, P. (2003). Hierarchical linear models for the quantitative integration of effect sizes in single-case research. Behavior Research Methods, 35(1), 1-10.

Examples

d <- simulate_scd_data(n_cases = 2, n_phase_a = 5, n_phase_b = 5)
process_scd_phases(d, structure = list(), scd_type = "AB")
#> # A tibble: 20 × 12
#>    case   time phase phase_num time_center time_since_change outcome
#>    <chr> <int> <chr>     <dbl>       <dbl>             <dbl>   <dbl>
#>  1 C1        1 A             0           0                 0    44.0
#>  2 C2        1 A             0           0                 0    49.0
#>  3 C1        2 A             0           1                 0    64.6
#>  4 C2        2 A             0           1                 0    52.4
#>  5 C1        3 A             0           2                 0    51.5
#>  6 C2        3 A             0           2                 0    50.6
#>  7 C1        4 A             0           3                 0    35.7
#>  8 C2        4 A             0           3                 0    28.2
#>  9 C1        5 A             0           4                 0    49.9
#> 10 C2        5 A             0           4                 0    48.8
#> 11 C1        6 B             1           5                 1    47.9
#> 12 C2        6 B             1           5                 1    51.1
#> 13 C1        7 B             1           6                 2    40.9
#> 14 C2        7 B             1           6                 2    50.1
#> 15 C1        8 B             1           7                 3    29.0
#> 16 C2        8 B             1           7                 3    68.8
#> 17 C1        9 B             1           8                 4    68.9
#> 18 C2        9 B             1           8                 4    71.6
#> 19 C1       10 B             1           9                 5    40.3
#> 20 C2       10 B             1           9                 5    57.1
#> # ℹ 5 more variables: phase_numeric <dbl>, time_A <dbl>, time_B <dbl>,
#> #   level_AB <int>, trend_AB <dbl>