library(readxl)
library(ggpubr)
## Loading required package: ggplot2
A5Q1 <- read_excel("downloads/A5Q1-1.xlsx")
observed <- table(A5Q1$flavor)
observed
##
## Chocolate Mango Strawberry Vanilla
## 87 32 57 74
barplot(observed,
main = "flavor",
xlab = "flavor",
ylab = "count",
col = rainbow(length(observed)))
Flavor= Chocolate: 20%, Strawberry: 20%, Mango: 20%, Vanilla: 40%
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
w <- sqrt(as.numeric(chi_result$statistic) / sum (observed)) w [1] 0.4079216
A Chi-Squared Goodness of Fit was conducted to determine if there was a difference between the observed FLAVOR frequencies and the expected frequencies.
The results showed that there was a difference between the observed and expected frequencies, x²(3) = 41.6, p < .001.
The difference was moderate, (Cohen’s W = .40)