7. Hypothesis Testing: Introduction to Hypothesis Testing
Computing the p-value and Making a Decision
p-value
The -value of a test is the probability, when the null hypothesis is assumed to be true, of observing a test statistic equal to or more extreme than what was actually observed.
For a two-tailed test, the -value is a two-tailed probability, which means it is evenly split between both tails.
For a one-tailed test, the -value is a one-tailed probability, which means it is entirely located in one of the tails.
Interpretation of a p-value
The -value is not the probability that the null hypothesis is false. The status of is non-random.
The sample is random, so consequently, the test statistic is also random. Thus the -value concerns the test statistic.
A small -value implies that the value of the test statistic is not in the range of values that we would expect if is true.
Calculating the p-value of a z-test for a Population Mean with Statistical Software
The calculation of the -value of a -test for is dependent on the direction of the test and can be performed using either Excel or R.
To calculate the -value of a -test for in Excel, make use of one of the following commands:
To calculate the -value of a -test for in R, make use of one of the following commands:
Note: denotes the absolute value of , i.e. the distance of from , regardless of whether or .
Once the -value of the test has been computed, the time has come to make a decision regarding the null hypothesis .
Making a Decision
If the computed -value is smaller than the significance level (i.e. ), this means that the observed data is highly unlikely to occur, given that is true. We then say that we reject in favor of .
If the computed -value is larger than or equal to the significance level (i.e. ), this means that the observed data falls in the range of values that we would expect to observe if is true. We then say we do not reject .
A researcher collects one-liter water specimens from randomly-selected locations along a river and measures the amount of dissolved oxygen in each specimen.
The researcher plans on using a -test to determine if the mean oxygen content of the river significantly differs from mg per liter, at the level of significance.
The sample mean turns out to be mg per liter.
Calculate the -value of the test and make a decision regarding . Round your answer to decimal places.
On the basis of this -value, should not be rejected, because .
There are a number of different ways we can calculate the -value of the test. Click on one of the panels to toggle a specific solution.
Because the sample is drawn from a normally-distributed population, we know that the test statistic
has the distribution, under the assumption that is true.
Calculate the value of test statistic :
For a two-tailed -test, the -value is defined as . To calculate this value in Excel, make use of the following function:
NORM.DIST(x, mean, standard_dev, cumulative)
- x: The value at which you wish to evaluate the distribution function.
- mean: The mean of the distribution.
- standard_dev: The standard deviation of the distribution.
- cumulative: A logical value that determines the form of the function.
- TRUE - uses the cumulative distribution function,
- FALSE - uses the probability density function
Thus, to calculate , run the following command:
This gives:
Since , should not be rejected.
Because the sample is drawn from a normally-distributed population, we know that the test statistic
has the distribution, under the assumption that is true.
Calculate the value of test statistic :
For a two-tailed -test, the -value is defined as . To calculate this value in R, make use of the following function:
pnorm(q, mean, sd, lower.tail)
- q: The value at which you wish to evaluate the distribution function.
- mean: The mean of the distribution.
- sd: The standard deviation of the distribution.
- lower.tail: If TRUE (default), probabilities are , otherwise, .
Thus, to calculate , run the following command:
This gives:
Since , should not be rejected.