Understand the parallel between p-values and critical values
Be able to perform a one-sided or two-sided hypothesis test using the critical value method
Understand the link between t-scores and critical values
Last week we saw that, to perform a hypothesis test, we need to:
Identify the null hypothesis, denoted \(H_0\).
Identify the alternative hypothesis, denoted \(H_1\).
Select the significance level, denoted \(\alpha\). Typical values are 0.1, 0.05, or 0.01.
Compute the test statistic. This is used to measure how consistent the data are with the null hypothesis.
Compute the p-value.
Make a decision:
The method we used last week to perform a hypothesis test is called the p-value method because it reduces to comparing the area corresponding to the p-value with the area corresponding to \(\alpha\). This week we investigate an equivalent approach, called the critical value method, which compares the t-statistics delimiting the \(\alpha\) area with the observed t-statistic that is used to compute the p-value area.
The changes to the procedure are minimal:
Identify the null hypothesis, denoted \(H_0\).
Identify the alternative hypothesis, denoted \(H_1\).
Select the significance level, denoted \(\alpha\). Typical values are 0.1, 0.05, or 0.01.
Compute the test statistic. This is used to measure how consistent the data are with the null hypothesis.
Compute the critical values.
Make a decision:
Suppose I give you a sample, for example:
library(tidyverse)
sample_data <- tibble(
score = c(0.1, 1, -0.2, 1.2)
)
Using \(\alpha = 0.01\), we wish to test whether the population the sample came from has a mean score that is different from 0:
\[ H_0: \mu = 0 \\ H_1: \mu \neq 0 \]
Sample mean:
xbar <- mean(sample_data$score)
xbar
## [1] 0.525
Just because the sample mean is different from 0, it doesn’t mean that the population mean necessarily must also be. This difference could perhaps only be due to random sampling variation.
s <- sd(sample_data$score)
s
## [1] 0.6800735
n <- nrow(sample_data)
n
## [1] 4
SE <- s / sqrt(n)
SE
## [1] 0.3400368
mu0 <- 0 # hypothesised value for mu in H0
tobs <- (xbar - mu0) / SE
tobs
## [1] 1.543951
The observed sample mean (\(\bar x =\) 0.52) is 1.54 standard errors away from the hypothesised value of 0.
We need to compare the observed t-statistic (i.e. the one computed from the observed sample data) with the critical values from a t(3) distribution. These are the values that cut, respectively, an area of 0.005 to the left and 0.005 to the right.
Those are the quantiles of a t-distribution, hence the function required is qt()
. 1
If we want to have 0.01 probability equally divided among both tails, we will have 0.01/2 = 0.005 in each tail. Remember that qt()
uses the probability to the left by default.
tstar <- qt(c(0.005, 0.995), df = n-1)
tstar
## [1] -5.840909 5.840909
In the t(3) distribution:
The observed t-statistic lies in between the critical values, rather than beyond. Hence, we fail to reject \(H_0\) at the 1% significance level.
If you were to compute the p-value, this would be larger than \(\alpha = 0.01\).
tobs
## [1] 1.543951
tstar
## [1] -5.840909 5.840909
If you don’t like to check it visually by looking at the number, you can get R to check it for you:
tobs <= tstar[1]
## [1] FALSE
tobs >= tstar[2]
## [1] FALSE
Suppose you were given a different sample, such as
sample_data <- tibble(
score = c(-2.1, -5.9, -3.8, -4.3)
)
Using \(\alpha = 0.05\), we wish to test whether the population it came from has a mean score that is less than 0:
\[ H_0: \mu = 0 \\ H_1: \mu < 0 \]
xbar <- mean(sample_data$score)
xbar
## [1] -4.025
Compute the observed value of the t-statistic:
s <- sd(sample_data$score)
s
## [1] 1.564981
n <- nrow(sample_data)
n
## [1] 4
SE <- s / sqrt(n)
SE
## [1] 0.7824907
mu0 <- 0 # hypothesised value for mu in H0
tobs <- (xbar - mu0) / SE
tobs
## [1] -5.143831
Compute the critical value. In a one-sided hypothesis test there is only one critical value as the entire \(\alpha\) probability (= 0.05 in this case) is assigned all in one tail.
In this case \(H_1 : \mu < 0\) so \(\alpha\) goes all in the left tail. This is because t-statistics that are much smaller than the hypothesised value, i.e. 0, will be considered as providing strong evidence against the null hypothesis.
tstar <- qt(0.05, df = n - 1)
tstar
## [1] -2.353363
Compare the observed value of the t-statistic with the critical value:
tobs
## [1] -5.143831
tstar
## [1] -2.353363
The observed t-statistic is smaller than the critical value, so we reject \(H_0\) in favour of the alternative.
tobs <= tstar
## [1] TRUE
At the 5% significance level, the sample data provide strong evidence against the null hypothesis that the sample came from a population with a mean of 0, and in favour of the alternative that the population mean is less than 0.
As the observed \(t\) = -5.14 is smaller than the critical value \(t^*\) = -2.35, the p-value would also be smaller than \(\alpha = 0.05\).
Suppose you were given a different sample, such as
sample_data <- tibble(
score = c(2.1, 0.3, -0.9, 1.1)
)
Using \(\alpha = 0.05\), we wish to test whether the population it came from has a mean score that is larger than 0:
\[ H_0: \mu = 0 \\ H_1: \mu > 0 \]
xbar <- mean(sample_data$score)
xbar
## [1] 0.65
Compute the observed value of the t-statistic:
s <- sd(sample_data$score)
s
## [1] 1.268858
n <- nrow(sample_data)
n
## [1] 4
SE <- s / sqrt(n)
SE
## [1] 0.6344289
mu0 <- 0 # hypothesised value for mu in H0
tobs <- (xbar - mu0) / SE
tobs
## [1] 1.024544
Compute the critical value. In a one-sided hypothesis test there is only one critical value as the entire \(\alpha\) probability (= 0.05 in this case) is assigned all in one tail.
In this case \(H_1 : \mu > 0\) so \(\alpha\) goes all in the right tail. This is because t-statistics that are much larger than the hypothesised value, i.e. 0, will be considered as providing strong evidence against the null hypothesis.
tstar <- qt(0.95, df = n - 1)
tstar
## [1] 2.353363
Compare the observed value of the t-statistic with the critical value:
tobs
## [1] 1.024544
tstar
## [1] 2.353363
The observed t-statistic is not more extreme than the critical value. It is smaller than the critical value, so we fail to reject \(H_0\). The sample data are consistent with the null hypothesis.
tobs >= tstar
## [1] FALSE
At the 5% significance level, the sample data do not provide sufficient evidence against the null hypothesis and hence we fail to reject the null that the sample came from a population with a mean of 0.
If you were to compute the p-value, as the observed t-statistic is smaller than the critical value, the p-value would be larger than \(\alpha = 0.05\).
We have learned to assess how much evidence the sample data bring against the null hypothesis and in favour of the alternative hypothesis.
The null hypothesis, denoted \(H_0\), is a claim about a population parameter that is initially assumed to be true. It typically represents “no effect” or “no difference between groups”.
The alternative hypothesis, denoted \(H_1\), is the claim we seek evidence for.
We performed a hypothesis test against \(H_0\) (and in favour of \(H_1\)) following these steps:
In this week’s exercises you will perform the same test of hypothesis as last week’s lab, but using the critical value method rather than the p-value method.
A 2011 study by Courchesne et al.2 examined brain tissue of seven autistic male children between the ages of 2 and 16. The mean number of neurons in the prefrontal cortex in non-autistic male children of the same age is about 1.15 billion. The prefrontal cortex is the part of the brain most disrupted in autism, as it deals with language and social communication.
Research question
Do autistic male children have more neurons (on average) in the prefrontal cortex than non-autistic children?
That is, we wish to test:
\[ H_0 : \mu = 1.15 \\ H_1 : \mu > 1.15 \]
where \(\mu\) is the mean number of neurons (in billions) in the prefrontal cortex for all autistic male children.
In the following you will use a significance level \(\alpha = 0.05\).
Read the data into R.
Compute the value of the t-statistic for the observed sample.
Identify the null distribution, i.e. the distribution of the t-statistic when \(H_0\) is true.
Compute the critical value(s) for the null distribution using the appropriate significance level.
Make a decision.
Write up your results in the context of the research question.
Remember the quantiles? See here if not↩︎
Courchesne, E., et al., “Neuron Number and Size in Prefrontal Cortex of Children with Autism,” Journal of the American Medical Association, November 2011;306(18): 2001–2010.↩︎