Since y = 0, we estimate the adjusted \(\pi\)
(a). Yes. Because both \(n\pi \geq 5\) and \(n(1-\pi) > 5\)
(b). Yes. p-value = 0.04829 < 0.05. The null hypothesis is rejected.
\(H_{a}: p > 0.5\)
(c). 95% CI: \(\hat{\pi} \pm 1.96\sigma_{\hat{\pi}}\) = \(0.53 \pm 0.01767767\) = [0.5123223, 0.5476777]
parameter estimates
p1 = 91/250
p2 = 53/250
n1 = 250
n2 = 250
sigma = sqrt(p1*(1-p1)/n1 + p2*(1-p2)/n2)
sigma
## [1] 0.03992794
(a). 95% CI for \(\pi_{2} - \pi_{2}\): \(\mu \pm 1.96\sigma = 0.152 \pm 1.96(0.03992794)\) = [0.07374124, 0.2302588]
(b). \(z = 3.806858 > z_{\alpha=0.01} = 2.326348\), hence reject the \(H_{0}\). Therefore, the warranty will increase the proportion of customers who will purchase a mower.
(c). Offering warranty can significantly increase the proportion of people who will purchase a mower. However, whether the dealer should offer warranty or not depends on whether the profit from the additional sales of mower can cover the cost of offering warranty.
(a).
(b). Yes. p-value = 4.204e-08 < 0.05. There is a strong evidence that the proportions of patients who experienced a significant reduction in pain are significantly different between the two treatments.
yes = c(560, 680)
no = c(440, 320)
pain_reduction = cbind(yes, no)
rownames(pain_reduction) = c("biofeedback", "NSAID")
chisq_test = chisq.test(pain_reduction)
chisq_test
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: pain_reduction
## X-squared = 30.053, df = 1, p-value = 4.204e-08
(c). 95% CI on the difference:
prop.test(pain_reduction)
##
## 2-sample test for equality of proportions with continuity
## correction
##
## data: pain_reduction
## X-squared = 30.053, df = 1, p-value = 4.204e-08
## alternative hypothesis: two.sided
## 95 percent confidence interval:
## -0.16321892 -0.07678108
## sample estimates:
## prop 1 prop 2
## 0.56 0.68
oneplus = c(10, 14, 19)
none = c(90, 86, 81)
tumors = data.frame(oneplus, none)
rownames(tumors) = c("control", "low_dose", "high_dose")
tumors
## oneplus none
## control 10 90
## low_dose 14 86
## high_dose 19 81
chisq.test(tumors)
##
## Pearson's Chi-squared test
##
## data: tumors
## X-squared = 3.3119, df = 2, p-value = 0.1909
vote_for = c(11, 41)
vote_against = c(46, 2)
vote = cbind(vote_for, vote_against)
rownames(vote) = c("democrat", "republican")
vote
## vote_for vote_against
## democrat 11 46
## republican 41 2
One of the cells in the 2x2 contigency table has very small value. The large sample assumption is invalid. So we use fisher’s exact test for testing our hypothesis.
Since p-value = 2.029e-15, we reject our null hypothesis. There is a strong evidence that the voting for Judge Thomas is NOT independent of political affiliation.
fisher.test(vote, conf.level = 0.99)
##
## Fisher's Exact Test for Count Data
##
## data: vote
## p-value = 2.029e-15
## alternative hypothesis: true odds ratio is not equal to 1
## 99 percent confidence interval:
## 0.0005700799 0.0834071130
## sample estimates:
## odds ratio
## 0.01247519
prop.vote.fit = prop.test(vote)
prop.vote.fit
##
## 2-sample test for equality of proportions with continuity
## correction
##
## data: vote
## X-squared = 53.788, df = 1, p-value = 2.233e-13
## alternative hypothesis: two.sided
## 95 percent confidence interval:
## -0.9011466 -0.6198652
## sample estimates:
## prop 1 prop 2
## 0.1929825 0.9534884