Exercise

Comparing two proportions (4)

The last step in the process is to calculate the p value associated with the Z value and to compare it to the critical cut-off point. To calculate this, you can use the pnorm() function again. In order to check whether this p value is small enough to reject our null hypothesis, we first have to know two things:

What is the significance level against which we are testing?

Are we doing a one-sided or two-sided hypothesis test?

In this exercise, we are going to be testing against a significance level of 0.01. We are also going to do a two-sided hypothesis test. If you are using a significance level of 0.01, a two-tailed test allots half of your alpha to testing the statistical significance in one direction and half of your alpha to testing statistical significance in the other direction. This means that .005 is in each tail of the distribution of your test statistic. If you would sum both tails, you would end up having a total significance level of 0.01. Using the pnorm() function to calculate a p value that is associated with a z value, you only calculate the p value in 1 of the tails. If you do a two-sided hypothesis test, you would therefore need to multiply this p value by 2.

Instructions

100xp

You can use the pnorm() function the following way: pnorm(q, lower.tail = FALSE). In this case the q parameter is your z value.

Calculate the associated p value with our z value multiplied by 2. Assign this to the object p_value.

Would you reject the null hypothesis that there is not difference between the proportion of male and female left-wing voters? Assign either "rejected" or "not rejected" to the variable conclusion