title: “Corrected A5Q1 rmd File” author: “Alea Salgado” date: “2026-07-27” output: html_document

library(readxl)
library(ggpubr)
## Loading required package: ggplot2
A5Q1 <- read_excel("C:/Users/aleat/Downloads/A5Q1-1.xlsx")
observed <- table(A5Q1$flavor)

observed Chocolate Mango Strawberry Vanilla 87 32 57 74

barplot(observed, main = "Ice Cream Purchases", xlab = "Flavor", ylab = "Count", col = rainbow(length(observed)))

expected <- c(.20, .20, .20, .40)
chi_result <- chisq.test(x = observed, p = expected)

X-squared = 41.6, df = 3, p-value = 4.878e09.

W <- sqrt(as.numeric(chi_result$statistic) / sum(observed))

W = 0.4079216 A Chi-Square Goodness of Fit test was conducted to determine if there was a difference between the observed ice cream flavor frequencies and the expected frequencies. The results showed that there was a difference between the observed and expected frequencies, χ² (3) = 41.6, p < .001. The difference was moderate, (Cohen’s W = .41).