cs_results <- antidepressants |>
cs_anchor(patient, measurement, mom_di, mid_improvement = 8)
cs_results
plot(cs_results)
# Set argument "pre" to avoid a warning
cs_results <- antidepressants |>
cs_anchor(
patient,
measurement,
mom_di,
pre = "Before",
mid_improvement = 8
)
# Inlcude the MID for deterioration
cs_results_with_deterioration <- antidepressants |>
cs_anchor(
patient,
measurement,
mom_di,
pre = "Before",
mid_improvement = 8,
mid_deterioration = 5
)
cs_results_with_deterioration
summary(cs_results_with_deterioration)
plot(cs_results_with_deterioration)
# Group the results by experimental condition
cs_results_grouped <- antidepressants |>
cs_anchor(
patient,
measurement,
mom_di,
pre = "Before",
group = condition,
mid_improvement = 8,
mid_deterioration = 5
)
cs_results_grouped
summary(cs_results_grouped)
plot(cs_results_grouped)
# The plot method always returns a ggplot2 object, so the plot may be further
# modified with ggplot2 code, e.g., facetting to avoid overplotting of groups
plot(cs_results_grouped) +
ggplot2::facet_wrap(~ group)
# Compute group wise results
cs_results_groupwise <- antidepressants |>
cs_anchor(
patient,
measurement,
mom_di,
pre = "Before",
mid_improvement = 8,
target = "group"
)
cs_results_groupwise
summary(cs_results_groupwise)
plot(cs_results_groupwise)
# Group wise analysis, but split by experimentawl condition
cs_results_groupwise_condition <- antidepressants |>
cs_anchor(
patient,
measurement,
mom_di,
pre = "Before",
group = condition,
mid_improvement = 8,
target = "group"
)
cs_results_groupwise_condition
summary(cs_results_groupwise_condition)
plot(cs_results_groupwise_condition)
# Compare all groups to a predefined reference group at a predefined measurement
cs_results_groupwise_between <- antidepressants |>
cs_anchor(
patient,
measurement,
mom_di,
post = "After",
group = condition,
mid_improvement = 8,
target = "group",
effect = "between"
)
cs_results_groupwise_between
summary(cs_results_groupwise_between)
plot(cs_results_groupwise_between)
# Compare all groups to a predefined reference group with frequentist appraoch
cs_results_groupwise_between_freq <- antidepressants |>
cs_anchor(
patient,
measurement,
mom_di,
post = "After",
group = condition,
mid_improvement = 8,
target = "group",
effect = "between",
bayesian = FALSE
)
cs_results_groupwise_between_freq
summary(cs_results_groupwise_between_freq)
plot(cs_results_groupwise_between_freq)
Run the code above in your browser using DataLab