* Linear Probability Model for House Ownership
*
* Keywords:
* regression, weighted least squares, heteroskedasticity, probability,
* house ownership
*
* Description:
* We illustrate how to estimate a Linear Probability Model for House
* Ownership and apply a heteroskedasticity correction
*
* Author(s):
* Skif Pankov
*
* Source:
* Damodar N. Gujarati and Dawn C. Porter, Basic Econometrics - 5th Edition
* McGraw-Hill International Edition, Chapter 15, Example 15.1 (page 547)
*
sample 1 40
* Reading the datafile and naming variables
read (data_15.1.shd) y x
* Running an OLS regression of y on x, stating to save the predicted
* values in a variable yhat
ols y x / predict = yhat
* Excluding datapoint for which the predicted probability values (yhat)
* are either negative or greater than one - this is done by generating
* new variables y1 and x1
genr y1 = y
genr x1 = x
skipif (yhat.ge.1).or.(yhat.le.0)
* Generating weights w
genr w = 1 / (yhat*(1-yhat))
* Running a WLS regression of y1 on x1, using w as weights
ols y1 x1 / weight = w
stop