library(tidyverse)
library(mosaic)
library(rio)
library(ggplot2)
<- import('https://raw.githubusercontent.com/byuistats/Math221D_Cannon/master/Data/StarWarsData_clean.csv') sw
Who Shot First?
Categorical Data Application Activity
Introduction
Use the Star Wars dataset to answer the following questions:
- Do less than 20% of respondents feel Very Favorably towards Emperor Palpatine? (1-sample Z test for proportion)
- What is the difference in proportions of females and males who are Very Favorable towards Jar-Jar Binks? (2-sample Proportion)
- Come up with one other 2-sample proportion test using anything from the Star Wars dataset.
- Test to see if income and response to “Which Character Shot First?” are Independent (Chi-square)
For the proportion tests:
- Define the null and alternative hypotheses
- Include an explanation and conclusion for hypothesis tests
- Include Confidence intervals and a sentence explaining each
- Check the requirements for the hypothesis test and the confidence intervals
For the Chi-square test:
- Define the null and alternative hypotheses
- Include an explanation of the conclusion for
- Be sure to check the hypothesis requirements for a test of independence
Report
Turn in the HTML file created when you knit/render the rmd file.
Data and Analysis
Load the data
Explore the data
names(sw)
[1] "Are You a Fan of SW?" "Favorability_Han Solo"
[3] "Favorability_Luke Skywalker" "Favorability_Princess Leia Organa"
[5] "Favorability_Anakin Skywalker" "Favorability_Obi Wan Kenobi"
[7] "Favorability_Emperor Palpatine" "Favorability_Darth Vader"
[9] "Favorability_Lando Calrissian" "Favorability_Boba Fett"
[11] "Favorability_C-3P0" "Favorability_R2 D2"
[13] "Favorability_Jar Jar Binks" "Favorability_Padme Amidala"
[15] "Favorability_Yoda" "who_shot_first"
[17] "Familiar_with_expanded_universe" "are_you_a_fan_of_expanded_universe"
[19] "fan_of_star_trek" "Gender"
[21] "Age" "Household.Income"
[23] "Education" "Location"
table(sw$`Favorability_Han Solo`)
5
Neither favorably nor unfavorably (neutral)
44
Somewhat favorably
151
Somewhat unfavorably
8
Unfamiliar (N/A)
15
Very favorably
610
Very unfavorably
1
addmargins(table(sw$`Favorability_Han Solo`, sw$Gender))
Female Male Sum
0 2 3 5
Neither favorably nor unfavorably (neutral) 1 22 21 44
Somewhat favorably 4 71 76 151
Somewhat unfavorably 1 3 4 8
Unfamiliar (N/A) 0 9 6 15
Very favorably 10 289 311 610
Very unfavorably 0 0 1 1
Sum 16 396 422 834
addmargins(table(sw$`Favorability_Emperor Palpatine`))
20
Neither favorably nor unfavorably (neutral)
213
Somewhat favorably
143
Somewhat unfavorably
68
Unfamiliar (N/A)
156
Very favorably
110
Very unfavorably
124
Sum
834
One-sample Proportion Test
What proportion of respondents are very favorable towards Emperor Palpatine?
Is this significantly less than 20%?
Two-sample Proportion Test
What percent of female respondents are favorable towards Jar-Jar Binks?
What percent of male respondents are favorable towards Jar-Jar Binks?
Are they significantly different?
Choose your own adventure
Compare 2 proportions of your choosing and perform a prop.test()
.
Chi-square Test for Independence
Test to see if how you responded to the question “Who Shot First” is independent of income category.
State your conclusion: