14  Exporting scan results

The export function call

export(object, …)

The export function will make it easier to convert the results of your scan analyses into tables and descriptions you can add to your documents and presentations. Basically, export takes a scan object and converts it to an html-table or latex output.

Note

export it build on top of the knitr and kableextra packages. The list provided in the kable_options argument is implemented in the kable function of knitr and the list provided to the kable_styling_options is implemented in the kable_styling command of the kableExtra package. export sets some defaults for these functions but you can play around and overwrite them.

export works best when used within an rmarkdown file and/or within RStudio. In RStudio, the html table will be displayed in the Viewer pane. There you can click the export button () to export an html or bitmap file or you can try drag and drop ➡️ copy and paste the table into another application.

Alternatively, you can set the filename argument to export the table directly from within the export function. The file name extension you provide will define the resulting file format (e.g. filename = "results.html"). Possible extensions are html, png, and jpg.

If you need more control on the output parameters, use the save_kable() function from the kableExtra package.

exampleAB |> 
  overlap() |> 
  export() |> 
  kableExtra::save_kable("my_file.png", zoom = 4)

Most of the tables will have a default caption and footnotes. If you want to change these, use the caption and footnote arguments.

14.1 Single case data files

The scdf export function call

export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), cols, …)

export(exampleA1B1A2B2_zvt)
Single case data frame with three cases
Tick
Trick
Track
zvt d2 day part zvt d2 day part zvt d2 day part
47 131 1 A1 51 100 1 A1 54 89 1 A1
58 134 2 A1 58 126 2 A1 57 116 2 A1
76 141 3 A1 70 130 3 A1 51 114 3 A1
63 141 4 B1 65 130 4 B1 61 131 4 B1
71 140 5 B1 67 137 5 B1 57 132 5 B1
59 140 6 B1 63 133 6 B1 53 130 6 B1
64 138 7 A2 64 136 7 A2 58 128 7 A2
69 140 8 A2 70 137 8 A2 57 131 8 A2
72 141 9 A2 70 135 9 A2 60 130 9 A2
77 140 10 B2 68 128 10 B2 55 129 10 B2
76 138 11 B2 69 137 11 B2 58 118 11 B2
73 140 12 B2 70 138 12 B2 58 131 12 B2

14.2 Descriptive stats

The describe export function call

export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), flip = FALSE, …)

res <- describe(GruenkeWilbert2014)
export(res)
Descriptive statistics
n
Missing
M
Median
SD
MAD
Min
Max
Trend
Case Design A B A B A B A B A B A B A B A B A B
Anton A-B 4 14 0 0 5.00 9.14 5 9 0.82 0.77 0.74 1.48 4 8 6 10 -0.40 0.03
Bob A-B 7 11 0 0 3.00 8.82 3 9 0.82 0.87 1.48 0.00 2 7 4 10 0.04 0.04
Paul A-B 6 12 0 0 3.83 8.83 4 9 0.75 0.72 0.74 0.74 3 8 5 10 -0.26 0.02
Robert A-B 8 10 0 0 4.12 8.90 4 9 0.83 0.99 1.48 1.48 3 7 5 10 -0.06 -0.14
Sam A-B 5 13 0 0 4.60 9.08 5 9 0.55 0.86 0.00 1.48 4 8 5 10 0.10 0.03
Tim A-B 4 14 0 0 3.00 9.00 3 9 0.82 0.96 0.74 1.48 2 7 4 10 -0.60 0.00
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.

14.3 Standardized mean differences

The smd export function call

export(object, caption = NA, footnote = NA, filename = NA, select = c(“Case”, Mean A = “mA”, Mean B = “mB”, SD A = “sdA”, SD B = “sdB”, SD Cohen = “sd cohen”, SD Hedges = “sd hedges”, “Glass’ delta”, “Hedges’ g”, “Hedges’ g correction”, “Hedges’ g durlak correction”, “Cohen’s d”), kable_styling_options = list(), kable_options = list(), round = 2, flip = FALSE, …)

