Assignment 5 Question 1 - Is there a difference between the current distribution of ice cream purchases versus the expected ice cream flavor distribution?
corrections in total surround the idea of the concepts learned in assignment 4 corrections after lectures were updated.
library(ggpubr)
## Loading required package: ggplot2
library(readxl)
A5Q1_1 <- read_excel("A5Q1-1.xlsx")
create observed table
observed <- table(A5Q1_1$flavor)
observed
##
## Chocolate Mango Strawberry Vanilla
## 87 32 57 74
Create the barchat of the observed data above corrections made to the main title from distribution of flavors to ice cream purchases
barplot(observed,
main = "Ice Cream Purchases",
xlab = "Flavor",
ylab = "Count",
col = rainbow(length (observed)))
Create expected scores below
expected <- c(.20, .20, .20, .40)
conduct the chi-square goodness of fit test
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
conduct the calculations effect size
w <- sqrt(as.numeric(chi_result$statistic) / sum(observed))
w
## [1] 0.4079216
Data Interpretation
A Chi-Square Goodness of Fit test was conducted to determine if there was a difference between the observed [flavors] 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).
one correction was for the second decimal place for the Cohen’s W = .41 when I had .4 originally.