Introduction

This is my first R Markdown document. This report presents the results of a Chi-Square Goodness-of-Fit Test conducted to examine whether participants’ cake type preferences (Cheesecake, ChocoCake, Tiramisu) differed from expected proportions based on a theoretical distribution.

Method

The expected proportions were set at 30% for Cheesecake, 20% for ChocoCake, and 50% for Tiramisu. Data were collected from 548 participants and analyzed using RStudio.

R Code

library(readxl)

# Import dataset
RQ1 <- read_excel("C:/Users/dadal/Downloads/RQ1.xlsx")


# Create frequency table
observed <- table(RQ1$Dessert)

# Define expected proportions
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
# Calculate effect size
W <- sqrt(chisq_gfit$statistic / sum(observed))
W
## X-squared 
## 0.7260573