Using R Studio (Include R Code)
A current Webster SGA polls show that for voters, 41.8% support Carol Davis, 39.2% support Josh Foster, and 19.0 % support Aaron Andrews. We conduct our own poll of 342 Walker School voters and get the following proportions: 43.1% Davis, 40.3% Foster, and 16.6% Andrews. Use the chi-squared hypothesis test to determine whether our survey is representative of typical Webster voters [point: if our survey is representative, the p-value should have us accept the Null hypothesis]
R code:
x=c(43.1,40.3,16.6)
p=c(41.8,39.2,19)
chisq.test(x, p)
Output:
Pearson's Chi-squared test
data: x and p
X-squared = 6, df = 4, p-value = 0.1991
Warning message:
In chisq.test(x, p) : Chi-squared approximation may be
incorrect
Here we don’t trust the validity of the asymptotic approximation (see Warning message), the permutation approach is actually implemented in the chisq.test() function and safer to use here.
R code:
x=c(43.1,40.3,16.6)
p=c(41.8,39.2,19)
chisq.test(x, p,simulate.p.value = TRUE, B = 10000)
Output:
Pearson's Chi-squared test with simulated p-value (based on
10000
replicates)
data: x and p
X-squared = 6, df = NA, p-value = 1
Since p-value>0.05 so we can conclude that our survey is representative of typical Webster voters.
Get Answers For Free
Most questions answered within 1 hours.