In: Statistics and Probability
What do you put into STATA to test residuals for positive first order serial correlation?
Serial correlation is a frequent problem in the analysis of time series data. Various factors can produce residuals that are correlated with each other, such as an omitted variable or the wrong functional form. If the problem cannot be resolved by improved model specification, then we need to correct for the influence of the autocorrelation through statistical means.
The basic steps are :
Set the data set to be a time-series data set
Stata needs to know that the data set is a time series data set. Use the TSSET command.
First, create a time variable. Sinvce we have quartely data, and only ear and quarter as variables, we need to create a variable coded 1,2,...,t for the quarters in the data set. Use the Generate command,
gen time = (year - 1949)*4 + quarter
Examine this data with the list command to ensure that it is the series 1 to 148 indicateing that there are 148 quarters in the period 1949-1985.
Now set this as the time variable
tsset time , q
Note that if you examine the data with the
tsset
command, the quarterly dating is off. Stata starts all data sets on at january 1960. This can be alterd, but not here!
Run the regression analysis
Regress Presidential approval on real GNP
reg approval realgnp
Examine for serial correlation
After running the regression, type the Durbin-Watson Statistic command.
dwstat
Correct the regression for the serial
correlation
Correcting for autocorrelation is easy with STATA. Run the analysis with the Prais-Winston command, specifying the Cochran-Orcutt option.
prais approval realgnp, corc
This gives us results that are substantially different from the original results.
Note the following points in the estimation:
Additional Information on Stata commands. (Taken from the Stata help information)
For additional information about how Stata treats time series data,
here is the Stata help for TSSET
The Stata information on Prais-Winston estimation options.