Skip to main content

About this free course

Become an OU student

Share this free course

Teaching and learning statistics
Teaching and learning statistics

Start this free course now. Just create an account and sign in. Enrol on the course to track your learning.

3.3 Prediction

Two variables are said to be related if knowing the value of one of the variables provides information about the value of the other variable. Therefore, for related variables i.e. those which show correlation on a scatter graph, it is possible to make predictions about one variable (the dependent variable) if we know the other variable (the independent variable).

By convention, on a scatter graph the independent variable is put on the x-axis and the dependent variable is put on the y-axis.

Figure 20a A scatter graph with line of best fit added showing total monthly sunshine hours against monthly rainfall in millimetres for Camborne in 2023Source: Historic station data - Met Office

In this scatter graph of sunlight against rainfall, the negative relationship suggests the more rainfall there is, the less hours of sunlight there are in Camborne. You will see one point circled in red, this is because it does not seem to fit the pattern as well as the rest of the monthly data, it could be classed as a potential outlier. By checking the values in the original data, we can find that this point represents the month of February so, although we would not typically expect a lot of sun in this month, we would, perhaps, expect more rain than there was in 2023. The line of best fit has been plotted without taking the February data point into account, so this unusual data item does not adversely affect the trend seen in the rest of the data. Recall from Section 2.4 of Week 4, sometimes it is appropriate to do this.

You could use the line of best fit on this scatter graph to estimate the hours of sun in a month, given the amount of monthly rainfall. For instance, if there was 100mm rainfall in a month in Camborne, a sensible estimate for the hours of sunlight in the same month, using this data, would be 130 hours. See the green arrows added to the scatter graph in the following figure for how this prediction was reached.

Figure 20b A scatter graph with line of best fit added showing total monthly sunshine hours against monthly rainfall in millimetres for Camborne in 2023Source: Historic station data - Met Office

You may think the same method would work the other way. For instance, if there were 200 hours of sunlight in a month in Camborne, you could use the line of best fit to estimate there would be about 55mm of rainfall. However, you should only predict the dependent variable from the independent variable, not vice versa. It is possible to predict the rainfall based on the hours of sunlight, but that line of best fit would be a different one! Our line of best fit does not seek to minimise the perpendicular distance of the scatter points from the line but the vertical distances parallel to the y-axis. Therefore, the line depends on which variable you choose to be x (and which to be y).

The use that will be made of the data determines which variable is the dependent variable and which is the independent variable. If you wish to forecast the hours of sunlight based on the amount of rainfall, then the hours of sunlight is the dependent variable. However, if you wish to forecast the amount of rainfall, based on the hours of sunlight, then amount of rainfall is the dependent variable, and the scatter graph would need to be drawn with the axes swapped over and the line fitted to minimise the vertical distances on that graph.

Sometimes, as in this weather example, the choice of dependent and independent variables can be made either way round according to what you are interested in predicting. However, sometimes it is not as appropriate to switch the variables. The variables of a person’s height and weight, which typically follow a positive correlation, are a good example. It makes sense to try and predict a person’s weight (dependent) from their height (independent) but not necessarily to predict their height from their weight. A person’s height is generally quite fixed once they reach adulthood, but a person’s weight can fluctuate. If a person lost a lot of weight, we would not expect them to get shorter!

In most experiments, it is usually clear which is the independent variable. For example, if a drug company wanted to test if taking a larger dose of their latest blood pressure drug resulted in a reduction in patient blood pressure, the amount of the drug given would be the independent variable and the blood pressure result would be the dependent variable. If the drug were effective, you should be able to forecast if the resulting relationship would be positive or negative.

A note on extrapolation

What if you wanted to predict the hours of sunshine for a month in Camborne that has 200mm of rainfall?

You will notice in Figure 20b that 200mm is outside the range of the data on the rainfall axis. In fact, if you continued the line of best fit to predict the hours of sunshine, you would get a negative number of hours of sunshine! This would not be sensible and another important point to recognise is that predictions which fall outside the range of the original data are not reliable. Making predictions in this way is known as extrapolation and should really be avoided.