Announcement

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

  • Rolling regression and Betas

    Hello everyone,

    I got an issue with my data. I have to calculate Betas using a one-year horizon for the standard deviation and a five-year horizon for the correlation.
    I tried to solve it with rangestat but it doesn't seem to give me useful results. (Later on I collapse the betas to the monthly median)

    To explain my data a little bit better:

    - u_l is the dependent variable and u_il_totm is the independent variable
    - date is a daily time variable
    - u_il_sum or u_il_totm_sum are overlapping three-day variables of u_l or u_il_totm
    - business is the Panel identifier

    Code:
    rangestat (sd) u_l, interval(date2 -253 0) by(business)
    rangestat (sd) u_il_totm, interval(date2 -253 0) by(business)
    
    rangestat (corr) u_l_sum u_il_totm_sum , interval(date2 -1265 0) by(business)
    by business: gen b_=corr_x*(u_l_sd/u_il_totm_sd)
    
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float id int date float(u_l u_il_totm) double(u_l_sum u_il_totm_sum u_l_sd u_il_totm_sd corr_x) float b_ long business
    7291 21522   -.032031212   -.03346908   -.01188558991998434  -.014431627932935953 .014296595864911112 .009615241291108951  .6819943885639074 1.0140357 1
    7301 21537     -.0240295   -.01532736   -.03211445268243551  -.037328523118048906 .014572654895372407 .009924968682613377  .6918298156498026 1.0158014 1
       8 10967    -.02407695  -.007297443   -.03045432409271598  -.015204659197479486  .02039682611920892 .009881506532082312  .6472871864287981 1.3360922 2
      20 10983   -.006170765 -.0019058436  -.024179311003535986  -.017541934736073017 .020987896063583648 .010423769657868884  .3783457888372444   .761786 2
      10 10969    -.01896714  -.024606306   -.06770199351012707  -.028968825470656157  .02029191051144774 .011576334999298986  .7193210902201418 1.2608826 2
      22 10987   -.006170765  -.007635664  -.006690841168165207  -.011803671950474381  .02000200331907295 .009926303118551624 .38260687829904777  .7709723 2
      19 10982   -.011959134  -.012943413   .023036497179418802  -.015124497993383557 .021522301933148108 .010706819605906697 .36857242148891944  .7408854 2
       7 10966   -.011959134  -.011591271   .011057371739298105  -.017765098717063665 .018896918595789233 .010578236441798559  .6930519114998643  1.238065 2
       4 10961   -.006186848  -.008164733     .0172526054084301   .007259908597916365 .025900566301976194 .012554125838065713  .9492344143992599 1.9583768 2
       5 10962    .017434748  -.009857883 -.0007801633328199387  -.018888122867792845 .021939792222160935  .01194810157221647  .8646613897277722  1.587741 2
      21 10986    .005650688 -.0022621646  -.012479210272431374  -.017111421329900622 .020454559559738333 .010157832034785019 .38382998378883054  .7729083 2
       6 10965    .005581758  .0036840555   .016829657834023237  -.014338559936732054 .019050605815567462  .01052728729924305  .7208808554525721 1.3045353 2
      13 10974   -.006170765  -.008933092     .0602305568754673  -.008852268569171429  .02300427682101455 .010936264101102532 .44986646380009593  .9462878 2
      15 10976   -.006186848   .003096229    -.0126176459598355 -.0034870777744799852  .02126915744996826 .010355269539660287  .4606157208082938  .9460795 2
       2 10959    .035467517   .016290149   .035467516630887985   .016290148720145226                   .                   .                  1         . 2
      23 10988    .005650688   .017436467    .00513061136007309   .007538638776168227  .01954642811233748 .010759010329246243 .36953658185547295  .6713554 2
      11 10972    .024592593  -.009582764  -.019032452255487442    -.0312541457824409 .021211634547372214 .011037300173428839  .6948062026409461  1.335288 2
      16 10979   -.012239358   -.02515117  -.018686239782255143  -.019705157028511167 .020779779155555348 .011493406363016049   .475384132074158  .8594821 2
      14 10975 -.00026003382   .002349785   .035377929743845016  .0030802797991782427  .02203187834184627 .010619001327705487   .479469837406714  .9947848 2
       3 10960   -.012028064 -.0008655074    .02343945298343897   .015424641314893961 .033584446891202144  .01213088078197239  .9574679478787439  2.650758 2
      18 10981   -.006049413  -.002692678   .022756272461265326  -.027332255674991757 .021916908847689133 .010826626129488821 .37958713012881207  .7684182 2
       9 10968   -.024657907   .002934924   -.06069398857653141  -.015953790862113237   .0208895336310136  .00935127156017105  .6108838259731744 1.3646356 2
      12 10973     .04180873   .009663587   .047434182837605476  -.024525483138859272 .023985317564960116 .011355019784376228  .4877815615693307 1.0303457 2
      17 10980     .04104504  .0005115931   .022618837654590607   -.02154334873193875 .022529340686836697  .01117514464273107  .4346130813696857  .8761896 2
    end
    format %td date
    label values business business
    label def business 1 "3m", modify
    label def business 2 "aag", modify
    254 equals one year and 1266 five years. How do interpret the Betas that result out of my commands, for example Beta on the first observed date (in my case January 2) in comparison to the Beta at the beginning of 1991.


    Thank you.
Working...
X