obs_freq <- c(146, 57, 208, 89)
claimed_props <- c(0.25, 0.15, 0.40, 0.20)
expected_freq <- sum(obs_freq) * claimed_props
chi2_stat <- sum((obs_freq - expected_freq)^2 / expected_freq)
critical_value <- qchisq(0.99, df = 4 - 1)
cat("Test Statistic:", chi2_stat, "\n") cat("Critical Value:", critical_value, "\n")
if (chi2_stat > critical_value) { cat("Reject the null hypothesis. The observed frequencies are not consistent with the claimed proportional market share.\n") } else { cat("Fail to reject the null hypothesis. The observed frequencies are consistent with the claimed proportional market share.\n") }