library(readxl)
A4Q1 <- read_excel("C:/Users/annke/OneDrive - Saint Louis University/AA 5221/Assignment 4/A4Q1.xlsx")
observed <-table(A4Q1$flavor)
observed
## 
##  Chocolate      Mango Strawberry    Vanilla 
##         87         32         57         74
barplot(observed,
        main = "Ice Cream Flavors August 2026",
        xlab = "Ice Cream Flavors",
        ylab = "Count",
        col = rainbow(length(observed)))

expected <- c(.20, .20, .20, .40)
chi_result <- chisq.test(x = observed, p = expected)
chi_result
## 
##  Chi-squared test for given probabilities
## 
## data:  observed
## X-squared = 41.6, df = 3, p-value = 4.878e-09
# A Chi-Square Goodness-of-Fit test was conducted to determine if there was a difference between the observed Ice Cream Flavors frequencies and the expected frequencies.
# The results showed that there was not a difference between the observed and expected frequencies, x2(3) = 41.6, p = >.05.
# The difference was small and not statistically significant, so there was no need to calculate a Cohen's W test.