A private all-girls elementary school has developed two different uniform designs: Design A and Design B. They are hoping at least one of the designs will be preferred by both mothers and fathers. We want to determine if there is a relationship between uniform design and parent.
# Load required libraries
library(readxl)
library(lsr)
# Import the Excel dataset
dataset <- read_excel("C:/Users/Nithin Kumar Adki/Downloads/RQ2.xlsx")
# Create a contingency table
contingencytable <- table(dataset$Parent, dataset$Preferred_Design)
print(contingencytable)
##
## A B
## Father 21 29
## Mother 31 19
# Run Chi-Square Test of Independence
chisq_indep <- chisq.test(contingencytable)
print(chisq_indep)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: contingencytable
## X-squared = 3.2452, df = 1, p-value = 0.07163
# Calculate Cramer's V (effect size)
cramers_v <- cramersV(contingencytable)
cat("Cramer's V (effect size):", round(cramers_v, 3), "\n")
## Cramer's V (effect size): 0.18