# From raw data (summary data mode not available for this function)
example_data <- data.frame(
pretest = c(
19, 18, 19, 20, 17, 16, 16, 10, 12, 9, 13, 15
),
posttest = c(
18, 19, 20, 17, 20, 16, 19, 16, 16, 14, 16, 18
),
condition = as.factor(
c(
rep("Control", times = 6),
rep("Treated", times = 6)
)
)
)
estimates <- esci::estimate_mdiff_2x2_mixed(
data = example_data,
outcome_variable_level1 = pretest,
outcome_variable_level2 = posttest,
grouping_variable = condition,
repeated_measures_name = "Time"
)
# To visualize the estimated mean difference for the interaction
myplot <- esci::plot_mdiff(estimates$interaction, effect_size = "mean")
# Line-plot of the interaction with fan effect representing each simple-effect CI
plot_interaction_line_CI <- esci::plot_interaction(
estimates,
show_CI = TRUE
)
# To conduct a hypothesis test
res_htest_from_raw <- esci::test_mdiff(
estimates$interaction,
effect_size = "mean"
)
Run the code above in your browser using DataLab