This question is Question 4.2 from the textbook and has been
reproduced here. The dataset below contains the results from a poll
based on a random sample with two variables: response
,
indicating their response to the poll question, and
political
, reporting their self-reported political
ideology.
Nine-hundred and ten (910) randomly sampled registered voters from Tampa, FL were asked if they thought workers who have illegally entered the US should be (i) allowed to keep their jobs and apply for US citizenship, (ii) allowed to keep their jobs as temporary guest workers but not allowed to apply for US citizenship, or (iii) lose their jobs and have to leave the country.
## Copy and run this code to create table
immigration <- read.csv("https://collinn.github.io/data/immigrationpoll.csv")
Use the appropriate tables to answer the following questions:
What percent of these Tampa, FL voters identify themselves as conservatives?
What percent of these Tampa, FL voters are in favor of the citizenship option?
What percent of these Tampa, FL voters identify themselves as conservatives and are in favor of the citizenship option?
What percent of these Tampa, FL voters who identify themselves as conservatives are in favor of the citizenship option? What percent of moderates share this view? What percent of liberals share this view?
Do political ideology and views on immigration appear to be associated? Explain your reasoning.
This question uses the tips
dataset. Recall that the
variables are:
total_bill
Total amount spent on mealtip
total tipsex
sex of the individual paying the billsmoker
indicator of whether or not the bill payer was a
smokerday
Day of the week of the mealtime
Time of daysize
Number of people in the partytips <- read.csv("https://collinn.github.io/data/tips.csv")
Part A Using the tips
dataset,
determine which day was the least popular for diners to visit. Which day
was the most popular for having lunch?
Part B Given that a particular meal was “Dinner”, what is the probability that the person paying the bill was a male?
Part C Give the odds ratio comparing the odds of a female being a smoker compared to the odds of a male being a smoker (Hint: what value is considered an “event”?). Do sex and smoking status appear to be associated?
Part D Create the table with margin sums that best captures the information in the following plot. Be mindful of which should be the row and which should be the column.
Part E Create plot from the following table. Does there appear to be much association between
Dinner | Lunch | |
---|---|---|
No | 0.602 | 0.662 |
Yes | 0.398 | 0.338 |
The table and plots below present the results of a social survey relating individuals’ income levels with their reported sense of happiness.
Not Too Happy | Pretty Happy | Very Happy | Sum | |
---|---|---|---|---|
Above Average | 21 | 159 | 110 | 290 |
Average | 53 | 372 | 221 | 646 |
Below Average | 94 | 249 | 93 | 436 |
Part A: Of all of the individuals who have a below average income, what proportion of them report being “Pretty Happy”?
Part B Would Plot 1 or Plot 2 be more useful in answering the question: “Which income group has the highest proportion of individuals who consider themselves ‘Not too Happy’?” Justify your answer.
Part C: For Part C, we are interested in answering the question, “Is having an above average income associated with being ‘very happy’?”
In pursuit of this, your friend notes: of all of the individuals who report being “Very Happy”, over 75% of them also report having either an average or below average income. In other words, most people who are “Very Happy” are not those who make an above average income. Based on this, we can conclude that having an above average income is not associated with somebody being “Very Happy”. Is this reasoning correct? If yes, explain why it is correct; if not, explain what mistake is being made and how you would answer differently.