Time Series and Rolling Regression Using Stata

wand

New Member
#1
Hi,

I tried to run rolling regression on some inflation rates data and plot the coefficient values with Stata 10 but couldn't get the results I want. Below are some selected Stata codes [not the full set] I used:

//my data are yearly inflation rates [variable "inflat"], and the duration is 1960-2010 [variable "year"]:

gen date=year
tsset date
sort date

//I then run a rolling regression based on an AR(1) process for inflation rates to test for any structural change over time:

rolling _b _se, window(10) keep(date) clear: regress inflat L.inflat

//After the above code was run, I checked the dataset using the data editor, and saw the "date" variable cells were all empty, ie. all the cells were "." Why?

//Next, I also tried the following, although I am not sure what was its purpose:

use betas, clear

//I then looked at the dataset again, the "date" variable cells were still empty with "." I also noticed, among other changes, the coefficient field-name changed from _stat_1 to _b_inflat AND all the coefficient data values under it were also changed! Why? Should I run "use betas, clear" at all in the first place?

//Anyway, I tried to plot the coefficients using the commands:

tsline _b_inflat

//First, should I specify more in the command as it looked too simple? Second, it did give me a plot but an empty one - with Y and X-axis but with no line for the coefficient values at all! The X-axis was lableled "date" but has no date values [eg. 1960-, 1961-, etc] probably due to the empty "date" field in the dataset... Any ideas what were the problems?

//I also tried to plot the coefficients using the alternative commands:

gen lower = _b_inflat - 1.96*_se_inflat
gen upper = _b_inflat - 1.96*_se_inflat
twoway (line _b_inflat date) (rline lower upper date) if date>=(1950), ytitle("Beta")

//First, these commands also gave an empty plot, with Y and X-axis but with no line at all! Second, are there anything wrong with the command I wrote? Third, do these commands give similar display as the "tsline" command except that they also give the C.I.? [since both approaches gave empty plots I cannot tell the difference between them.]

Any advice on the above codes - including the proper sequence, errors in the codes, any missing codes, or any useful sources - will be very much appreciated!


Regards,

Wand