```
library(scan)
library(scplot)
<- scdf(
case1 c(A = 3, 2, 4, 6, 4, 3,
B = 6, 5, 4, 6, 7, 5, 6, 8, 6, 7, 8, 9, 7, 8,
C = 6, 6, 8, 5, 7),
name = "Dustin"
)<- scdf(
case2 c(A = 0, 1, 3, 1, 4, 2, 1,
B = 2, 1, 4, 3, 5, 5, 7, 6, 3, 8, 6, 4, 7,
C = 6, 5, 6, 8, 6),
name = "Mike"
)<- scdf(
case3 c(A = 7, 5, 6, 4, 4, 7, 5, 7, 4,
B = 8, 9, 11, 13, 12, 15, 16, 13, 17, 16, 18,
C = 17, 20, 22, 18, 20),
name = "Will"
)<- c(case1, case2, case3) strange_study
```

# 1 Introduction

You will need a basic degree of familiarity with the R language. Appendix A gives a brief introduction.

Single case research has become an important and widely accepted method for gaining insight into educational processes. In particular, the field of special education has embraced single case research as an appropriate method for evaluating the effectiveness of an intervention or the developmental processes underlying problems in the acquisition of academic skills. Single case studies are also popular with teachers and educators who are interested in evaluating the learning progress of their students. Despite their usefulness, standards for conducting single-case studies, analysing the data, and presenting the results are less well developed than for group-based research designs. Furthermore, while there is a wealth of software available to help analyse data, most of it is designed to analyse group-based datasets. Visualising single case data sets often means fiddling with spreadsheets, and analysis becomes a cumbersome endeavour. This book fills that gap. It has been written around a specialised software tool for managing, visualising and analysing single case data. This tool is an extension package for the R software (R Core Team, 2023) called *scan*, an acronym for single case analysis.

## 1.1 A teaser

Before going into the details of how `scan`

works, I would like to give you an example of what you can do with `scan`

. It is meant as a teaser to get you motivated to tackle the steep learning curve associated with using `R`

(but there is a land of milk and honey behind that curve!). So, do not worry if you do not understand every detail of this example, it will all be explained and obvious to you once you become familiar with `scan`

.

Let us set a fictional context. Suppose you are researching a method to improve the arithmetic skills of struggling fourth-grade students. You have developed an intervention programme called KUNO. In a pilot study, you want to get some evidence about the effectiveness of this new method, and you set up a multi-baseline single-case study with three students who participated in the KUNO programme over a period of ten weeks. during the course, you regularly measured each student’s numeracy skills 20 times using a reliable test. You also carried out a follow-up after eight weeks with five additional measures. I am now going to make up some data for this fictitious KUNO study, because it would be too difficult to carry out a real study and actually develop a real intervention method.

We use the `scan`

package to code the data. Each case has 25 measurements. We have three phases: before the intervention (A), during the intervention (B), and a follow-up (C). Phases A and B are of different lengths. The cases are named and combined into a single object called `strange_study`

.

Now we visualize the cases:

```
scplot(strange_study) %>%
set_ylabel("Correct") %>%
set_xlabel ("Days") %>%
add_statline("lowess", color = "red") %>%
set_phasenames(c("Baseline", "Intervention", "Follow-up")) %>%
set_yaxis(limits = c(0, 30)) %>%
set_xaxis(increment = 2) %>%
add_ridge(color = "lightblue") %>%
set_theme("basic")
```

Now we need some descriptive statistics:

`describe(strange_study)`

Parameter | Dustin | Mike | Will |
---|---|---|---|

Design | A-B-C | A-B-C | A-B-C |

n A | 6 | 7 | 9 |

n B | 14 | 13 | 11 |

n C | 5 | 5 | 5 |

Missing A | 0 | 0 | 0 |

Missing B | 0 | 0 | 0 |

Missing C | 0 | 0 | 0 |

m A | 3.67 | 1.71 | 5.44 |

