#Chi-Square Test of Independence Report
Introduction
The purpose of this analysis was to determine whether there is an association between student type (Domestic vs. International) and pet ownership (Yes vs. No). Because both variables are categorical, a Chi-Square Test of Independence was the appropriate statistical test.
A Chi-Square Test of Independence evaluates whether two categorical variables are related or associated with one another. This test does not require assumptions of normality, as categorical data cannot be normally distributed.
library(readxl)
library(ggplot2)
library(rcompanion)
DatasetB2 <- read_excel("C:/Users/susmi/Downloads/DatasetB2.xlsx")
Data Description
The dataset (DatasetB2) consisted of responses from 100 students. The variable PetOwnership indicated whether a student owned a pet (Yes or No), and the variable StudentType categorized students as Domestic or International.
tab <- table(DatasetB2$StudentType, DatasetB2$PetOwnership)
Frequency tables showed that pet ownership was evenly split, with 50 students reporting owning a pet and 50 reporting not owning a pet. Student type was also relatively balanced, with 52 Domestic students and 48 International students.
ggplot(DatasetB2, aes(x = StudentType, fill = PetOwnership)) +
geom_bar(position = "dodge") +
labs(
x = "StudentType",
y = "Frequency",
title = "PetOwnership by Students"
) +
theme(
text = element_text(size = 14),
axis.title = element_text(size = 14),
axis.text = element_text(size = 14),
plot.title = element_text(size = 14),
legend.position = "none"
)
A bar chart was generated to visually compare pet ownership between Domestic and International students. The bar chart showed similar patterns of pet ownership across both student groups, suggesting little to no difference between them.
chisq.test(tab)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: tab
## X-squared = 0.040064, df = 1, p-value = 0.8414
cramerV(tab)
## Cramer V
## 0.04003