library(tidyverse)
library(psych)
library(mediation)
library(knitr)
library(kableExtra)
setwd("/Users/anjalisingh/Downloads/")
raw <- read_csv(
"#294906_+'2(form;+assigned)+x+2(severity;+assigned)'_June+5,+2026_08.32.csv",
skip = 0
)
df <- raw %>%
filter(!is.na(participantId) & participantId != "") %>%
filter(Deb == 1, E_AC == -3, R_AC == 3) %>%
mutate(across(c(E1, E2, E3, R1, R2, R3), as.numeric)) %>%
mutate(
E_AVG = (E1 + E2 + E3) / 3,
R_AVG = (R1 + R2 + R3) / 3,
Cond2_d = ifelse(Cond2 == "Pill", 1, 0),
Cond1_d = ifelse(Cond1 == "S", 1, 0),
MC_D = as.numeric(MC_D),
MC_F = as.numeric(MC_F),
Sev = as.numeric(Sev),
FP1 = as.numeric(FP1),
FP2 = as.numeric(FP2),
FP_AVG = (FP1 + FP2) / 2
)
Sample & Scale Reliability
Sample Size
cat("Total rows after cleaning:", nrow(df))
## Total rows after cleaning: 483
df %>%
count(Cond1, Cond2) %>%
rename(Severity = Cond1, Format = Cond2, N = n) %>%
kable(caption = "Cell sizes after attention check exclusions") %>%
kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE)
Cell sizes after attention check exclusions
|
Severity
|
Format
|
N
|
|
NS
|
Gum
|
125
|
|
NS
|
Pill
|
114
|
|
S
|
Gum
|
112
|
|
S
|
Pill
|
132
|
Cronbach’s Alpha
alpha_E <- psych::alpha(df[, c("E1", "E2", "E3")])
alpha_R <- psych::alpha(df[, c("R1", "R2", "R3")])
tibble(
Scale = c("Efficacy (E1-E3)", "Risk (R1-R3)"),
`raw alpha` = c(round(alpha_E$total$raw_alpha, 3),
round(alpha_R$total$raw_alpha, 3)),
`std alpha` = c(round(alpha_E$total$std.alpha, 3),
round(alpha_R$total$std.alpha, 3)),
`avg r` = c(round(alpha_E$total$average_r, 3),
round(alpha_R$total$average_r, 3))
) %>%
kable(caption = "Scale reliability") %>%
kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE)
Scale reliability
|
Scale
|
raw alpha
|
std alpha
|
avg r
|
|
Efficacy (E1-E3)
|
0.974
|
0.974
|
0.925
|
|
Risk (R1-R3)
|
0.936
|
0.937
|
0.831
|
Manipulation Checks
Severity MC
t_s <- t.test(Sev ~ Cond1, data = df)
cat(sprintf("Sev: t(%.1f) = %.3f, p < .001\n", t_s$parameter, t_s$statistic))
## Sev: t(468.3) = -27.781, p < .001
plot_sev <- df %>%
group_by(Cond1) %>%
summarise(M = mean(Sev, na.rm = TRUE),
SE = sd(Sev, na.rm = TRUE) / sqrt(n()), .groups = "drop")
ggplot(plot_sev, aes(x = Cond1, y = M, fill = Cond1)) +
geom_bar(stat = "identity", width = 0.5) +
geom_errorbar(aes(ymin = M - SE, ymax = M + SE), width = 0.15) +
geom_hline(yintercept = 0, linetype = "dashed", color = "grey50") +
scale_fill_manual(values = c("NS" = "#CC79A7", "S" = "#009E73")) +
scale_x_discrete(labels = c("NS" = "Non-Severe", "S" = "Severe")) +
labs(title = "Perceived Severity by Condition",
subtitle = paste0("t(", round(t_s$parameter, 1), ") = ",
round(t_s$statistic, 2), ", p < .001"),
x = "Severity Condition", y = "Mean Perceived Severity (Sev)") +
theme_classic(base_size = 13) +
theme(legend.position = "none")

