HomeworkTemplate

docx

School

University of Massachusetts, Amherst *

*We aren’t endorsed by this school

Course

240

Subject

Aerospace Engineering

Date

Jan 9, 2024

Type

docx

Pages

6

Uploaded by ProfessorQuail3820

Report
HW9 Millstone Mia 33198442 12/04/23 Question 1 chi.square.island <- chisq.test ( table (my_sample $ island), p = c ( 1 / 3 , 1 / 3 , 1 / 3 )) chi.square.island ## ## Chi-squared test for given probabilities ## ## data: table(my_sample$island) ## X-squared = 4.27, df = 2, p-value = 0.1182 chi.square.island $ expected ## Blick Nanspucket Plume ## 66.66667 66.66667 66.66667 chi.square.island $ observed ## ## Blick Nanspucket Plume ## 57 63 80 The degrees of freedom is 2, with the p-value being 0.1182, meaning we fail to reject the null using .05 alpha level. Additionally, all of the islands were off from the expected in their observed values, being 9.6, 3.6 and 13.33 differences respectively. Question 2 chi.square.color <- chisq.test ( table (my_sample $ color), p = c ( 1 / 2 , 1 / 2 )) chi.square.color ## ## Chi-squared test for given probabilities ## ## data: table(my_sample$color) ## X-squared = 30.42, df = 1, p-value = 3.479e-08 chi.square.color $ expected ## Blue Pink ## 100 100 chi.square.color $ observed
## ## Blue Pink ## 61 139 The degrees of freedom here is one, and we can reject the null hypothesis using a .05 alpha level. You can see this with both observed numbers being largely different from the number expected if the null hypothesis was true. Question 3 For another testing method, we could’ve done an anova test.We couldn’t have used this for question one because both variables were categorical. Question 4 chi.square.island.politics <- chisq.test (my_sample $ island, my_sample $ politics) chi.square.island.politics ## ## Pearson's Chi-squared test ## ## data: my_sample$island and my_sample$politics ## X-squared = 95.072, df = 4, p-value < 2.2e-16 chi.square.island.politics $ expected ## my_sample$politics ## my_sample$island Democrulite Independone Republicant ## Blick 20.805 18.24 17.955 ## Nanspucket 22.995 20.16 19.845 ## Plume 29.200 25.60 25.200 chi.square.island.politics $ observed ## my_sample$politics ## my_sample$island Democrulite Independone Republicant ## Blick 11 9 37 ## Nanspucket 45 6 12 ## Plume 17 49 14 barplot (chi.square.island.politics $ observed, beside = T, legend.text = T, ylim = c ( 0 , 80 ))
The null hypothesis is that there is no relationship between politics and island in this population. We reject the null looking at the p-value using the .05 alpha method. The df is 4, and that is because the forumula is df=(r-1)(c-1) and here its df=(3-1)(3-1), which is 4. Each island seems to have one party that is the largest there: Blick with Republicant, Nanspucket with Democrulite and Plume with Independone. Also Plume seems to have the largest population of the Islands in general, with 80 counted her compared to Blick’s 57 and Nanspucket’s 63. ## Question 5 chi.square.island.college <- chisq.test (my_sample $ island, my_sample $ college) chi.square.island.college ## ## Pearson's Chi-squared test ## ## data: my_sample$island and my_sample$college ## X-squared = 9.8524, df = 6, p-value = 0.131 chi.square.island.college $ expected ## my_sample$college ## my_sample$island Callisto Europa Ganymede Io ## Blick 15.39 14.82 15.105 11.685 ## Nanspucket 17.01 16.38 16.695 12.915 ## Plume 21.60 20.80 21.200 16.400 chi.square.island.college $ observed
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
## my_sample$college ## my_sample$island Callisto Europa Ganymede Io ## Blick 14 9 20 14 ## Nanspucket 14 21 18 10 ## Plume 26 22 15 17 barplot (chi.square.island.college $ observed, beside = T, legend.text = T, ylim = c ( 0 , 80 )) The null hypothesis is that there is no relationship between college and island in this population. We fail to reject the null looking at the p-value using the .05 alpha method. The df is 6, and that is because the forumula is df=(r-1)(c-1) and here its df=(4-1)(3-1), which is 6. Here the values across islands are fairly equal for each school, with Plume the most at each college except for Ganymede, with both other islands having more. Question 6 Based on these results I expect there to be minimal relation between college and politcal affiliaton. chi.square.college.politics <- chisq.test (my_sample $ college, my_sample $ politics) chi.square.college.politics ## ## Pearson's Chi-squared test ##
## data: my_sample$college and my_sample$politics ## X-squared = 6.8129, df = 6, p-value = 0.3385 chi.square.college.politics $ expected ## my_sample$politics ## my_sample$college Democrulite Independone Republicant ## Callisto 19.710 17.28 17.010 ## Europa 18.980 16.64 16.380 ## Ganymede 19.345 16.96 16.695 ## Io 14.965 13.12 12.915 chi.square.college.politics $ observed ## my_sample$politics ## my_sample$college Democrulite Independone Republicant ## Callisto 19 22 13 ## Europa 24 12 16 ## Ganymede 18 15 20 ## Io 12 15 14 barplot (chi.square.college.politics $ observed, beside = T, legend.text = T, ylim = c ( 0 , 30 )) The null hypothesis is that there is no relationship between college and island in this population. We fail to reject the null looking at the p-value using the .05 alpha method. The df is 6, and that is because the forumula is df=(r-1)(c-1) and here its df=(4-1)(3-1), which is 6.
Question 7 An example of a study that used chi-square tests is this study on Hepatitis B virus infection, using the chi-sqaured statistic to cross examine patient records to find what factors could have a role in surival or succumbing to the disease. The tests showed that age and gender were not independent, and that there was an association between those factors and survival of patients. https://iopscience.iop.org/article/10.1088/1742-6596/1734/1/012010/pdf
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help