Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72758

No observations - Rolling -

$
0
0
Hi,

I am trying to come up with the rolling window (4 quarters) out-of-sample forecast of the variable "change_UR" given the regression:
regress change_UR L.Adv_GDP L.L2_Earn L.L1_MktRet

I am trying to follow closely the procedure described in Exemple 3 there:
http://www.stata.com/manuals13/tsrolling.pdf

Here is a small sample of the data I have:
Code:
Adv_GDP    L1_MktRet    L2_Earn    change_UR    qyear
1.3542733    -.0525302    .0576684    -.1    1985q1
1.742562    .1639288    .0583243    .2    1985q2
3.270377    .0146729    .0731678    -.3    1985q3
2.3530061    -.0376909    .0769057    -.1    1985q4
3.201371    .0982357    .0716404    .2    1986q1
1.0765585    .1516437    .0446049    0    1986q2
2.4140789    .0604246    .070034    -.2    1986q3
1.7474467    -.1089304    .0755718    -.4    1986q4
4.2991076    -.017095    .073609    0    1987q1
2.5909416    .2284597    .0426735    -.4    1987q2
3.8376508    .0043504    .0838878    -.3    1987q3
4.1507856    .0337914    .0803058    -.2    1987q4
2.2659635    -.2970338    .0840421    0    1988q1
3.0886553    .1733465    .056771    -.3    1988q2
2.2367273    .0440215    .0903041    0    1988q3
1.9900388    -.0077611    .0850306    -.1    1988q4
5.5463842    -.0290976    .0819561    -.3    1989q1
1.6759617    .083172    .0611651    .3    1989q2
2.5010395    .0463988    .086163    0    1989q3
.50058866    .0551755    .0831587    .1    1989q4
2.0957625    -.0681087    .0799775    -.2    1990q1
1.2198228    -.0096593    .0509076    0    1990q2
1.7928733    .0229173    .0826091    .7    1990q3
-2.1314299    -.2151108    .0763973    .4    1990q4
-2.8109207    -.0262132    .0721894    .5    1991q1
I have tried to run the following code, that is very similar to the one from the previous link:
Code:
use cost_stick_regression.dta, clear
tsset qyear

program myforecast_test7, rclass
syntax [if]
regress change_UR L.Adv_GDP L.L2_Earn L.L1_MktRet `if'
// Find last time period of estimation sample and
// make forecast for period just after that
summ qyear if e(sample)
local last = r(max)
local fcast = _b[_cons] + _b[L.Adv_GDP]*Adv_GDP[`last']+ _b[L.L2_Earn]*L2_Earn[`last'] + _b[L.L1_MktRet]*L1_MktRet[`last']
return scalar forecast = `fcast'
// Next period’s actual return
// Will return missing value for final period
return scalar actual = change_UR[`last'+1]
end

rolling actual=r(actual) forecast=r(forecast), recursive window(20): myforecast_test7

corr actual forecast

but I am getting the following error:
Code:
Rolling replications (93)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee    50
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

. 
. corr actual forecast
no observations
I'm trying to figure out what I'm doing wrong compared to the example. Can someone help? Thanks!



Viewing all articles
Browse latest Browse all 72758

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>