Announcement

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

  • Creating a recursion variable


    I'm trying to replicate a recursion variable from a paper defined below, but I'm having trouble coding this in or finding a similar problem on the forum. Does anyone have any suggestions as to how to code this in? I've attached a data example below.
    Click image for larger version

Name:	Screen Shot 2019-11-08 at 12.46.33 PM.png
Views:	1
Size:	53.4 KB
ID:	1523932



    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float month double change
    612   -.004991235657247017
    613  -.0003907886751084444
    614  -.0004018013641178264
    615   .0006069723741721766
    616  -.0003405231947763987
    617   -.001898208352126396
    618   -.001708250381726062
    619   .0004951327973063968
    620    .002372724815685512
    621 -.00011237099952499108
    622  -.0010946224222694312
    623  -.0006509051015615164
    624   -.005122270065494039
    625  .00010651547331330669
    626   .0006074811462390972
    627  -.0013014861316329451
    628  -.0005188926319612541
    629   .0011688844353914263
    630  -.0006228099471545789
    631   -.002615094605050272
    632 -.00023978680609615388
    633   .0023468439977769595
    634 -.00036768914480966863
    635  -.0007074356476133303
    636   .0008620682199795837
    637   -.002757046018206255
    638   -.004036367199411028
    639 -.00044835241560581274
    640   .0011642244666922874
    641   .0004556775964634774
    642  -.0008655306685194653
    643  -.0016792169423880399
    644  -.0005630953635848979
    645   -.005024531278962963
    646   -.002627684570536637
    647   .0009963658350320426
    648 -.00047558246508794255
    649  .00014092416617716985
    650   .0017915981279021942
    651  -.0011096773696968043
    652   -.002506033359870319
    653   .0006084745578889272
    654   .0002629105922167252
    655   .0006919548228461192
    656  -.0009762794404883923
    657 -.00003355802822158083
    658   .0007571715633221121
    659  -.0012391719361075637
    660   .0004830074215247393
    661  -.0011976253726078134
    662  -.0025890779828434685
    663   .0005939042965081853
    664   .0030388435814403536
    665    -.00104345644145587
    666   -.003545362352717296
    667   -.000468028487129013
    668  -.0022629054253231473
    669  -.0010997530228253893
    670   .0019434921180616627
    671    .002519050389598876
    end
    format %tmMon-YY month
    I apologize for the screenshot. The formula can be found on the bottom of page one here.
    Last edited by Justin Niakamal; 08 Nov 2019, 14:53. Reason: spacing

  • #2
    Perhaps this yields what you want. I assume that "change" in your data corresponds to the ∆ (delta) between two successive values in your equation (3). If not, it would be particularly helpful if you calculated by hand your desired results for the final few observations and included them in your post.
    Code:
    . generate cd = sum(change)
    
    . replace cd = cd - cd[_N]
    (60 real changes made)
    
    . list in 56/l
    
         +---------------------------------+
         |  month       change          cd |
         |---------------------------------|
     56. | Aug-15   -.00046803   -.0010999 |
     57. | Sep-15   -.00226291   -.0033628 |
     58. | Oct-15   -.00109975   -.0044625 |
     59. | Nov-15    .00194349   -.0025191 |
     60. | Dec-15    .00251905           0 |
         +---------------------------------+

    Comment


    • #3
      Thanks, William Lisowski, I'll try and work this into what I've put together (sorry for the late reply, I was moving over the weekend ).

      Comment

      Working...
      X