In: Statistics and Probability
A television station wishes to study the relationship between
viewership of its 11 p.m. news program and viewer age (18 years or
less, 19 to 35, 36 to 54, 55 or older). A sample of 250 television
viewers in each age group is randomly selected, and the number who
watch the station’s 11 p.m. news is found for each sample. The
results are given in the table below.
Age Group | |||||
Watch 11 p.m. News? |
18 or less | 19 to 35 | 36 to 54 | 55 or Older | Total |
Yes | 43 | 60 | 60 | 76 | 239 |
No | 207 | 190 | 190 | 174 | 761 |
Total | 250 | 250 | 250 | 250 | 1,000 |
(a) Let p1,
p2, p3, and
p4 be the proportions of all viewers in each
age group who watch the station’s 11 p.m. news. If these
proportions are equal, then whether a viewer watches the station’s
11 p.m. news is independent of the viewer’s age group. Therefore,
we can test the null hypothesis H0 that
p1, p2,
p3, and p4 are equal by
carrying out a chi-square test for independence. Perform this test
by setting α = .05. (Round your answer to 3 decimal
places.)
χ2χ2 =
so (Click to select)RejectDo not reject H0: independence
(b) Compute a 95 percent confidence interval for
the difference between p1 and
p4. (Round your answers to 3 decimal
places. Negative amounts should be indicated by a minus
sign.)
95% CI: [ , ]
We need to the hypothesis testing for the Independence of the attributes
"Age.group" and "Watch 11 PM news"
As p1, p2, p3, and p4 are the proportions of all viewers in each age group who watch the 11 p.m. news.
For each group we will be getting one proportion value.(Proportions of viewer)
We use R to solve this problem
a)
## Making data frame ready to use for chi_square test a=c(43,60,60,76,207,190,190,174) a m=data.frame("18_or_less"=c(43,207),"19-35"=c(60,190),"36-54"=c(60,190),"55_or_older"=c(76,174)) m rownames(m)=c("Yes","No") ## Chisquare test for independence cs=chisq.test(m) cs # Here we will conclude using p-value criteria # Our null hypothesis is # Ho : p1=p2=p3=p4 i.e in all age proportion is same for watching 11pm's News alpha=0.05 if (cs$p.value < alpha) {cat("Reject Ho at 5% l.o.s i.e not all proportions are same")} # i.e proportions are independent across all age groups
Output:-
> ## Making data frame ready to use for chi_square test > a=c(43,60,60,76,207,190,190,174) > a [1] 43 60 60 76 207 190 190 174 > m=data.frame("18_or_less"=c(43,207),"19-35"=c(60,190),"36-54"=c(60,190),"55_or_older"=c(76,174)) > m X18_or_less X19.35 X36.54 X55_or_older 1 43 60 60 76 2 207 190 190 174 > rownames(m)=c("Yes","No") > ## Chisquare test for independence > cs=chisq.test(m) > cs Pearson's Chi-squared test data: m X-squared = 11.98, df = 3, p-value = 0.00745 > # Here we will conclude using p-value criteria > # Our null hypothesis is > # Ho : p1=p2=p3=p4 i.e in all age proportion is same for watching 11pm's News > alpha=0.05 > if (cs$p.value < alpha) + {cat("Reject Ho at 5% l.o.s i.e not all proportions are same")} Reject Ho at 5% l.o.s i.e not all proportions are same> # i.e proportions are independent across all age groups
b)
############# Confidence interval for (p1-p4)################ n=250 p1=43/250;p1 p4=76/250;p4 d=p1-p4;d lower.CL=round(d-1.96*sqrt((p1*(1-p1))/n+(p4*(1-p4))/n),3) lower.CL upper.CL=round(d+1.96*sqrt((p1*(1-p1))/n+(p4*(1-p4))/n),3) upper.CL Confidence.Interval=cat("95% CI:","[",lower.CL,"to",upper.CL,"]") # This will be the 95 % CI for the difference between p1-p4
Output:-
> ############# Confidence interval for (p1-p4)################ > n=250 > p1=43/250;p1 [1] 0.172 > p4=76/250;p4 [1] 0.304 > d=p1-p4;d [1] -0.132 > > lower.CL=round(d-1.96*sqrt((p1*(1-p1))/n+(p4*(1-p4))/n),3) > lower.CL [1] -0.206 > > upper.CL=round(d+1.96*sqrt((p1*(1-p1))/n+(p4*(1-p4))/n),3) > upper.CL [1] -0.058 > Confidence.Interval=cat("95% CI:","[",lower.CL,"to",upper.CL,"]") 95% CI: [ -0.206 to -0.058 ]> # This will be the 95 % CI for the difference between p1-p4