Research Question

The restaurant owner wants to determine if the actual distribution of the dessert preference matches the expected distribution.

Chosen Test: CHI-SQUARE GOODNESS OF FIT

Hyppthesis

What are the null and alternate hypotheses for your research?
H0: The observed frequencies matches the expected frequencies. The three deserts have equal distribution.
H1: The observed frequencies does not match the expected frequencies. The three deserts do not have equal distribution.

Summary of Results for Research Question 1

A Chi-Square Goodness-of-Fit Test was conducted on the categorical variable Kinds of Dessert to determine if the observed distribution of preferences among the sample differed significantly from the equal expected proportions of 33.33% for each kind. With a sample size of 548, there was a statistically significant difference between the observed and expected proportions, p-value is 2.838e-13 and X-squared (df=2, N=548) is 57.781. This indicates that the preference for the different kinds of dessert is not equal in the population. The most preferred dessert was ChocoCake, while Tiramisu was the least preferred. The effect size, calculated as Cohen’s W was 0.32, which is considered a medium size effect.

Code

LOAD THE PACKAGE

library(readxl)

IMPORT THE EXCEL FILE INTO R STUDIO

RQ1 <- read_excel("C:/Users/armil/Downloads/RQ1.xlsx")

VISUALLY DISPLAY THE DATA CREATE A FREQUENCY TABE

observed <- table(RQ1$Dessert)

VIEW YOUR FREQUENCY TABLE

print(observed)
## 
## Cheesecake  ChocoCake   Tiramisu 
##        171        258        119

VIEW THE CATEGORY ORDER

names(observed)
## [1] "Cheesecake" "ChocoCake"  "Tiramisu"

DEFINE EXPECTED PROPORTIONS

expected <- c(0.33, 0.33, 0.34)

CALCULATE CHI-SQUARED RESULTS

chisq_gfit <- chisq.test(observed, p = expected)
print(chisq_gfit)
## 
##  Chi-squared test for given probabilities
## 
## data:  observed
## X-squared = 57.781, df = 2, p-value = 2.838e-13

p-value < 0.05 so the results are of statistical significance.
DETERMINE STATISTICAL SIGNIFICANCE

chisq_result = chisq_gfit

EFFECT SIZE CODE

W <- sqrt(chisq_result$statistic / sum(observed))
W
## X-squared 
## 0.3247159