* Heteroskedasticity in the Monthly Credit Card Expenditure Model
*
* Keywords:
* regression, ols, heteroskedasticity, credit card, expenditure, graph
*
* Description:
* We illustrate how to estimate an OLS Model for Monthly Credit Card
* Expenditure and, by plotting its estimated residuals, we show that
* it's likely to suffer from Heteroskedasticity
*
* Author(s):
* Noel Roy
* Skif Pankov
*
* Source:
* William H. Greene, Econometric Analysis - 7th Edition
* Pearson International Edition, Chapter 9, Example 9.1 (page 309)
*
* Reading the datafile and retrieving names of the variables
read (TableF9-1.shd) / names
* Generating the square of the variable income
genr income2=income**2
* Using only those observations for which avgexp is nonzero.
* The skipif (expression) command will cause subsequent commands to skip
* observations for which the value of the expression is positive or true
set nowarnskip
skipif (avgexp .eq. 0)
* Running the OLS regression of avgexp on age, ownrent, income and income2
?ols avgexp age ownrent income income2 / resid=u
* Replicating figure 9.1 by plotting the residuals u against income.
* The skipped observations have missing u, so turn off the warnings
set nowarnmiss
graph u income / nokey
stop