-b. In the pie chart there is not much that is easier to see than in the bar chart. You can see that some categories are nearly equal but, without numbers, it is not readily apparent if they are the same relative frequency or just very similar.

-c. I would prefer the bar chart, because it provides more information (i.e. numbers for relative frequency, easier comparisons, full titles) than the pie chart does.

-a.

# percent of residents surveyed who identify as conservative.
c<-372/910

0.4087912 proportion of people in Tampa, FL who were surveyed identify themselves as conservative.

-b.

# percent of residents surveyed who are in favor of citizenship.
cit<-278/910

0.3054945 proportion of people surveyed are in favor of citizenship.

-c.

# percent of residents surveyed who identify as conservative and are in favor of the citizenship option.
and<-57/910

0.0626374 proportion of people surveyed both identify as conservative and are in favor of the citizenship option.

-d.

# percent of conservatives who agree with the citizenship option.
cons<-57/372
# percent of moderates who agree with the citizenship option.
mods<-120/363
# percent of liberals who agree with the citizenship option.
libs<-101/175

Within the sample, 0.1532258 proportion of conservatives agree with the citizenship option, while 0.3305785 and 0.5771429 proportion of moderates and liberals, respectively, agree with the citizenship option.

-e. Political ideology and views on immigration do not appear to be independent, as it is clear that views on citizenship and being forced to leave are related to political self-identification.

-f. Mosaic plot of Q. 1.48 table

#Creating talbe of the data
Q48 <- matrix(c(57,120,101,121,113,28,179,126,45,15,4,1),ncol=3,byrow=TRUE)
#Naming columns in the table
colnames(Q48) <- c("Conservative","Moderate","Liberal")
#Naming rows in the table
rownames(Q48) <- c("Citizen","Guest","Leave","Not sure")
#Creating mosaic plot from the data in the table
mosaicplot(Q48,main="Mosaic Plot of Views on Immigration Based on Political Affiliation",color=c("red","blue","green"))

-a. False. The number of patients who have cardiovascular problems while taking each drug does not determine which drug causes more cardiovascular problems, as more patients are taking the drug pioglitazone overall, which accounts for some of the reason why more patients on this drug would have cardiovascular problems, especially since the study was only conducted with patients age 65 or older as this age group would be more likely to have cardiovascular problems than other age groups even without the influence of these two medications.

-b. True, but the difference in the rates of cardiovascular disease while taking each drug are very similar.

-c. False. That a higher percentage patients on this drug experienced cardiovascular problems than the percentage of patients who had problems on the other drug does not prove that the drug causes serious cardiovascular problems. Again, at least some of these cases are probably due to the age of the study participants. Even without that factor, the relatively low percent of patients who experienced problems on the drug does not suggest that it causes serious problems.

-d. True.

-a. 10 times. In a smaller sample size it would be more likely to get greater than 60% heads than it would in a larger sample size based on the law of large numbers. 100 flips would, most likely, result in a relatively even number of heads and tails; in any case it would be more likely to give a 50/50 result than the small sample size of 10 flips.

-b. 10 times, with the same reasoning. With a smaller sample size the chance of getting less than 40% heads would be higher than if you flipped the coin 100 times because of the law of large numbers. 100 flips would, most likely, result in a relatively even number of heads and tails; in any case it would be more likely to give a 50/50 result than the small sample size of 10 flips.

-c. 100 times because, based on the law of large numbers, heads and tails would occur at relatively the same frequency, resulting in a percent of heads between 40% to 60%. With 10 flips, it would be less likely that you would flip either 4, 5, or 6 heads to result in the 40-60% range.

-d. 10 flips. While it is still unlikely that you will get three or fewer heads when flipping 10 times, it is even more unlikely that you would get less than 30% heads when flipping the coin 100 times based on the law of large numbers.

-a. No, because 11% of people responded as being both independent and swing votes. The two occur at the same time, so they cannot be mutually exclusive

-c. Independent but not swing = Independent - Independent and Swing

#Independent, Independent and Swing, Independent but not Swing
I <- 0.35
IS <- 0.11
InoS=(I-IS)

0.24 proportion of voters are independent but not swing voters

-d. Independent or Swing = Independent + Swing - Independent and Swing

