Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: d-w stat in gujararti


From   Christopher Baum <[email protected]>
To   [email protected]
Subject   st: d-w stat in gujararti
Date   Fri, 09 Dec 2005 15:08:12 -0500

Brian's solution:

The Grunfeld dataset that accompanies Gujarati's text is actually a panel 
of 4 firms over 20 years.  In the example on p. 641 he runs a pooled 
regression, stacking the data for the four firms on top of each other.

To get Stata to compute the Durbin-Watson statistic, we need to trick it 
into thinking this is time series data.

Here is how I did that:

    insheet using guj.txt	// From the CD-ROM accompanying the book
    drop v5 v6
    rename v2 I
    rename v3 lagF
    rename v4 lagC
    gen year = real(substr(v1, length(v1)-3, .))
    gen str company = substr(v1, 2, 2)
    sort company year
    gen t = _n
    tsset t
    regress I lagF lagC
    estat dwatson

Durbin-Watson d-statistic(  3,    80) =  .3097946




fails to take into account the gaps in the data. You should not be taking the differences between different firms' errors! The enclosed does not match Gujarati exactly, but it comes close:

webuse grunfeld,clear
keep if company<4 | company == 8
set obs 81
replace company = 2 in 81
replace year = 1934 in 81
set obs 82
replace company = 3 in 82
replace year = 1934 in 82
set obs 83
replace company = 8 in 83
replace year = 1934 in 83
sort company year
gen t=_n
tsset t
l
regress invest mvalue kstock
dwstat


Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index