# FALLBACK LOGICif(!exists("raw_data")) {# Sample Data if run independently raw_data <-data.frame(gender =sample(c("Male", "Female"), 50, replace =TRUE),anxiety_score =rnorm(50, 20, 5) )}# 1. Run T-Test# We use standard base R t.test for simplicity, formatted with a tidy approach if broom is available# For this course consistency, we likely want straightforward outputt_result <-t.test(anxiety_score ~ gender, data = raw_data)# 2. Print Resultprint(t_result)
Welch Two Sample t-test
data: anxiety_score by gender
t = 0.093899, df = 44.085, p-value = 0.9256
alternative hypothesis: true difference in means between group Female and group Male is not equal to 0
95 percent confidence interval:
-3.200920 3.513786
sample estimates:
mean in group Female mean in group Male
20.95978 20.80334
# 3. APA Style Reporting (Optional automated text)# "There was a significant difference between groups (t(df) = x.xx, p = .xxx)..."