m B | 6.57 | 4.69 | 13.45 |

m C | 6.4 | 6.2 | 19.4 |

md A | 3.5 | 1.0 | 5.0 |

md B | 6.5 | 5.0 | 13.0 |

md C | 6 | 6 | 20 |

sd A | 1.37 | 1.38 | 1.33 |

sd B | 1.40 | 2.10 | 3.27 |

sd C | 1.14 | 1.10 | 1.95 |

mad A | 0.74 | 1.48 | 1.48 |

mad B | 1.48 | 2.97 | 4.45 |

mad C | 1.48 | 0.00 | 2.97 |

Min A | 2 | 0 | 4 |

Min B | 4 | 1 | 8 |

Min C | 5 | 5 | 17 |

Max A | 6 | 4 | 7 |

Max B | 9 | 8 | 18 |

Max C | 8 | 8 | 22 |

Trend A | 0.23 | 0.21 | -0.08 |

Trend B | 0.25 | 0.36 | 0.91 |

Trend C | 0.1 | 0.3 | 0.4 |

Note: ^{} n = Number of measurements; Missing = Number of missing values; M = Mean; Median = Median; SD = Standard deviation; MAD = Median average deviation; Min = Minimum; Max = Maximum; Trend = Slope of dependent variable regressed on measurement-time. |

Single-case data are often analysed using overlap indices. Let us get an overview by comparing phases A and B:

`overlap(strange_study)`

Statistic | Dustin | Mike | Will |
---|---|---|---|

PND | 50.00 | 53.85 | 100.00 |

PEM | 100.00 | 92.31 | 100.00 |

PET | 71.43 | 61.54 | 100.00 |

NAP | 92.86 | 87.91 | 100.00 |

NAP-R | 85.71 | 75.82 | 100.00 |

PAND | 90.00 | 80.00 | 100.00 |

IRD | 0.76 | 0.56 | 1.00 |

Tau-U (A + B - trend A) | 0.53 | 0.45 | 0.67 |

Tau-U (A + B - trend A + trend B) | 0.66 | 0.56 | 0.80 |

Base Tau | 0.60 | 0.55 | 0.74 |

Delta M | 2.90 | 2.98 | 8.01 |

Delta Trend | 0.02 | 0.14 | 0.99 |

SMD | 2.13 | 2.16 | 6.01 |

Hedges g | 2.00 | 1.51 | 2.96 |

Note: ^{} PND = Percentage Non-Overlapping Data; PEM = Percentage Exceeding the Median; PET = Percentage Exceeding the Trend; NAP = Nonoverlap of all pairs; NAP-R = NAP rescaled; PAND = Percentage all nonoverlapping data; IRD = Improvement rate difference; Tau U (A + B - trend A) = Parker's Tau-U; Tau U (A + B - trend A + trend B) = Parker's Tau-U; Base Tau = Baseline corrected Tau; Delta M = Mean difference between phases; Delta Trend = Trend difference between phases; SMD = Standardized Mean Difference; Hedges g = Corrected SMD. |

How do the changes hold up against the follow-up? Let us compare phases A and C:

`overlap(strange_study, phases = c("A", "C"))`

Statistic | Dustin | Mike | Will |
---|---|---|---|

PND | 40.00 | 100.00 | 100.00 |

PEM | 100.00 | 100.00 | 100.00 |

PET | 0.00 | 60.00 | 100.00 |

NAP | 93.33 | 100.00 | 100.00 |

NAP-R | 86.67 | 100.00 | 100.00 |

PAND | 81.82 | 100.00 | 100.00 |

IRD | 0.82 | 1.00 | 1.00 |

Tau-U (A + B - trend A) | 0.48 | 0.50 | 0.61 |

Tau-U (A + B - trend A + trend B) | 0.46 | 0.51 | 0.61 |

Base Tau | 0.67 | 0.76 | 0.74 |

