In: Statistics and Probability
A survey of 175 state representatives is conducted to see whether their opinions on a bill related to their party affiliation. The following data are obtained.
Opinion
Party Approve Disapprove No opinion
Republican 30 15 10
Democrat 40 20 15
Independent 10 15 20
a). Input the data into R.
b). Use R to get a barplot representing the percentage
of three parties’ opinion.
c). Conduct Chi-Square test to see whether the data suggest that the opinions are related to party affiliations.
d). Make your decision at 5% significance level.
Applied stats 2 r code questions
The R output is:
The R code is:
x <- matrix(c(30,40,10,15,20,15,10,15,20),nrow =
3)
barplot(x)
chisq.test(x)
The barplot is:
The hypothesis being tested is:
H0: The opinions are not related to party affiliations
Ha: The opinions are related to party affiliations
The p-value is 0.002871.
Since the p-value (0.002871) is less than the significance level (0.05), we can reject the null hypothesis.
Therefore, we can conclude that the opinions are related to party affiliations.
Please give me a thumbs-up if this helps you out. Thank you!