library(readxl)
library(ggplot2)

Research Question:Do students prefer tea, coffee, and soda equally?

  1. DataSetA2 Information
DatasetA2 <- read_excel("/Users/alexiaprudencio/Desktop/Applied Analytics 1/Assingment 5/DatasetA2.xlsx")

2.Frequency Table

table(DatasetA2$FavoriteDrink)
## 
## Coffee   Soda    Tea  Water 
##     26     29     28     17
  1. Bar Chart
ggplot(DatasetA2, aes(x = FavoriteDrink)) + geom_bar() + labs(x = "FavoriteDrink", y = "Frequency")

  1. Chi-Square Goodness-of-Fit Test
observed <- c(26, 29, 28, 17) 
expected <- c(.25, .25, .25, .25)
chisq.test(x = observed, p = expected)
## 
##  Chi-squared test for given probabilities
## 
## data:  observed
## X-squared = 3.6, df = 3, p-value = 0.308

5.Interpret and Report the Results A chi-square goodness-of-fit test indicated that the observed frequencies were not different from the expected frequencies, χ²(3) = 3.6, p = 0.308.