Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Estimate coefficients to predict out of sample for the excluded quarter.

    Hi, I want to evaluate the model’s (reg lnUnmprate lnInflation lnFedfunds) ability to predict out of sample. Specifically, I want to start by removing the first quarter(qrt204) from the estimation sample and use the estimated coefficients to predict out of sample for the excluded quarter. I then want to repeat this for each quarter and report the RMSE over all quarters for the model specification to compare it with a benchmark model.(not mentioned here). Sample time series data is given below;

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(qrt Inflation Unmprate Fedfunds)
    204   .9101716 2.2009215  -1.853635
    205  1.1963816 2.2046046  -2.371578
    206    .977927 2.1972246  -2.484907
    207  .07792359 2.1556306   -2.61274
    208  1.0651164 2.1122313 -2.2697952
    209   .7287415  2.104134  -1.875141
    210  1.0592687 2.0835996 -1.9425824
    211   .7660922 2.0541236 -1.8325815
    212   .6979457   2.04554 -1.9425824
    213  .50716305 2.0193377 -2.1484344
    214   .9642801    1.9787  -2.484907
    215   .9775378 1.9363407  -2.445686
    216    .654176   1.89712   -2.61274
    217   1.055461 1.8245493  -2.371578
    218   .8935435 1.8028094 -2.4079456
    219  -.1565022  1.740466 -2.3025851
    220  -1.490751 1.7107904  -2.207275
    221  1.0335808 1.6925528 -2.0928645
    222    .497876 1.6292405 -1.9902104
    223  -.5362221 1.6160824 -1.8325815
    224 -1.4332616  1.596015 -1.0216513
    225  1.1255546 1.5892352  -.9852836
    226    .614585 1.5892352   -.924659
    227   .9833136 1.5616473  -.7985077
    228   .8862488 1.5260563  -.3566749
    229   .4922492     1.474  -.0512933
    230   .9551601  1.458615   .1426563
    231  1.0736006 1.4190842   .1850955
    232   .8870767 1.4028237   .3692621
    233   1.237515 1.3609766  .55196756
    234   .8084829  1.335001   .6540598
    235   .7520165  1.335001   .7975072
    end
    format %tq qrt

    Any help will be much appreciated.

    Regards,
    Karim

  • #2
    I guess I'd look over quarters and run something like:

    g sumpred=.

    forvalues q=204/235 {
    reg y x if qrt !=`q'
    predict yhat`q' if qrt==`q'
    replace sumpred=yhat`q' if qrt==`q'
    }

    I haven't checked whether this runs, but you should get the idea.

    Comment


    • #3
      Thanks, Phil. I think this is what I wanted.

      Comment

      Working...
      X