* MWD Test of OLS Models for Demand for Roses
*
* Keywords:
* regression, multiple, linear, log, ols, mackinnon, white, davidson, mwd,
* demand, roses
*
* Description:
* We illustrate how to estimate a Multiple Linear and Log OLS Regression
* Models for Demand for Roses and conduct MacKinnon, White and Davidson
* (MWD) test
*
* Author(s):
* Skif Pankov
*
* Source:
* Damodar N. Gujarati and Dawn C. Porter, Basic Econometrics - 5th Edition
* McGraw-Hill International Edition, Chapter 8, Example 8.5 (page 261)
*
sample 1 16
* Reading the datafile and naming variables
read(data_8.5.shd) rose rpr cpr
* Generating natural logs of data
genr lnrose = log(rose)
genr lnrpr = log(rpr)
genr lncpr = log(cpr)
* Running an OLS regression of rose on rpr and cpr, stating to display residual
* statistics and saving predicted values of rose in a variable yf
ols rose rpr cpr / rstat predict = yf
* Running an OLS regression of lnrose on lnrpr and lncpr, stating to display
* residual statistics and saving predicted values of rose in a variable lnf
ols lnrose lnrpr lncpr / rstat predict = lnf
* Generating variables z1 and z2 which shall be used for MWD test
genr z1 = log(yf) - lnf
genr z2 = exp(lnf) - yf
* Running an OLS regression of rose on rpr, cpr and z1 to obtain the coefficient
* estimate on z1
ols rose rpr cpr z1
* Constructing a t-test of the null hypothesis that the coefficient on z1 is 0 - in
* MWD framework, we are testing a hypothesis that the true model specification
* is linear
test z1 = 0
* Running an OLS regression of rose on lnrpr, lncpr and z2 to obtain the
* coefficient estimate on z2
ols lnrose lnrpr lncpr z2
* Constructing a t-test of the null hypothesis that the coefficient on z2 is 0 - in
* MWD framework, we are testing a hypothesis that the true model specification
* is logarithmic
test z2 = 0
stop