Exercise

# Significance testing: one-sided versus two-sided (3)

In the last exercises we saw that there are different cut-off values for one-sided and two-tailed hypothesis tests. You saw that in order to reject the null hypothesis when performing a two-tailed hypothesis, you would need to pass a higher threshold. In this exercise and the exercise to come, we will calculate probabilities based on sample means.

Let's go back to our example of scandinavian hipsters. Here we had a population mean of 25 and a population standard deviation of 3.5. Because we were taking samples of 40 subjects from this population, we were actually working with the standard error which was 3.5 / \(\sqrt{40}\). Imagine we found a sample mean of exactly 26 and a corresponding Z score of 1.81. Whether this result is significant depends on the test we do. If we would do a one-sided hypothesis test against a 5% significance level, we would only have to test for the effect in one direction. As such, we could check the following: \(P(>1.81)\). In order to do this, we could use our `pnorm()`

function which calculates a probability that corresponds to a quantile or z score. We could use it in the following way: `pnorm(1.81, lower.tail = FALSE)`

. We set the lower tail equal to `FALSE`

because `pnorm()`

calculates the cumulative probability until the value of 1.81 and we want to know the probability of finding a value of 1.81 or larger. The functions yields a p value of 0.035 which is smaller 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`

. Look at the hint if you have forgotten the formula to calculate a z score. Assume that the population mean and standard deviation are the same as described above. Round all values in this exercise to two digits. - Use the
`pnorm()`

function to find the probability of finding a sample mean as large or more extreme and store this in the variable`p_value`

. Round all values in this exercise to two digits. - Print the variable
`p_value`

to the console.