# From raw data
data("data_campus_involvement")
estimate_from_raw <- esci::estimate_pdiff_ind_contrast(
esci::data_campus_involvement,
CommuterStatus,
Gender,
contrast = c("Male" = -1, "Female" = 1)
)
# To visualize the estimate
myplot_from_raw <- esci::plot_pdiff(estimate_from_raw)
# To conduct a hypothesis test
res_htest_from_raw <- esci::test_pdiff(estimate_from_raw)
# From summary data
estimate_from_summary <- esci::estimate_pdiff_ind_contrast(
cases = c(78, 10),
ns = c(252, 20),
case_label = "egocentric",
grouping_variable_levels = c("Original", "Replication"),
contrast = c(-1, 1),
conf_level = 0.95
)
# To visualize the estimate
myplot_from_summary <- esci::plot_pdiff(estimate_from_summary)
# To conduct a hypothesis test
res_htest_from_summary <- esci::test_pdiff(estimate_from_summary)
Run the code above in your browser using DataLab