#Independent, Swing, Independent and Swing, Independent or Swing
I <- 0.35
S <- 0.23
IS <- 0.11
IorS=(I+S-IS)

0.47 proportion of voters are Independent or Swing voters

-e. Neither independent nor swing = 1 - independent - swing

#Independent, Swing, Neither
I<-0.35
S<-0.23
N=(1-I-S)

0.42 proportion of people surveyed are neither independent nor swing voters

-f. The event that someone is a swing voter is independent of their being an Independent because knowing that someone is an Independent provides little information regarding their status as a Swing voter.

-a. Independent because (it is reasonable to assume that) the grade of one student does not affect the grade of the other student.

-b. Neither. They are not independent because there is most likely a correlation between studying together and both receiving the same grade. They are not disjoint because the same grade was received.

-c. If two events occur at the same time they do not have to be dependent, as seen in part a of this question. Both students received A’s, but this does not mean that one student getting an A was dependent upon the other also getting an A. This is, kind of, an example of two events occurring at the same time due to chance.

-a. If the first question she gets right is the fifth question, then she would get the other four questions wrong. The probability of getting any question wrong is 3/4. Concomitantly, the probability of getting any question right is 1/4.

#Probability of getting the first 4 questions wrong
X<-(3/4)^4

The probability of getting the first four questions wrong is 0.3164062. She then still has a 1/4 chance of getting the fifth question correct.

#Probability of getting only the fifth question correct
C<-(X*(1/4))

So, the probability that the fifth question is the first question she answers correctly is 0.0791016.

-b. The probability of getting one question right is 1/4 because there is one right answer and 4 possible choices. So, the probability of getting all five questions right would be (1/4)^5

#Probability of getting all 5 questions right.
Q<-(1/4)^5

The probability of getting all five questions right is 9.76562510^{-4}.

-c. To find what the probability of getting at least one question right, we can use the probability of getting all of the questions wrong, because that is an easier probability to calculate.

#Probability of getting each question wrong, given that 3 of 4 answers for each of the 5 questions are wrong.
W<-(3/4)^5

The probability of getting all questions wrong is 0.2373047. Because the probability of getting all of the questions wrong and the probability of getting at least one question right are the only possible outcomes of guessing on all 5 questions, the events are complementary. And because the events are complementary we know that their probabilities add up to 1.

#Probability of getting at least one question right.
R<-(1-W)

So, the probability of getting at least one question right is 1-W, or 0.7626953.

-a. The probability that a randomly chosen male has at least a Bachelor’s degree would be the sum of the probability of a male having a Bachelor’s degree (0.16) and the probability of his having any degree higher than that, which, in this case, is a graduate or professional degree (0.09).

#Probability of male having at least Bachelor's degree
M<-0.16+0.09

So the probability of a male having at least a Bachelor’s degree is 0.25.

-b. To find the probability that a randomly chosen woman has at least a Bachelor’s degree, we would use the same logic as in part a, taking the probability of a Bachelor’s degree (0.17) plus the probability of a higher degree (0.09).

#Probability of female having at least a Bachelor's degree
F<-0.17+0.09

So the probability of a woman having at least a Bachelor’s degree is 0.26.

-c. The probability of a man and a woman getting married and both having at least a Bachelor’s degree would be the product of a man having at least a Bachelor’s degree and a woman having at least a Bachelor’s degree, both of which were calculated in parts a and b. This scenario would assume that education level would be a random variable when considering couples getting married (i.e. any two random individuals could theoretically get married regardless of their educational background).

#Probability of getting married and both man and woman having at least a Bachelor's degree.
Hitched<-(M*F)

So the probability of a man and a woman getting married and both having at least a Bachelor’s degree is 0.065.

-d. The assumption that education level would not affect the chances that a random man and a random woman would get married is unlikely. Most often we associate with people from similar backgrounds to ourselves, meaning that, most likely, the chances of a man with at least a Bachelor’s degree and a woman with at least a Bachelor’s degree getting married would probably be higher than 0.065, as was estimated in part c. This assumption would mean that the likelihood of a woman with a professional degree marrying a man with less than a 9th grade education would be nearly as likely as two people with at least Bachelor’s degrees getting married. The assumption does not take social or socioeconomic factors into account.