## Scores on a letter naming task were collected on eleven days in a row.
## The intervention started after the fifth measurement,
## so the first B phase measurement was 6 (B_start = 6).
klaas <- scdf(
c(5, 7, 8, 5, 7, 12, 16, 18, 15, 14, 19),
B_start = 6, name = "Klaas"
)
describe(klaas)
# Alternative coding 1:
klaas <- scdf(
c(A = 5, 7, 8, 5, 7, B = 12, 16, 18, 15, 14, 19),
name = "Klaas"
)
# Alternative coding 2:
klaas <- scdf(
c(5, 7, 8, 5, 7, 12, 16, 18, 15, 14, 19),
phase_design = c(A = 5, B = 6), name = "Klaas"
)
# Alternative coding 3:
klaas <- scdf(
c(5, 7, 8, 5, 7, 12, 16, 18, 15, 14, 19),
phase_starts = c(A = 1, B = 7), name = "Klaas"
)
## Unfortunately in a similar study there were no data collected on
## days 3 and 9. Use NA to pass them to the function:
emmi <- scdf(c(5, 7, NA, 5, 7, 12, 16, 18, NA, 14, 19),
phase_design = c(A = 5, B = 6), name = "Emmi"
)
describe(emmi)
## In a MBD over three cases, data were collected eleven days in a row.
## Intervention starting points differ between subjects as they were
## randomly assigned. The three SCDFs are then combined in a list for
## further conjoined analyses.
charlotte <- scdf(c(A = 5, 7, 10, 5, 12, B = 7, 10, 18, 15, 14, 19))
theresa <- scdf(c(A = 3, 4, 3, 5, B = 7, 4, 7, 9, 8, 10, 12))
antonia <- scdf(c(A = 9, 8, 8, 7, 5, 7, B = 6, 14, 15, 12, 16))
mbd <- c(charlotte, theresa, antonia)
names(mbd) <- c("Charlotte", "Theresa", "Antonia")
overlap(mbd)
## In a classroom-based intervention it was not possible to measure outcomes
## every day, but only on schooldays. The sequence of measurements is passed
## to the package by using a vector of measurement times.
frida <- scdf(
c(A = 3, 2, 4, 2, 2, 3, 5, 6, B = 8, 10, 8, 12, 14, 13, 12),
mt = c(1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18)
)
summary(frida)
describe(frida)
## example with two independent variables and four phases
jim <- scdf(
zvt = c(47, 58, 76, 63, 71, 59, 64, 69, 72, 77, 76, 73),
d2 = c(131, 134, 141, 141, 140, 140, 138, 140, 141, 140, 138, 140),
phase_design = c(A1 = 3, B1 = 3, A2 = 3, B2 = 3), dvar = "zvt"
)
overlap(jim, phases = list(c("A1", "A2"), c("B1", "B2")))
Run the code above in your browser using DataLab