Main Effects: DVs
Risk Perception (R_AVG)
mod_R2 <- lm(R_AVG ~ Cond1_d * Cond2_d, data = df)
summary(mod_R2)
##
## Call:
## lm(formula = R_AVG ~ Cond1_d * Cond2_d, data = df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.2753 -0.9419 -0.1607 1.0581 4.0853
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.0853 0.1299 -8.355 7.1e-16 ***
## Cond1_d 0.5794 0.1890 3.066 0.00229 **
## Cond2_d 0.6146 0.1881 3.268 0.00116 **
## Cond1_d:Cond2_d 0.1666 0.2649 0.629 0.52966
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.452 on 479 degrees of freedom
## Multiple R-squared: 0.1063, Adjusted R-squared: 0.1007
## F-statistic: 18.99 on 3 and 479 DF, p-value: 1.186e-11
plot_df <- df %>%
group_by(Cond1, Cond2) %>%
summarise(M = mean(R_AVG, na.rm = TRUE),
SE = sd(R_AVG, na.rm = TRUE) / sqrt(n()), .groups = "drop")
ggplot(plot_df, aes(x = Cond1, y = M, color = Cond2, group = Cond2)) +
geom_point(size = 3) +
geom_line(linewidth = 1) +
geom_errorbar(aes(ymin = M - SE, ymax = M + SE), width = 0.1) +
scale_color_manual(values = c("Gum" = "#E69F00", "Pill" = "#0072B2"),
labels = c("Gum" = "Gummy", "Pill" = "Pill")) +
scale_x_discrete(labels = c("NS" = "Non-Severe", "S" = "Severe")) +
labs(title = "Effect of Severity and Format on Risk Perception",
x = "Condition Severity", y = "Mean Risk Perception (R_AVG)",
color = "Format") +
theme_classic(base_size = 13) +
theme(legend.position = "top")

Efficacy Perception (E_AVG)
mod_E <- lm(E_AVG ~ Cond1_d * Cond2_d, data = df)
summary(mod_E)
##
## Call:
## lm(formula = E_AVG ~ Cond1_d * Cond2_d, data = df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.9524 -0.7879 0.1228 1.0476 2.3653
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.6347 0.1130 5.615 3.33e-08 ***
## Cond1_d 0.3177 0.1644 1.932 0.0539 .
## Cond2_d 0.2425 0.1636 1.482 0.1390
## Cond1_d:Cond2_d -0.4070 0.2305 -1.766 0.0781 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.264 on 479 degrees of freedom
## Multiple R-squared: 0.00867, Adjusted R-squared: 0.002461
## F-statistic: 1.396 on 3 and 479 DF, p-value: 0.2431
plot_df_E <- df %>%
group_by(Cond1, Cond2) %>%
summarise(M = mean(E_AVG, na.rm = TRUE),
SE = sd(E_AVG, na.rm = TRUE) / sqrt(n()), .groups = "drop")
ggplot(plot_df_E, aes(x = Cond1, y = M, color = Cond2, group = Cond2)) +
geom_point(size = 3) +
geom_line(linewidth = 1) +
geom_errorbar(aes(ymin = M - SE, ymax = M + SE), width = 0.1) +
scale_color_manual(values = c("Gum" = "#E69F00", "Pill" = "#0072B2"),
labels = c("Gum" = "Gummy", "Pill" = "Pill")) +
scale_x_discrete(labels = c("NS" = "Non-Severe", "S" = "Severe")) +
labs(title = "Effect of Severity and Format on Efficacy Perception",
x = "Condition Severity", y = "Mean Efficacy Perception (E_AVG)",
color = "Format") +
theme_classic(base_size = 13) +
theme(legend.position = "top")

Fair Price (FP_AVG)
mod_FP <- lm(FP_AVG ~ Cond1_d * Cond2_d, data = df)
summary(mod_FP)
##
## Call:
## lm(formula = FP_AVG ~ Cond1_d * Cond2_d, data = df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.1491 -1.1491 0.0114 1.3897 3.4520
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.4520 0.1531 -2.952 0.00331 **
## Cond1_d 0.5234 0.2227 2.350 0.01918 *
## Cond2_d 0.6011 0.2217 2.711 0.00694 **
## Cond1_d:Cond2_d -0.6839 0.3123 -2.190 0.02901 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.712 on 479 degrees of freedom
## Multiple R-squared: 0.01846, Adjusted R-squared: 0.01232
## F-statistic: 3.003 on 3 and 479 DF, p-value: 0.03016
plot_df_FP <- df %>%
group_by(Cond1, Cond2) %>%
summarise(M = mean(FP_AVG, na.rm = TRUE),
SE = sd(FP_AVG, na.rm = TRUE) / sqrt(n()), .groups = "drop")
ggplot(plot_df_FP, aes(x = Cond1, y = M, color = Cond2, group = Cond2)) +
geom_point(size = 3) +
geom_line(linewidth = 1) +
geom_errorbar(aes(ymin = M - SE, ymax = M + SE), width = 0.1) +
scale_color_manual(values = c("Gum" = "#E69F00", "Pill" = "#0072B2"),
labels = c("Gum" = "Gummy", "Pill" = "Pill")) +
scale_x_discrete(labels = c("NS" = "Non-Severe", "S" = "Severe")) +
labs(title = "Effect of Severity and Format on Fair Price",
x = "Condition Severity", y = "Mean Fair Price (FP_AVG)",
color = "Format") +
theme_classic(base_size = 13) +
theme(legend.position = "top")
