library(readxl)
library(ggplot2)
library(rcompanion)
DatasetB1 <- read_excel("C:/Users/Leyav/Downloads/DatasetB2.xlsx")
tab <- table(DatasetB1$StudentType, DatasetB1$PetOwnership)
tab
##
## No Yes
## Domestic 27 25
## International 23 25
ggplot(DatasetB1, aes(x =StudentType, fill =PetOwnership)) +
geom_bar(position = "dodge") +
labs(
x = "Student type",
y = "Frequency",
title = "Petownership by Studenttype"
) +
theme(
text = element_text(size = 14),
axis.title = element_text(size = 14),
axis.text = element_text(size = 14),
plot.title = element_text(size = 14),
)
chisq.test(tab)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: tab
## X-squared = 0.040064, df = 1, p-value = 0.8414
p-value = 0.8414 that means the data is not significant, hence Cramer’s V (Effect Size) test is not required.
The Chi-Square Test of Independence indicated there was not a significant association between petownership and student type, χ²(1) = 0.040, p = .841.