Question 1: Ice Cream Purchases

library(readxl)

A5Q1_1 <- read_excel("C:/Users/wmacklin/Downloads/A5Q1-1.xlsx")

table(A5Q1_1$flavor)
## 
##  Chocolate      Mango Strawberry    Vanilla 
##         87         32         57         74
barplot(table(A5Q1_1$flavor))

chisq.test(
  table(A5Q1_1$flavor),
  p = c(0.20, 0.20, 0.20, 0.40)
)
## 
##  Chi-squared test for given probabilities
## 
## data:  table(A5Q1_1$flavor)
## X-squared = 41.6, df = 3, p-value = 4.878e-09

A chi-square goodness-of-fit test was conducted to compare the observed frequencies of ice cream purchases with the expected distribution (20% chocolate, 20% strawberry, 20% mango, and 40% vanilla). The results indicated a statistically significant difference between the observed and expected distributions, χ²(3) = 41.60, p < .001. Therefore, the pattern of ice cream purchases did not match the expected distribution.