SHAZAM Questions and Answers (Q&A) - RSS feedhttp://community.econometrics.com/questions/SHAZAM Econometrics, Statistics and Analytics Communityen<font color="white">Copyright <b>SHAZAM Analytics, 2018</b></font>Thu, 17 Mar 2011 17:14:43 +0000How do you create a moving window with a constant width?http://community.econometrics.com/question/191/how-do-you-create-a-moving-window-with-a-constant-width/**A SHAZAM User asked:**
I wonder whether it is possible to do a series of estimations in SHAZAM in the following way (an example describes the problem).
Example: Let say you have a total of 40 observations, and want to use a MOVING SUB-SAMPLE with a fixed size (moving window with constant width), let say 20 observations, in each estimation.
The first sample includes observation 1 to 20. The next sub-sample consists of observation 2 to 21, the third from 3 to 22 etc., and the last includes observation 20 to 40. Then you can do 20 regressions by using this moving window of fix sample size. Is it possible to do this kind of estimation without doing 20 separate regressions manually 20-times?
And output: Is it possible to store (save) the estimated 20 coefficients in a file, and to print them?
Let say you want to estimate an AR(1)-model: y(t+1) = constant +
(coefficient)y(t) + residual(t), and you want a file with two columns which stores 20 estimated constants and coefficients.
It is of great help if you could look at the problem. I look forward to hearing from you.
Sat, 12 Mar 2011 09:03:23 +0000http://community.econometrics.com/question/191/how-do-you-create-a-moving-window-with-a-constant-width/Answer by ken for <p><strong>A SHAZAM User asked:</strong></p>
<p>I wonder whether it is possible to do a series of estimations in SHAZAM in the following way (an example describes the problem). </p>
<p>Example: Let say you have a total of 40 observations, and want to use a MOVING SUB-SAMPLE with a fixed size (moving window with constant width), let say 20 observations, in each estimation. </p>
<p>The first sample includes observation 1 to 20. The next sub-sample consists of observation 2 to 21, the third from 3 to 22 etc., and the last includes observation 20 to 40. Then you can do 20 regressions by using this moving window of fix sample size. Is it possible to do this kind of estimation without doing 20 separate regressions manually 20-times? </p>
<p>And output: Is it possible to store (save) the estimated 20 coefficients in a file, and to print them?
Let say you want to estimate an AR(1)-model: y(t+1) = constant +
(coefficient)y(t) + residual(t), and you want a file with two columns which stores 20 estimated constants and coefficients.</p>
<p>It is of great help if you could look at the problem. I look forward to hearing from you.</p>
http://community.econometrics.com/question/191/how-do-you-create-a-moving-window-with-a-constant-width/?answer=271#post-id-271 * Moving Sample Size, 20 Observations at a time
* Save coefs in separate variables
sample 1 40
* create some fake data
genr x=time(0)
genr y=nor(1)
* start moving window
do #=1,21
gen1 end=#+19
sample # end
print y x
ols y x / coef=c#
endo
print c1-c21
stop
Wed, 16 Mar 2011 11:37:36 +0000http://community.econometrics.com/question/191/how-do-you-create-a-moving-window-with-a-constant-width/?answer=271#post-id-271Answer by David for <p><strong>A SHAZAM User asked:</strong></p>
<p>I wonder whether it is possible to do a series of estimations in SHAZAM in the following way (an example describes the problem). </p>
<p>Example: Let say you have a total of 40 observations, and want to use a MOVING SUB-SAMPLE with a fixed size (moving window with constant width), let say 20 observations, in each estimation. </p>
<p>The first sample includes observation 1 to 20. The next sub-sample consists of observation 2 to 21, the third from 3 to 22 etc., and the last includes observation 20 to 40. Then you can do 20 regressions by using this moving window of fix sample size. Is it possible to do this kind of estimation without doing 20 separate regressions manually 20-times? </p>
<p>And output: Is it possible to store (save) the estimated 20 coefficients in a file, and to print them?
Let say you want to estimate an AR(1)-model: y(t+1) = constant +
(coefficient)y(t) + residual(t), and you want a file with two columns which stores 20 estimated constants and coefficients.</p>
<p>It is of great help if you could look at the problem. I look forward to hearing from you.</p>
http://community.econometrics.com/question/191/how-do-you-create-a-moving-window-with-a-constant-width/?answer=272#post-id-272A slightly different example can be found here: [http://www.econometrics.com/examples/window.sha](http://www.econometrics.com/examples/window.sha) Thu, 17 Mar 2011 17:14:43 +0000http://community.econometrics.com/question/191/how-do-you-create-a-moving-window-with-a-constant-width/?answer=272#post-id-272