#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.

Install the Required Packages

install.packages(“readxl”) install.packages(“ggplot2”)

Open the Installed Packages

library(readxl)
library(ggplot2)

Import and Name Dataset

DatasetB2 <- read_excel("/Users/sharathnallaganti/Desktop/2nd sem/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.

Create a Frequency Table

table(DatasetB2$PetOwnership) # for pet ownership
## 
##  No Yes 
##  50  50
table(DatasetB2$StudentType)  # for Student type
## 
##      Domestic International 
##            52            48

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.

Create a Bar Chart

ggplot(DatasetB2, aes(x = StudentType, fill = PetOwnership)) +geom_bar(position = "dodge") +labs(x = "Student Type", y = "Frequency")

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.

Conducting the Chi-Square Test of Independence

chisq.test(table(DatasetB2$PetOwnership, DatasetB2$StudentType))
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  table(DatasetB2$PetOwnership, DatasetB2$StudentType)
## X-squared = 0.040064, df = 1, p-value = 0.8414

A Chi-Square Test of Independence was conducted to examine whether student type and pet ownership were associated.

The results of the test were as follows:

χ²(1) = 0.04

p = .841

“A chi-square test of independence indicated that the observed frequencies were not different from the expected frequencies, χ²(1) = 0.04, p = .841.”

Interpretation of Results

The Chi-Square Test of Independence indicated that the observed frequencies were not significantly different from the expected frequencies, χ²(1) = 0.04, p = .841. Because the p-value was greater than the alpha level of .05, the null hypothesis was not rejected.

This result indicates that there is no statistically significant association between student type and pet ownership. In other words, whether a student is Domestic or International does not appear to influence whether they own a pet.

Final Conclusion

There was no significant association between student type and pet ownership. Domestic and International students were equally likely to report owning a pet. Any observed differences in pet ownership between the two groups are likely due to random variation rather than a meaningful association.