Research Question 1

Do US voters have more respect for the police or for journalists?

Introduce your topic briefly. (5 points)

Potential variables:

  • ftpolice – How would you rate the police?

  • ftjournal – How would you rate journalists?

Perform an exploratory data analysis (EDA) of the relevant variables. (5 points)

First, exploratory analysis on ftpolice (Police rating)

##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00   47.00   70.00   64.68   90.00  100.00

According to CLT, we know the sample mean of police rating is approximately normal, but I still want to see if it is true by doing simulation sampling

Now, exploratory analysis on ftjournal (Journal Rating)

##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   -7.00   21.00   52.00   52.26   82.00  100.00

Notice that ftpolice and ftjournal are not at the same data scales, so we need to normalize the data as follow:

Now compute the difference between the police rating and journal rating for every voter (in normalized scale)

Based on your EDA, select an appropriate hypothesis test. (5 points)

\(H_0:\) The mean difference between the police and the journalists rating equals to zero

\(H_a:\) The mean difference between the police and the journalists rating does not equal to zero

## [1] 1

Conduct your test. (5 points)

Since this is a survey, we should sample the data and run the paired t-test

## 
##  One Sample t-test
## 
## data:  diff_A[subset]
## t = 6.2138, df = 749, p-value = 8.58e-10
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  0.06424714 0.12359162
## sample estimates:
##  mean of x 
## 0.09391938

But if we only sample once, we may encounter some sampling error, so we so sample and run our paired t-test many many times to see how many times that we would reject our null hypothesis

## [1] 9859

Research Question 2

Are Republican voters older or younger than Democratic voters?

Introduce your topic briefly. (5 points)

Potential Variables:

  • birthyr birthyr: profile data: Birth Year

  • pid7x: Party ID Summary

    • 1&3 = Dem

    • 5&7 = Rep

Based on your EDA, select an appropriate hypothesis test. (5 points)

\(H_0:\) the mean age of dem equals to the mean age of rep

\(H_a:\) the mean age of dem does not equal to the mean age of rep

Conduct your test. (5 points)

Like what we did in question 1, we perform the hypothesis testing many many times to see how often we reject the null hypothesis.

## [1] 0.6017