Linear Model Residual Plot
Contents
Introduction
The Linear Model Residual Plot is a scatter plot of the response (dependent) variable against the linear model (“line of best fit”) calculated by a regression, plotting the residuals (that is, the part of the dependent variable that can’t be explained by the model – the “residual” variation) against fitted values (i.e. the linear model). The Linear Model Residual plot is a plot similar to the Linear Model Response Plot except instead of showing how the response variable (your dependent variable) against the independent variable, with a positive or negative slope, it has the linear model as a horizontal line (b = 0) to show how much variation there is around the line
Inputs
To illustrate the linear model residual plot, we will run it on a dataset within South Australia
- Select South Australia as your area
- Select SA2 Chronic Disease (synthetic prediction) 2007 as your dataset, and select the following attributes:
- Statistical Area 2 code
- Statistical Area 2 name
- Type 2 diabetes (synthetic prediction) – Rate per 100
- Circulatory system diseases (synthetic prediction) – Rate per 100
Once you have done this, open the Linear Model Residual Tool (Analyse → Tools → Charts → Linear Model Residual Chart) and enter the following parameters (shown below):
- Dataset Input: select the dataset you would like to use. Here we use SA2 Chronic Disease (synthetic prediction) 2007
- LM Formula: This will need to be typed in the manner that is normally incorporated in the R language. This will require typing in the names rather than the titles of the variables. These can be copied and pasted from the metadata panel if you open up the dataset to the right. When we ‘regress’ a dependent variable on an independent variable in R, this is written as dependent variable ~ independent variable with the tilde symbol (~) representing the statistical function of “regressed on”. So, for this example you will need to type:
- diabetes_me_2_rate_3_11_7_13 ~ circ_me_2_rate_3_11_7_11
- LM Compute Intercept: checked means we compute the intercept with the y axis
- Chart Title: here we select a title for our graph, such as Linear Model Response Plot: Rate of Diabetes vs Circulatory Syndrome
- Grid: Whether or not we have gridlines on our graph. Leave it checked
- Greyscale: leave it unchecked if you want a colour graph
Once you have entered the parameters, click Add and Run
Outputs
Once your tool has run, click the Display button on the pop-up window that appears. You should get a graph which looks like the graph below.
This is a linear model respidual plot, with the distance of each observed point marked vertically from the horizontally linear model line.