SHARE

TWEET

# Untitled

a guest
Nov 19th, 2019
98
Never

**Not a member of Pastebin yet?**

**, it unlocks many cool features!**

__Sign Up__- ## Problem 1 KC
- **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.
- a) State the hypotheses for testing if the professorâ€™s predictions were inaccurate.
- Ha : 60% of students do not purchase a hard copy.
- 25% do not print out from the web.
- 15% do not read it online
- b) How many students did the professor expect to buy the book, print the book, and read the book exclusively online?
- ```{r}
- problem_1Total = 126
- Hardcopy1 = round(0.6 * problem_1Total)
- Printout1 = round(0.25 * problem_1Total)
- Online1 = round(0.15 * problem_1Total)
- ```
- Expected:
- Hardcopy : `r Hardcopy1`
- Printout : `r Printout1`
- Online : `r Online1`
- c) This is an appropriate setting for a chi-square test. List the conditions required for a test and verify they are satisfied.
- Likely independent.
- n>5 for each category.
- (3-1) = 2. df > 1
- d) Calculate the chi-squared statistic, the degrees of freedom associated with it, and the p-value.
- ```{r}
- calculatingHardcopy1 <- (71 - Hardcopy1)^2 / Hardcopy1
- calculatingPrintout1 <- (30 - Printout1)^2 / Printout1
- calculatingOnline1 <- (25 - Online1)^2 / Online1
- calculatingFinal <- calculatingHardcopy1 + calculatingPrintout1 + calculatingOnline1
- #calculatingFinal
- pvald <- pchisq(calculatingFinal, 2)
- ```
- chi-squared statistic is `r calculatingFinal`
- degrees of freedom is 2
- p-value is `r pvald`
- e) Based on the p-value calculated in part (d), what is the conclusion of the hypothesis test? Interpret your conclusion in this context.
- Since the p-value is larger than the alpha, there is insufficient evidence to conclude that the professor's results are inaccurate.
- ## Problem 2 KC
- **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.
- ```{r}
- data("full.body.scan")
- kable(table(full.body.scan))
- str(full.body.scan)
- problem_2should <- 299 + 351 + 264
- problem_2shouldnot <- 55 + 77 + 38
- problem_2dontknow <- 15 + 22 + 16
- problem_2totalpeople <- problem_2should + problem_2shouldnot + problem_2dontknow
- problem_2republican <- 16 + 264 + 38
- problem_2democrat <- 15 + 299 + 55
- problem_2independent <- 22 + 351 + 77
- ```
- a) How many Republicans would you expect to not support the use of full-body scans?
- ```{r}
- (problem_2shouldnot / problem_2totalpeople) * problem_2republican
- ```
- b) How many Democrats would you expect to support the use of full-body scans?
- ```{r}
- (problem_2should / problem_2totalpeople) * problem_2democrat
- ```
- c) How many Independents would you expect to not know or not answer?
- ```{r}
- (problem_2dontknow / problem_2totalpeople) * problem_2independent
- ```
- d) Test for an association between political party and preference of body scans with $\alpha = 0.05$.
- ```{r}
- testingproblem2 = table(full.body.scan$answer, full.body.scan$party.affiliation)
- chisq.test(testingproblem2)
- ```
- 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.