• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Nov 19th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. ## Problem 1 KC
2.
3. **Open source textbook:** A professor using an open source introductory statistics book predicts that 60% of the students will purchase a hard copy of the book, 25% will print it out from the web, and 15% will read it online. At the end of the semester he asks his students to complete a survey where they indicate what format of the book they used. Of the 126 students, 71 said they bought a hard copy of the book, 30 said they printed it out from the web, and 25 said they read it online.
4.
5. a) State the hypotheses for testing if the professor’s predictions were inaccurate.
6.
7. Ha : 60% of students do not purchase a hard copy.
8.      25% do not print out from the web.
9.      15% do not read it online
10.
11. b) How many students did the professor expect to buy the book, print the book, and read the book exclusively online?
12.
13. {r}
14. problem_1Total = 126
15. Hardcopy1 = round(0.6 * problem_1Total)
16. Printout1 = round(0.25 * problem_1Total)
17. Online1 = round(0.15 * problem_1Total)
18.
19.
20. 
21.
22. Expected:
23.
24. Hardcopy : r Hardcopy1
25.
26. Printout : r Printout1
27.
28. Online : r Online1
29.
30. c) This is an appropriate setting for a chi-square test. List the conditions required for a test and verify they are satisfied.
31.
32. Likely independent.
33.
34. n>5 for each category.
35.
36. (3-1) = 2. df > 1
37.
38.
39. d) Calculate the chi-squared statistic, the degrees of freedom associated with it, and the p-value.
40.
41. {r}
42. calculatingHardcopy1 <- (71 - Hardcopy1)^2 / Hardcopy1
43. calculatingPrintout1 <- (30 - Printout1)^2 / Printout1
44. calculatingOnline1 <- (25 - Online1)^2 / Online1
45.
46. calculatingFinal <- calculatingHardcopy1 + calculatingPrintout1 + calculatingOnline1
47.
48. #calculatingFinal
49.
50. pvald <- pchisq(calculatingFinal, 2)
51.
52. 
53.
54. chi-squared statistic is r calculatingFinal
55.
56. degrees of freedom is 2
57.
58. p-value is r pvald
59.
60.
61. e) Based on the p-value calculated in part (d), what is the conclusion of the hypothesis test? Interpret your conclusion in this context.
62.
63. Since the p-value is larger than the alpha, there is insufficient evidence to conclude that the professor's results are inaccurate.
64.
65.
66.
67. ## Problem 2 KC
68.
69. **Full Body Scan:** The table below summarizes a data set we first encountered in Assignment 6 regarding views on full-body scans and political affiliation. The differences in each political group may be due to chance. Complete the following computations under the null hypothesis of independence between an individual’s party affiliation and his support of full-body scans. It may be useful to first add on an extra column for row totals before proceeding with the computations.
70.
71. {r}
72. data("full.body.scan")
73. kable(table(full.body.scan))
74. str(full.body.scan)
75.
76.
77.
78. problem_2should <- 299 + 351 + 264
79. problem_2shouldnot <- 55 + 77 + 38
80. problem_2dontknow <- 15 + 22 + 16
81.
82. problem_2totalpeople <- problem_2should + problem_2shouldnot + problem_2dontknow
83.
84. problem_2republican <- 16 + 264 + 38
85. problem_2democrat <- 15 + 299 + 55
86. problem_2independent <- 22 + 351 + 77
87.
88.
89. 
90.
91.
92. a) How many Republicans would you expect to not support the use of full-body scans?
93.
94. {r}
95. (problem_2shouldnot / problem_2totalpeople) * problem_2republican
96. 
97.
98. b) How many Democrats would you expect to support the use of full-body scans?
99. {r}
100. (problem_2should / problem_2totalpeople) * problem_2democrat
101. 
102.
103.
104. c) How many Independents would you expect to not know or not answer?
105. {r}
106. (problem_2dontknow / problem_2totalpeople) * problem_2independent
107. 
108.
109. d) Test for an association between political party and preference of body scans with $\alpha = 0.05$.
110.
111. {r}
112.
113. testingproblem2 = table(full.body.scan$answer, full.body.scan$party.affiliation)
114. chisq.test(testingproblem2)
115.
116. 
117.
118. The p-value is higher than the set alpha. Fail to reject Ho.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top