Search found 9 matches

Mon Apr 24, 2017 2:08 am
Forum: Program Repository
Topic: Basic Rolling Regression
Replies: 133
Views: 163163

Re: Basic Rolling Regression

Dear The Yoyo, thank you so much, I am making progress on this, I have successfully created the rolling window. However, another problem arises since the result only displays around 250 observations (I have attached an image for the issue, I think this could be my data is pooled panel data so the p...
Sun Apr 23, 2017 9:45 am
Forum: Program Repository
Topic: Basic Rolling Regression
Replies: 133
Views: 163163

Re: Basic Rolling Regression

You should set the "3" in the part that reads: 'matrix to store coefficient estimates matrix(3,!nrolls) coefmat ' where 3 is the number of coefficients to the actual number of coefficients you estimate in your equation "eq1.LS(WGT=CXSUR) (SPOT(-1)-SPOT) C (FORWARD-SPOT)" By the ...
Sun Apr 23, 2017 1:18 am
Forum: Program Repository
Topic: Basic Rolling Regression
Replies: 133
Views: 163163

Re: Basic Rolling Regression

You should set the "3" in the part that reads: 'matrix to store coefficient estimates matrix(3,!nrolls) coefmat ' where 3 is the number of coefficients to the actual number of coefficients you estimate in your equation "eq1.LS(WGT=CXSUR) (SPOT(-1)-SPOT) C (FORWARD-SPOT)" By the l...
Fri Apr 21, 2017 8:28 am
Forum: Program Repository
Topic: Basic Rolling Regression
Replies: 133
Views: 163163

Re: Basic Rolling Regression

What exactly are you looking for? Forecasts? Or just repeated GLS estimations?
It would be easier if you could provide the code you have written so far (or look for a example of a code in this forum).
Tue Apr 11, 2017 5:37 am
Forum: Program Repository
Topic: FOR LOOP
Replies: 2
Views: 2172

Re: FOR LOOP

Not sure what frml is, why not use genr?

Something like:

Code: Select all

`genr r_l_loan_bs = l_loan_bs - l_cpifor %x l_loan_min l_loan_agr l_loan_manu l_loan_elec l_loan_cons l_loan_trade l_loan_sergenr r_{%x} = {%x} - l_cpinext`
Mon Apr 10, 2017 8:36 am
Forum: Program Repository
Topic: Basic Rolling Regression
Replies: 133
Views: 163163

Re: Basic Rolling Regression

Have you tried changing the parts: ' 1-period-ahead forecast %24pers = @otod(@dtoo(%start)+!i+!window-1) %24pere = @otod(@dtoo(%start)+!i+!window+23) and then setting it the sample to ' set sampl to obtain the 24th period observation smpl {%24pers} {%24pere} Not sure if that does what you are lookin...
Wed Mar 22, 2017 3:13 pm
Forum: Program Repository
Topic: Basic Rolling Regression
Replies: 133
Views: 163163

Re: Basic Rolling Regression

That sounds fairly simple. Not sure why it's not working. Try adjusting the following code (and ignore the forecasts it makes). 'create some data create u 100 series y=nrnd series x1=nrnd series x2=nrnd series z=nrnd 'run rolling regression ' set window size !window = 36 ' set step size !step = 1 ' ...
Tue Mar 21, 2017 3:23 pm
Forum: Program Repository
Topic: Basic Rolling Regression
Replies: 133
Views: 163163

Re: Basic Rolling Regression

' move sample !step obs at a time
for !i = 1 to @first+!i+!window-2
!j=!j+1

Maybe try:

Code: Select all

`' move sample !step obs at a timefor !i = 1  to  !length-!window+1-!step step !step   !j=!j+1`

Not sure if that solves it.
Tue Jul 15, 2014 8:11 am
Forum: Program Repository
Topic: Basic Rolling Regression
Replies: 133
Views: 163163

Re: Basic Rolling Regression

For anyone still looking for a code that does a 1-period ahead recursive regression forecast (expanding window), I put together something from posts all over this forum. Most of the credits for these codes go to Esther and Gareth. Try the code below. Note that I left out the coefficient matrix. 'cre...