smd(exampleAB) |> export(flip = TRUE)
Standardizes mean differences. Comparing phase 1 against phase 2
Statistic Johanna Karolina Anja
Mean B 74.13 73.47 74.07
SD A 2.41 6.83 3.05
SD B 8.94 9.76 7.57
SD Cohen 6.55 8.43 5.77
SD Hedges 7.97 9.19 6.83
Glass' delta 8.11 3.17 6.71
Hedges' g 2.45 2.36 3.00
Hedges' g correction 2.35 2.26 2.87
Hedges' g durlak correction 2.23 2.14 2.72
Cohen's d 2.98 2.57 3.55
Note: SD Cohen = unweigted average of the variance of both phases; SD Hedges = weighted average of the variance of both phases with a degrees of freedom correction; Glass' delta = mean difference divided by the standard deviation of the A-phase; Hedges' g = mean difference divided by SD Hedges; Hedges' g (durlak) correction = approaches for correcting Hedges' g for small sample sizes; Cohens d = mean difference divided by SD Cohen.

14.4 Trend analysis

The trend export function call

export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), round = 2, …)

exampleABC$Marie %>%
  trend() %>%
  export()
Trend analysis
Phase Intercept B Beta
Linear
ALL 55.16 0.61 0.39
A 60.62 -1.92 -0.70
B 74.85 -0.61 -0.16
C 68.87 -0.19 -0.05
Quadratic
ALL 59.13 0.02 0.33
A 57.94 -0.21 -0.71
B 73.22 -0.04 -0.10
C 68.49 -0.02 -0.04

14.5 Overlap indices

The overlap export function call

export(object, caption = NA, footnote = NULL, filename = NA, kable_styling_options = list(), kable_options = list(), round = 2, flip = FALSE, …)

exampleA1B1A2B2_zvt %>%
  select_phases(A = c(1,3), B = c(2,4)) %>%
  overlap() %>%
  export(flip = TRUE)
Overlap indices. Comparing phase 1 against phase 2
Statistic Tick Trick Track
PND 16.67 0.00 16.67
PEM 66.67 50.00 50.00
PET 66.67 33.33 33.33
NAP 68.06 51.39 58.33
NAP-R 36.11 2.78 16.67
PAND 66.67 50.00 66.67
IRD 0.33 0.33 0.17
Tau-U (A + B - trend A) 0.07 -0.16 -0.04
Tau-U (A + B - trend A + trend B) 0.14 0.03 -0.03
Base Tau 0.27 -0.25 0.13
Delta M 5.50 3.17 0.83
Delta Trend -0.31 -1.10 -0.74
SMD 0.52 0.40 0.26
Hedges g 0.56 0.50 0.26
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.

tau_u(exampleAB_decreasing) |> export()

14.6 Tau-U

The tauu export function call

export(object, caption = NA, footnote = NA, filename = NA, select = “auto”, kable_styling_options = list(), kable_options = list(), meta = TRUE, …)

Set the argument meta = TRUE (the default) to get the results of the meta analysis or set meta = FALSE to get a table with each case.