Delta M | 2.73 | 4.49 | 13.96 |

Delta Trend | -0.13 | 0.09 | 0.48 |

SMD | 2.00 | 3.25 | 10.47 |

Hedges g | 1.97 | 3.25 | 8.34 |

Note: ^{} PND = Percentage Non-Overlapping Data; PEM = Percentage Exceeding the Median; PET = Percentage Exceeding the Trend; NAP = Nonoverlap of all pairs; NAP-R = NAP rescaled; PAND = Percentage all nonoverlapping data; IRD = Improvement rate difference; Tau U (A + B - trend A) = Parker's Tau-U; Tau U (A + B - trend A + trend B) = Parker's Tau-U; Base Tau = Baseline corrected Tau; Delta M = Mean difference between phases; Delta Trend = Trend difference between phases; SMD = Standardized Mean Difference; Hedges g = Corrected SMD. |

Finally, we conduct regression analyses for each cases with a piecewise regression model:

```
plm(strange_study$Dustin)
plm(strange_study$Mike)
plm(strange_study$Will)
```

Parameter | B | 2.5% | 97.5% | SE | t | p | delta R² |
---|---|---|---|---|---|---|---|

Intercept | 3.10 | 1.46 | 4.73 | 0.83 | 3.72 | <.01 | |

Trend mt | 0.23 | -0.31 | 0.77 | 0.28 | 0.83 | .41 | 0.012 |

Level phase B | 0.50 | -1.89 | 2.90 | 1.22 | 0.41 | .68 | 0.003 |

Level phase C | -1.47 | -11.11 | 8.17 | 4.92 | -0.30 | .76 | 0.002 |

Slope phase B | 0.02 | -0.54 | 0.58 | 0.28 | 0.06 | .95 | 0.000 |

Slope phase C | -0.13 | -1.02 | 0.77 | 0.46 | -0.28 | .78 | 0.001 |

Note: ^{} F(5, 19) = 7.88; p <.001; R² = 0.675; Adjusted R² = 0.589 |

Parameter | B | 2.5% | 97.5% | SE | t | p | delta R² |
---|---|---|---|---|---|---|---|

Intercept | 1.07 | -0.95 | 3.09 | 1.03 | 1.04 | .31 | |

Trend mt | 0.21 | -0.35 | 0.78 | 0.29 | 0.75 | .46 | 0.009 |

Level phase B | -0.02 | -2.98 | 2.93 | 1.51 | -0.01 | .98 | 0.000 |

Level phase C | 0.24 | -9.63 | 10.12 | 5.04 | 0.05 | .96 | 0.000 |

Slope phase B | 0.14 | -0.46 | 0.75 | 0.31 | 0.47 | .64 | 0.004 |

Slope phase C | 0.09 | -1.01 | 1.18 | 0.56 | 0.15 | .88 | 0.000 |

Note: ^{} F(5, 19) = 8.00; p <.001; R² = 0.678; Adjusted R² = 0.593 |

Parameter | B | 2.5% | 97.5% | SE | t | p | delta R² |
---|---|---|---|---|---|---|---|

Intercept | 5.78 | 3.96 | 7.60 | 0.93 | 6.23 | <.001 | |

Trend mt | -0.08 | -0.47 | 0.30 | 0.20 | -0.43 | .67 | 0.001 |

Level phase B | 3.88 | 1.16 | 6.60 | 1.39 | 2.80 | <.05 | 0.022 |

Level phase C | 14.49 | 7.89 | 21.08 | 3.37 | 4.31 | <.001 | 0.052 |

Slope phase B | 0.99 | 0.52 | 1.47 | 0.24 | 4.10 | <.01 | 0.047 |

Slope phase C | 0.48 | -0.53 | 1.49 | 0.52 | 0.94 | .36 | 0.002 |

Note: ^{} F(5, 19) = 68.16; p <.001; R² = 0.947; Adjusted R² = 0.933 |