SO5032: Lab Materials

Table of Contents

1 Week 6 Lab

1.1 Non-linearity

1.1.1 Sketch a quadratic function

Using pen and paper and/or Excel, plot the curve \(Y=20+0.75X-0.03X^2\).

1.1.2 Age example

Age often has non-linear effects: how to handle it?


recode age = . if age < 15

drop if income >6000

scatter income age, mfcol(blue%05) mlcolor(white%00)

reg income age
reg income age if age<=34
reg income age if age>34

gen ageg = 5*int(age/5)

reg income c.ageg##c.ageg

1.1.3 Model a non-linear relationship

Run this do-file to load data on


Fit models predicting birth rate using GNP as

  • a linear effect
  • a quadratic effect (GNP plus squared GNP)
  • logged GNP and
  • a grouped effect.

Consider the fit of the four models.

Plot the four predicted values as lines/curves on the same graph: how do they compare? Plot the residuals as well.

1.2 Predicting house prices :noexport

Data on house price and characteristics are available in this do file.


Using t-tests on individual parameters, and overall F-tests/adjusted R2, search for a good model to predict house price. Use dummy variables where appropriate (see note on dummy variables in Lab 4).

Are any of the explanatory variables "multi-collinear"? Note what happens to the model when you add a variable that is collinear with one already in the equation.

Author: brendan

Created: 2021-03-09 Tue 15:42