tau_u(exampleAB_decreasing) |> export()
Overall Tau-U
Model Tau U se CI lower CI upper z p
A vs. B -0.98 0.14 -0.99 -0.96 -16.04 <.001
A vs. B - Trend A -0.59 0.14 -0.74 -0.38 -4.82 <.001
A vs. B + Trend B -0.58 0.14 -0.73 -0.37 -4.72 <.001
A vs. B + Trend B - Trend A -0.53 0.14 -0.70 -0.31 -4.21 <.001
Note: Method is ' complete '. Analyses based on Kendall's Tau b . 95 % CIs for tau are reported.
tau_u(exampleAB_decreasing) |> export(meta = FALSE)
Tau-U analyses
Case Model Tau CI lower CI upper Z p
Peter
A vs. B -0.98 -0.99 -0.94 -3.53 <.001
Trend A -0.29 -0.86 0.59 -0.90 .36
Trend B -0.10 -0.62 0.47 -0.49 .62
A vs. B - Trend A -0.57 -0.81 -0.18 -3.18 <.01
A vs. B + Trend B -0.55 -0.80 -0.14 -3.23 <.01
A vs. B + Trend B - Trend A -0.48 -0.76 -0.05 -2.96 <.01
Tony
A vs. B -0.98 -0.99 -0.95 -3.63 <.001
Trend A -0.18 -0.79 0.60 -0.62 .53
Trend B -0.09 -0.63 0.51 -0.41 .68
A vs. B - Trend A -0.58 -0.82 -0.19 -3.28 <.01
A vs. B + Trend B -0.57 -0.81 -0.18 -3.37 <.001
A vs. B + Trend B - Trend A -0.50 -0.77 -0.08 -3.09 <.01
Bruce
A vs. B -0.98 -0.99 -0.94 -3.38 <.001
Trend A 0.07 -0.79 0.83 0.19 .85
Trend B -0.33 -0.73 0.24 -1.64 .10
A vs. B - Trend A -0.61 -0.83 -0.22 -3.34 <.001
A vs. B + Trend B -0.62 -0.83 -0.24 -3.69 <.001
A vs. B + Trend B - Trend A -0.60 -0.82 -0.21 -3.67 <.001
Note: Method is ' complete '. Analyses based on Kendall's Tau b . 95 % CIs for tau are reported.

14.7 Piecewise linear models

The plm export function call

export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), nice = TRUE, …)

res <- plm(exampleA1B1A2B2$Pawel)
export(res)
Piecewise-regression model predicting variable 'values'
CI(95%)
Parameter B 2.5% 97.5% SE t p delta R²
Intercept 12.69 6.18 19.20 3.32 3.82 <.01
Trend mt 0.22 -1.00 1.44 0.62 0.36 .72 0.001
Level phase B1 16.28 6.31 26.26 5.09 3.20 <.01 0.118
Level phase A2 1.48 -18.81 21.76 10.35 0.14 .88 0.000
Level phase B2 11.46 -20.49 43.40 16.30 0.70 .48 0.006
Slope phase B1 -1.41 -3.13 0.32 0.88 -1.60 .12 0.029
Slope phase A2 -1.10 -2.83 0.62 0.88 -1.25 .21 0.018
Slope phase B2 -1.08 -2.81 0.64 0.88 -1.23 .22 0.017
Note: F(7, 32) = 7.86; p <.001; R² = 0.632; Adjusted R² = 0.552

14.8 Hierarchical piecewise regressions

The hplm export function call

export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), round = 2, nice = TRUE, …)

exampleAB_50 %>%
  add_l2(exampleAB_50.l2) %>%
  hplm(lr.test = TRUE, random.slopes = TRUE) %>%
  export()
Hierarchical Piecewise Linear Regression predicting variable 'values'
Predictors B SE df t p
Intercept 48.21 1.4 1328 34.5 <.001
Trend mt 0.62 0.11 1328 5.52 <.001
Level phase B 13.87 0.89 1328 15.51 <.001
Slope phase B 0.86 0.12 1328 7.43 <.001

Random effects
SD L df p
Intercept 9.35 348.85 4 <.001
Trend mt 0.1 0.83 4 .93
Level phase B 4.54 42.82 4 <.001
Slope phase B 0.13 0.76 4 .94
Residual 4.97 NA NA NA

Model
AIC 8693.2
BIC 8771.7
ICC 0.29 L = 339 p <.001
Note: Estimation method ML; Slope estimation method: W; first; 50 cases.

14.9 Power analyses

The power_test export function call

export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), …)

design <- design(
  n = 1, phase_design = list(A = 6, B = 9),
  rtt = 0.8, level = 1.4, trend = 0.05
)
set.seed(124)
power_test(design, n_sim = 10) |> export()
Test power in percent
Method Power Alpha Error Alpha:Beta Correct
plm_level 80 10 1:2.0 85
rand 90 30 1:0.3 80
tauU 100 10 1:0.0 95