To help visualise our results, we can create a scatterplot of the outcome and the predictor variables with the regression line plotted on top. This involves two steps:
1. After running the regression, we create a variable containing the predicted values (which we have named bmi_iq1) using the ‘predict’ command.
2. Then to create the plot, we use the Stata ‘twoway (scatter …)’ graph command, in combination with the ‘(lfit …)’ command to overlay the regression line.
Running the above commands with our data, the plot we generate has ‘BMI at age 42’ on the Y axis and ‘general ability at age 11’ on the X axis. The fitted regression line slopes from the left of the plot (where the intercept for ‘BMI at age 42’ is 27.5) to the right (where a ‘general ability’ score of 80 equals a ‘BMI at age 42’ of 24.7). However, the slope is fairly flat, which is to be expected given the small regression coefficient (-.03) we obtained in the previous step when we ran the ‘reg’ command.
What we have run here is often called a simple regression, as it contains only one predictor variable. We may get a more informative insight if we extended our model to consider other variables that may influence the association between our predictor and outcome variables, and that is exactly what we will do in the next section.
The Learning Hub is a resource for students and educators
tel | +44 (0)20 7331 5102 |
---|---|
closer@ucl.ac.uk |
Sign up for our email newsletters to get the latest from CLOSER
Sign up