A Gallup Poll released in December 2010 asked 1019 adults living in the Continental U.S. about their belief in the origin of humans. These results, along with results from a more comprehensive poll from 2001 (that we will assume to be exactly accurate), are summarized in the table below:

(a) Calculate the actual number of respondents in 2010 that fall in each response category.
(b) State hypotheses for the following research question: have beliefs on the origin of human life changed since 2001?
(c) Calculate the expected number of respondents in each category under the condition that the null hypothesis from part (b) is true.
(d) Conduct a chi-square test and state your conclusion.
Solution:
(a)
prop<-c(0.38,0.16,0.40,0.06)
freq<-round(1019*prop,0) # Observed frequency
freq
[1] 387 163 408 61
The actual number of respondent in 2010 that fall in each response category is $387, 163, 408, 61$.
(b) The origin of human life does not chaged since 2001. That is $H_0 : p_1= 0.37, p_2= 0.12, p_3=0.45, p_4= 0.06$
(c)
prop.null<-c(0.37,0.12,0.45,0.06)
prop.null
[1] 0.37 0.12 0.45 0.06
expt.freq<-1019*prop.null
expt.freq
[1] 377.03 122.28 458.55 61.14
The expected number of respondents in each category under the condition that the null hypothesis is true is $377.03, 122.28, 458.55, 61.14$.
(d)
options(scipen=7) ## to display numbers in 7 digit format
result1<-chisq.test(freq, p = prop.null)
result1
Chi-squared test for given probabilities
data: freq
X-squared = 19.397, df = 3, p-value = 0.0002263
The test statistic is $\chi^2 = 19.3965$ and the $p$-value is $0.0002263$.
Because the $p$-value is less than 0.05, we reject the null hypothesis.