Exercise

Significance testing: one-sided versus two-sided (4)

In the last exercises we calculated a p value corresponding to a one-sided test. Given the fact that we were testing against a significance level of 0.05, we have actually found a significant result. But what if we would have done a two-sided hypothesis test?

In the instructions of the last exercise, we found a sample mean of exactly 26. When doing a one-sided hypothesis test, we find a corresponding p value of 0.04 to our z score of 1.81. If we would however do a two-sided hypothesis test, we should not only look for \(P(>1.81)\). In this case we should test for both \(P(> 1.81)\) and \(P(< -1.81)\). As such, to get the p value that corresponds to z score of 1.81 we have to sum both \(P(> 1.81)\) and \(P(< -1.81)\). As the Z distribution we are working with is symmetric, we could multiply the outcome of round(pnorm(1.81, lower.tail = FALSE), 2) by 2. This would yields a p value of 0.07 in which case we would fail to reject the null hypothesis as 0.07 is larger than 0.05.

Instructions

100 XP
  • Imagine that we found a sample mean of 25.95 with a sample size of 40. Calculate the corresponding test statistic, a z score in this case, and assign it to the variable z_value. Assume that the population mean and standard deviation are the same as described above. Round all values to two decimals.
  • Assume that we are doing a two-sided hypothesis test. Use the function pnorm() to find the corresponding p value and print this to the console. Round the obtained p value to two decimals.