Improvement Rate Difference (IRD)#

The ird function computes the Improvement Rate Difference (IRD) for single-case experimental design (SCED) data. IRD is a non-parametric effect size metric that quantifies the difference in improvement rates between two phases (typically A and B).

Function Overview#

The ird function can be used with a single-case DataFrame or a list of DataFrames (for multiple cases). It prints the IRD value(s) for the specified phases.

Arguments#

  • data: DataFrame or list of DataFrames containing SCED data.

  • dvar: Name of the dependent variable column (default: “values”).

  • pvar: Name of the phase variable column (default: “phase”).

  • decreasing: If True, lower values in Phase B are considered improvement (default: False).

  • phases: Tuple of two phases to compare (default: (“A”, “B”)).

The function prints IRD values and does not return a value.

import scia as sc
📖 scia 1.101.0.dev6 - For Documentation, visit: https://ahsankhodami.github.io/scia/intro.html

Example 1: Single-Case IRD Calculation#

# Create a single-case AB design
df = sc.create_scd(
    values=[5, 7, 8, 5, 7, 12, 16, 18, 15, 14, 19],
    phase_starts={"A": 1, "B": 6}
)

# Compute IRD
sc.ird(df)
IRD = 1.0

Example 2: Multiple-Case IRD Calculation#

# Create multiple cases
case1 = sc.create_scd(values={"A": [5, 7, 10, 5, 12], "B": [7, 10, 18, 15, 14, 19]})
case2 = sc.create_scd(values={"A": [3, 4, 5, 3], "B": [6, 7, 8, 9, 10, 11, 12]})
case3 = sc.create_scd(values={"A": [6, 8, 7, 8, 7, 8], "B": [10, 12, 13, 14, 15]})

# Compute IRD for all cases
sc.ird([case1, case2, case3])
Case 1: IRD = 0.6333333333333335
Case 2: IRD = 1.0
Case 3: IRD = 1.0
All cases Average: 0.8777777777777779

Notes#

  • IRD values range from 0 (no improvement) to 1 (maximum improvement).

  • For decreasing outcomes (where lower values indicate improvement), set decreasing=True.