A restaurant sells three kinds of desserts: chocolate cake, vanilla cheesecake, and tiramisu. If all three desserts are selling equally, then the restaurant owner will keep all three desserts on the menu. However, if some desserts are less popular than others, she would like to remove those items so she can increase her profits. Analyze the data to determine if the actual distribution of the dessert preference matches the expected distribution.
# Load required library
# install.packages("readxl")
library(readxl)
# Read dataset
dataset <- read_excel("C:/Users/Nithin Kumar Adki/Downloads/RQ1.xlsx")
# Create frequency table of desserts
observed <- table(dataset$Dessert)
print(observed)
##
## Cheesecake ChocoCake Tiramisu
## 171 258 119
# Expected proportions (equal preference among 3 desserts)
expected <- c(0.30, 0.20, 0.50)
# Run Chi-Square Goodness-of-Fit Test
chisq_gfit <- chisq.test(observed, p = expected)
print(chisq_gfit)
##
## Chi-squared test for given probabilities
##
## data: observed
## X-squared = 288.88, df = 2, p-value < 2.2e-16
# Compute effect size (Cohen’s W)
W <- sqrt(chisq_gfit$statistic / sum(observed))
cat("Cohen’s W (effect size):", round(W, 3), "\n")
## Cohen’s W (effect size): 0.726