looped rolling regression
Posted: Wed Jan 29, 2014 4:34 am
Hi,
I am trying to get a program that loops multiple rolling regressions and saves some of the results in matrixes. My sample is composed of multiple series (the larger sample is over 5000 series and the smallest one composed of 1353 series) each series contains a maximum of 82 observations (some have data missing at the beginning, some at the end, some on both the beginning and the end). The frequency of my data is monthly(the series in the work file are so defined. The equation I am using is a standard ls regression similar to this one : series(x) c proxy1 proxy2 proxy3
What I would like the program to achieve is to run for each series, a rolling regression (using the equation above) on the previous 36 observations (1 to 36, 2 to 37, etc...) so a maximum of 46 regressions per series (missing observations might not allow for some the regressions to be computed).
Furthermore i would like the coefficients for each of the regressions to be saved in a matrix as well as the r2. If possible I would like one matrix for each coefficient (one for r2, one for c, one for proxy1, etc), that matrix containing that same coefficient for each regression in each series. So a total of 5 matrixes.
I picked up a rolling regression basic program which I changed to my window size and equation. It works when used on complete series (without missing observations, series num100 to num109 for example), but stops as soon as I encounter a series with missing data.
My problems are multiple:
1.)how can I get the program to keep on going after encoutering missing data which made that particular regression impossible.
2.)Is it possible to save each coefficient separately and in one matrix (one matrix per coefficient and that matrix would include that particular coefficient for each series and rolling regression)
3.)This problem is similar to the previous one but for r2 as with my program so far it always saves them in the first column of the matrix, therefore erasing the previous results.
I have uploaded the work file I use for the smaller sample of 1353 series as well as my program thus far.
I am using Eviews 7.1
I hope I was comprehensible and thank you in advance for you answer.
Amaury
I am trying to get a program that loops multiple rolling regressions and saves some of the results in matrixes. My sample is composed of multiple series (the larger sample is over 5000 series and the smallest one composed of 1353 series) each series contains a maximum of 82 observations (some have data missing at the beginning, some at the end, some on both the beginning and the end). The frequency of my data is monthly(the series in the work file are so defined. The equation I am using is a standard ls regression similar to this one : series(x) c proxy1 proxy2 proxy3
What I would like the program to achieve is to run for each series, a rolling regression (using the equation above) on the previous 36 observations (1 to 36, 2 to 37, etc...) so a maximum of 46 regressions per series (missing observations might not allow for some the regressions to be computed).
Furthermore i would like the coefficients for each of the regressions to be saved in a matrix as well as the r2. If possible I would like one matrix for each coefficient (one for r2, one for c, one for proxy1, etc), that matrix containing that same coefficient for each regression in each series. So a total of 5 matrixes.
I picked up a rolling regression basic program which I changed to my window size and equation. It works when used on complete series (without missing observations, series num100 to num109 for example), but stops as soon as I encounter a series with missing data.
My problems are multiple:
1.)how can I get the program to keep on going after encoutering missing data which made that particular regression impossible.
2.)Is it possible to save each coefficient separately and in one matrix (one matrix per coefficient and that matrix would include that particular coefficient for each series and rolling regression)
3.)This problem is similar to the previous one but for r2 as with my program so far it always saves them in the first column of the matrix, therefore erasing the previous results.
I have uploaded the work file I use for the smaller sample of 1353 series as well as my program thus far.
I am using Eviews 7.1
I hope I was comprehensible and thank you in advance for you answer.
Amaury