Announcement

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

  • Obtaining Beta coefficients for Monthly returns data

    Hi, this is my first time on this forum so forgive me if I post in the wrong manner.

    I am attempting to obtain beta coefficients for the variables MktRF SMB and HML but am having trouble doing so and can't find a solution on any forum I have came across, or at least I am not understanding the solution people have suggested on other forums.


    input long(Dom Date) float(w_rollingperformance inflationrate marketcap gdppercapita) double(MktRF SMB HML RMW CMA RF) float humandevelopmentindexundp
    1 320 0 2.7326 125.276 1.84577 2.06 2.2 .77 .95 -.09 .1 .904
    1 321 -1.834537 2.7326 125.276 1.84577 2.2 2.29 1.43 -3.64 1.44 .07 .904
    1 322 1.5608537 2.7326 125.276 1.84577 2.73 2.89 1.28 -1.48 1.66 .07 .904
    1 323 4.1593857 2.7326 125.276 1.84577 1.32 2.94 .1 1.61 -.31 .08 .904
    1 324 6.626717 2.7326 125.276 1.84577 . . . . . . .904
    1 325 1.3333676 2.7326 125.276 1.84577 . . . . . . .904
    1 326 5.460494 2.7326 125.276 1.84577 . . . . . . .904
    1 327 3.224067 2.34326 126.416 3.00431 2.29 2.81 1.85 -1.83 2.31 .07 .907
    1 331 .7118458 2.34326 126.416 3.00431 1.92 .22 .69 1.17 -1.18 .06 .907
    1 332 -1.0775551 2.34326 126.416 3.00431 -.03 3.93 .45 1.18 -1.34 .09 .907
    1 333 -3.037711 2.34326 126.416 3.00431 -2.34 -.64 -1.67 2.91 -.76 .08 .907
    1 334 .6079404 2.34326 126.416 3.00431 .67 -1.55 .23 -.69 -.46 .06 .907
    1 335 .52197164 2.34326 126.416 3.00431 2.38 2.48 1.02 1.02 .1 .08 .907
    1 336 3.921357 2.34326 126.416 3.00431 -3.79 -1.21 2.33 2.07 -.37 .1 .907
    1 337 3.0772076 2.34326 126.416 3.00431 .36 -.5 1.25 .46 -.5 .11 .907
    1 338 7.728163 2.34326 126.416 3.00431 2.15 1.22 .48 -.53 -.13 .11 .907
    1 339 9.806663 2.34326 126.416 3.00431 . . . . . . .907
    1 340 11.51192 2.34326 126.416 3.00431 . . . . . . .907
    1 341 9.632057 2.34326 126.416 3.00431 . . . . . . .907
    1 342 8.048813 2.69183 115.673 1.80778 -1.93 2.41 1.48 2.1 -.23 .16 .908
    1 343 -7.195466 2.69183 115.673 1.80778 -2.68 -.14 .23 -1.29 .37 .27 .908
    1 344 .19569016 2.69183 115.673 1.80778 2.9 .07 -.74 -.59 -1.08 .31 .908
    1 345 9.287386 2.69183 115.673 1.80778 2.58 2.14 -.53 .75 -.69 .32 .908
    1 346 8.1737795 2.69183 115.673 1.80778 2.99 .62 1.41 1.12 .49 .16 .908
    1 347 -2.262076 2.69183 115.673 1.80778 -2.02 -.26 1.55 .41 .57 .21 .908
    1 348 -2.357272 2.69183 115.673 1.80778 -2.6 -.93 .05 .38 -.32 .21 .908
    1 349 .04123825 2.69183 115.673 1.80778 1.43 -.94 -.08 -.69 .28 .24 .908
    1 350 7.47205 2.69183 115.673 1.80778 1.23 2.08 1.63 .84 .05 .23 .908
    1 351 4.868564 2.69183 115.673 1.80778 3.54 1.02 -.15 -.2 -.45 .24 .908
    1 352 3.725349 2.69183 115.673 1.80778 1.04 .64 .8 .21 .38 .3 .908
    1 353 8.69897 2.69183 115.673 1.80778 2.08 -.19 .96 .57 -.79 .29 .908
    1 354 2.376752 3.55529 146.592 1.22256 4.52 2.78 1.41 -.76 -1.14 .35 .911
    1 355 6.69387 3.55529 146.592 1.22256 3.33 .46 -.37 .49 -.84 .41 .911
    1 356 6.110798 3.55529 146.592 1.22256 2.29 .3 .4 -.04 -.26 .42 .911
    1 357 7.35193 3.55529 146.592 1.22256 1.85 -.12 1.36 -.06 .37 .4 .911
    1 358 2.6591456 3.55529 146.592 1.22256 -.46 -.63 1.35 -1.12 .56 .34 .911
    1 359 4.81953 3.55529 146.592 1.22256 2.43 1.98 .43 -.54 -.35 .37 .911
    1 360 10.360887 3.55529 146.592 1.22256 2.87 .55 1.32 1.37 -.37 .36 .911
    1 361 -4.7395844 3.55529 146.592 1.22256 -4.12 -2.04 1.17 .91 1.28 .43 .911
    1 362 7.434034 3.55529 146.592 1.22256 -.59 -1.63 .1 .6 -.28 .4 .911
    1 363 -3.344086 3.55529 146.592 1.22256 -.25 -2.78 2.5 .32 .8 .4 .911
    1 364 2.868844 3.55529 146.592 1.22256 2.23 .13 -.74 -.58 .61 .42 .911
    1 365 1.592429 3.55529 146.592 1.22256 .6 -1.33 .5 -.04 1.14 .41 .911
    1 366 .4247295 2.32761 152.035 3.12229 .93 .93 .13 -.37 .63 .44 .915
    1 367 6.83997 2.32761 152.035 3.12229 3.18 .66 -3.01 1.16 -1.44 .32 .915
    1 368 -1.810094 2.32761 152.035 3.12229 -4.65 -3.39 -.65 .83 2 .34 .915
    1 369 1.0635753 2.32761 152.035 3.12229 -1.53 -.83 .76 .13 -.07 .27 .915
    1 370 .4305763 2.32761 152.035 3.12229 -.55 1.51 .78 .14 .05 .38 .915
    1 371 7.267241 2.32761 152.035 3.12229 1.76 .22 .48 .46 -.2 .43 .915
    1 372 9.770726 2.32761 152.035 3.12229 3.71 -.81 .31 .37 .24 .44 .915
    1 373 3.909745 2.32761 152.035 3.12229 2.49 -.77 .63 .5 -.21 .41 .915
    1 374 7.252221 2.32761 152.035 3.12229 -.79 1.08 .06 1.11 -.32 .4 .915
    1 375 -2.5075 2.32761 152.035 3.12229 -2.37 .23 -.9 .69 -.85 .4 .915
    1 376 -5.857945 2.32761 152.035 3.12229 -1.14 -3.48 -.48 -.17 .86 .42 .915
    1 377 12.267598 2.32761 152.035 3.12229 4.42 -2.34 -1.63 -.22 -2.33 .32 .915
    1 378 -3.742432 4.3503 64.8141 1.52197 -7.85 -.81 2.68 -1.17 2.45 .21 .92
    1 379 -13.290196 4.3503 64.8141 1.52197 -19.51 -2.56 .03 1.85 5.46 .08 .92
    1 380 -1.6142213 4.3503 64.8141 1.52197 -6.53 -.62 -1.61 1.47 3.5 .03 .92
    1 381 6.613501 4.3503 64.8141 1.52197 4.44 2.1 .46 -.75 .62 0 .92
    1 382 7.874167 4.3503 64.8141 1.52197 -.04 2.02 -.82 1.68 -1.21 .13 .92
    1 383 -4.3738112 4.3503 64.8141 1.52197 -1.25 -.56 1.47 .01 1.87 .17 .92
    1 384 4.922349 4.3503 64.8141 1.52197 4.92 -2.76 -.42 1.43 -1.82 .18 .92
    1 385 5.951562 4.3503 64.8141 1.52197 1.83 1.51 -1.59 .57 -.85 .18 .92
    1 386 5.117455 4.3503 64.8141 1.52197 -8.06 1.21 -1.1 1.67 .76 .17 .92
    1 387 -6.533714 4.3503 64.8141 1.52197 -2.79 -.06 2.09 -1.47 3.6 .15 .92
    1 388 -8.706715 4.3503 64.8141 1.52197 -2.1 -.23 .15 1.14 2.3 .13 .92
    1 389 -11.125276 4.3503 64.8141 1.52197 -12.28 -.78 2.44 -.47 6.01 .15 .92
    1 390 -4.796246 1.77112 135.975 -.211201 -8.55 1.59 -4.62 .88 -1.99 0 .921
    1 391 3.712848 1.77112 135.975 -.211201 -2.1 -.56 -2.19 3.42 -.67 0 .921
    1 392 3.7155445 1.77112 135.975 -.211201 3.64 -2.46 -1.35 .95 -.52 0 .921
    1 393 2.2699454 1.77112 135.975 -.211201 1.93 .85 .79 .95 -.44 .01 .921
    1 394 -.0902156 1.77112 135.975 -.211201 -9.93 .49 -4.14 2.4 -1.79 .01 .921
    1 395 10.217355 1.77112 135.975 -.211201 7.27 -1.25 0 -.5 -2.93 .02 .921
    1 396 7.600992 1.77112 135.975 -.211201 11.41 2.05 2.75 .55 -4.06 .01 .921
    1 397 10.264106 1.77112 135.975 -.211201 9.95 1.51 .03 -.34 -3.72 0 .921
    1 398 3.92436 1.77112 135.975 -.211201 -.26 2.72 -1.58 .07 .53 .01 .921
    1 399 5.984081 1.77112 135.975 -.211201 8.6 -.72 3.93 .1 .34 .01 .921
    1 400 5.70101 1.77112 135.975 -.211201 3.88 1.51 4.59 -1.56 1.61 .01 .921
    1 401 7.508363 1.77112 135.975 -.211201 4.46 1.84 .55 .91 -.75 .01 .921
    1 402 -4.989778 2.91834 126.743 .595354 -3.73 2.59 -.06 -.03 1.05 0 .923
    1 403 4.062807 2.91834 126.743 .595354 3.94 -.14 -1.23 1.15 .15 .01 .923
    1 404 1.1356766 2.91834 126.743 .595354 -2.17 2 -.74 -.08 .91 .01 .923
    1 405 10.845475 2.91834 126.743 .595354 7.6 2.01 1.79 -2.12 1.57 .01 .923
    1 406 -.8442482 2.91834 126.743 .595354 1.29 .1 .14 -.39 -.62 0 .923
    1 407 7.993305 2.91834 126.743 .595354 6.24 .23 3.07 -.32 -.13 .01 .923
    1 408 3.181489 2.91834 126.743 .595354 .48 3.96 .82 .81 .74 .01 .923
    1 409 -10.058084 2.91834 126.743 .595354 -9.54 -.29 -2.49 .02 .18 .01 .923
    1 410 .4347875 2.91834 126.743 .595354 -3.15 -.05 -2.69 .23 -.26 .01 .923
    1 411 8.028027 2.91834 126.743 .595354 8.21 -1.45 1.29 -.55 1.81 .01 .923
    1 412 .5102112 2.91834 126.743 .595354 -3.9 -.35 -1.92 1.55 -2.76 .01 .923
    1 413 9.997296 2.91834 126.743 .595354 9.85 1.35 -1.6 -.34 1.3 .01 .923
    1 414 -4.2997527 3.30385 85.7129 1.05575 2.13 -1.37 2.81 -.76 1.66 .01 .925
    1 415 10.53733 3.30385 85.7129 1.05575 10.01 -2.38 -1.92 -.22 -.98 0 .925
    1 416 -3.642836 3.30385 85.7129 1.05575 -2.64 -1.01 -.75 1.43 .55 0 .925
    1 417 2.704172 3.30385 85.7129 1.05575 -.44 -.27 1.81 .25 1.44 0 .925
    1 418 1.5008903 3.30385 85.7129 1.05575 3.49 .11 .47 -.69 .14 .01 .925
    1 419 1.354322 3.30385 85.7129 1.05575 -.68 1.29 -1.58 1.72 -.22 .01 .925
    1 420 7.289534 3.30385 85.7129 1.05575 4.47 -.83 -1.83 1.37 -.11 0 .925
    1 421 -.5046182 3.30385 85.7129 1.05575 -2.1 -.44 -1.33 1.95 -.63 0 .925
    1 422 1.3661323 3.30385 85.7129 1.05575 -1.52 -.12 .49 1.85 -.43 0 .925

    The data I am using is hedge fund returns by country and I am attempting to see if returns are affected depending on which country the fund is domiciled in.

    If anyone is able to assist me with my problem it would be greatly appreciated

  • #2
    Welcome to Statalist.

    It'd be helpful to at least tell us:
    1. The code of the model that you ran
    2. The actual definition "having trouble doing so." Did you get an error? Did the beta showing up as omitted? Etc.

    Comment


    • #3
      Thanks for the quick reply Ken. I ran a regression of

      by Dom: reg w_rollingperformance MktRF SMB HML.

      This gives me the overall coefficient for each independent variable per country but what I am looking for is each coefficient of each independent variable per monthly return and to store these coefficients as separate variables in the dataset if that makes sense? So I didn't get an error message I am just unsure on what to do to get this information from the dataset.

      Comment


      • #4
        Still not too sure about the question, because I didn't see anything related "per monthly return." I did see a date but it's not formatted as something Stata can interpret.

        Anyhow, a command that is useful for running many regressions followed by saving the outputs as a data set is statsby. You can use help statsby to learn more. Here is an example using a built-in dataset:

        Code:
        sysuse nlsw88, clear
        
        * Let's say this is the model:
        reg wage i.race age hours
        
        * To loop this over "grade" and export the coefficient:
        statsby _b[2.race] _b[3.race] _b[age] _b[hours] _b[_cons], by(grade): reg wage i.race age hours
        
        * And if you are not sure what the coefficients are called, run:
        reg wage i.race age hours, coeflegend
        So, with very limited understanding on my side, I'm guessing something like this:

        Code:
        statsby _b[w_rollingperformance] _b[MktRF] _b[SMB] _b[HML] _b[_cons], by(Dom): reg w_rollingperformance MktRF SMB HML

        Comment


        • #5
          Hi Ken,

          The code you provided despite my poor explanation ran and produced the following data:

          input long Dom float(_stat_1 _stat_2 _stat_3 _stat_4)
          1 .7606097 .4882778 -.13157566 .8394325
          2 .4570877 -.025453834 -.2120535 -.010856646
          3 .4002615 .27843446 .016526276 .4432861
          4 .4369325 .3544034 -.2691492 .9848767
          5 .5247886 .4671575 1.0518899 -1.9135516
          6 .5419511 .4591544 .16145937 .8858464
          7 .33429125 .2849044 .04186478 .8711806
          8 .3391567 .03785133 -.3107762 .92203
          9 .0491387 -.04772006 -.07109444 .4048271
          10 .26298115 .08810613 -.022207905 .6787176
          11 .4222111 .42271546 .2172042 -.12848902
          12 .7372836 -.5507823 -.2066535 -.5550488
          13 .2045164 .11067571 .07496166 .3962315
          14 .42456084 .07935928 .15759166 .10828275
          15 .7787618 .4123337 .14544873 .8992686
          16 .11616552 -.15797202 -.005183562 .167129
          17 .3818074 .1910281 -.09378766 .3186618
          18 .6544379 .12404907 -.09363513 .15331326
          19 .7317508 .6366329 -.15222113 .7161612
          20 .22465764 .03939031 .25117952 .7018836
          21 .5675365 .13457063 .23671393 -.55113524
          22 .6590059 -.03825416 .13320667 -1.1545677
          23 .0036441644 .02182176 -.05695591 1.501278
          24 .3282415 .5471766 .028988555 .57576627
          25 .6693143 .58366 .26450413 1.1079538
          26 .6190763 .14841492 .05056467 -.08843616
          27 .655951 -.028213607 -.04892578 -.09886978
          28 .5197417 .07836565 -.08951684 .39356685
          29 1.4791453 -1.533631 1.0185724 -4.845376
          30 .009847125 -.08247767 .016942294 .3594066
          31 .3526996 .21079268 .011250583 .8478047

          This gives me the coefficients for each independent variable for each of the 31 countries I am examining. This is great but I'll try to explain which data I need a bit more clearly. The code you provided has given me the coefficients per country per each monthly return whereas I need the coefficients per date per each monthly return if that makes sense. But when I substitute Date for Dom in the above code it doesn't return the coefficients. Is this perhaps because I do not have the dates formatted correctly?

          Apologies again if it is confusing to understand it's quite tricky to try and explain.

          Comment


          • #6
            1. So, when the "date" variable says 422 what does that mean? 422nd month?
            2. Also, can you more clearly describe what happened with "it doesn't return the coefficients"? Did you get an error or did they look empty? On this forum, the exact description of unexpected outcome is always necessary.

            Comment


            • #7
              422 is the date 2011-06 but it is actually the 422nd month from the start date of my dataset which is 1977-10. As for "it doesn't return the coefficients" the data returned is as follows:

              1 . . . .
              2 . . . .
              3 . . . .
              4 . . . .
              5 . . . .
              6 . . . .
              7 . . . .
              8 . . . .
              9 . . . .
              10 . . . .
              11 . . . .
              12 . . . .
              13 . . . .
              14 . . . .
              15 . . . .
              16 . . . .
              17 . . . .
              18 . . . .
              19 . . . .
              20 . . . .
              21 . . . .
              22 . . . .
              23 . . . .
              24 . . . .
              25 . . . .
              26 . . . .
              27 . . . .
              28 . . . .
              29 . . . .
              30 . . . .
              31 . . . .
              32 . . . .
              33 . . . .
              34 . . . .
              35 . . . .
              36 . . . .
              37 . . . .
              38 . . . .
              39 . . . .
              40 . . . .
              41 . . . .
              42 . . . .
              43 . . . .
              44 . . . .
              45 . . . .
              46 . . . .
              47 . . . .
              48 . . . .
              49 . . . .
              50 . . . .
              51 . . . .
              52 . . . .
              53 . . . .
              54 . . . .
              55 . . . .
              56 . . . .
              57 . . . .
              58 . . . .
              59 . . . .
              60 . . . .
              61 . . . .
              62 . . . .
              63 . . . .
              64 . . . .
              65 . . . .
              66 . . . .
              67 . . . .
              68 . . . .
              69 . . . .
              70 . . . .
              71 . . . .
              72 . . . .
              73 . . . .
              74 . . . .
              75 . . . .
              76 . . . .
              77 . . . .
              78 . . . .
              79 . . . .
              80 . . . .
              81 . . . .
              82 . . . .
              83 . . . .
              84 . . . .
              85 . . . .
              86 . . . .
              87 . . . .
              88 . . . .
              89 . . . .
              90 . . . .
              91 . . . .
              92 . . . .
              93 . . . .
              94 . . . .
              95 . . . .
              96 . . . .
              97 . . . .
              98 . . . .
              99 . . . .
              100 . . . .
              101 . . . .
              102 . . . .
              103 . . . .
              104 . . . .
              105 . . . .
              106 . . . .
              107 . . . .
              108 . . . .
              109 . . . .
              110 . . . .
              111 . . . .
              112 . . . .
              113 . . . .
              114 . . . .
              115 . . . .
              116 . . . .
              117 . . . .
              118 . . . .
              119 . . . .
              120 . . . .
              121 . . . .
              122 . . . .
              123 . . . .
              124 . . . .
              125 . . . .
              126 . . . .
              127 . . . .
              128 . . . .
              129 . . . .
              130 . . . .
              131 . . . .
              132 . . . .
              133 . . . .
              134 . . . .
              135 . . . .
              136 . . . .
              137 . . . .
              138 . . . .
              139 . . . .
              140 . . . .
              141 . . . .
              142 . . . .
              143 . . . .
              144 . . . .
              145 . . . .
              146 . . . .
              147 . . . .
              148 . . . .
              149 . . . .
              150 . . . .
              151 . . . .
              152 . . . .
              153 . . . .
              154 . . . .
              155 . . . .
              156 . . . .
              157 0 0 0 -1.7882607
              158 0 0 0 2.54302
              159 0 0 0 2.2372997
              160 . . . .
              161 . . . .
              162 . . . .
              163 . . . .
              164 . . . .
              165 0 0 0 .9223845
              166 0 0 0 -2.750789
              167 0 0 0 -.5329759
              168 0 0 0 3.675598
              169 0 0 0 3.469343
              170 0 0 0 -2.86486
              171 0 0 0 8.605598
              172 0 0 0 5.624561
              173 0 0 0 7.907956
              174 0 0 0 1.0929916
              175 0 0 0 3.4425354
              176 0 0 0 -5.003806
              177 0 0 0 3.464592
              178 0 0 0 3.7263556
              179 0 0 0 1.325958
              180 0 0 0 .6767432
              181 0 0 0 -.1884735
              182 0 0 0 5.136836
              183 0 0 0 -.7475795
              184 0 0 0 .7643068
              185 0 0 0 .13028169
              186 0 0 0 -1.9973378
              187 0 0 0 1.6883205
              188 0 0 0 2.993472
              189 0 0 0 4.1467605
              190 0 0 0 -.03982977
              191 0 0 0 .23740634
              192 0 0 0 .7313796
              193 0 0 0 2.3498168
              194 0 0 0 1.4658573
              195 0 0 0 8.068813
              196 0 0 0 1.3032956
              197 0 0 0 2.2360525
              198 0 0 0 1.869946
              199 0 0 0 3.409041
              200 0 0 0 2.5604045
              201 0 0 0 4.1142373
              202 0 0 0 2.7943025
              203 0 0 0 1.7820222
              204 0 0 0 1.0140516
              205 0 0 0 -1.0320792
              206 0 0 0 .7496175
              207 0 0 0 -.6296057
              208 0 0 0 -.9281559
              209 0 0 0 -.10787938
              210 0 0 0 -1.482721
              211 0 0 0 .8978804
              212 0 0 0 -.4031293
              213 0 0 0 1.6119574
              214 0 0 0 2.45986
              215 0 0 0 2.855752
              216 0 0 0 -2.508358
              217 0 0 0 -1.0075419
              218 0 0 0 .8220685
              219 0 0 0 6.132732
              220 0 0 0 1.8127472
              221 0 0 0 4.6486306
              222 0 0 0 2.437518
              223 0 0 0 4.1680045
              224 0 0 0 3.196016
              225 0 0 0 1.4177116
              226 0 0 0 -.29571545
              227 0 0 0 .4391829
              228 0 0 0 -1.0025383
              229 0 0 0 3.404525
              230 0 0 0 1.954853
              231 0 0 0 -.04437708
              232 0 0 0 .25902653
              233 0 0 0 1.7052687
              234 0 0 0 6.546594
              235 0 0 0 .4344779
              236 0 0 0 1.721917
              237 0 0 0 -2.729549
              238 0 0 0 1.702263
              239 0 0 0 2.580531
              240 0 0 0 4.697784
              241 0 0 0 -1.9654526
              242 0 0 0 -2.2154622
              243 0 0 0 2.4854536
              244 0 0 0 .687387
              245 0 0 0 -.6463294
              246 0 0 0 -.834232
              247 0 0 0 2.952951
              248 0 0 0 4.0598655
              249 0 0 0 5.81165
              250 0 0 0 -1.723186
              251 0 0 0 3.66013
              252 0 0 0 -1.4365523
              253 0 0 0 1.8131993
              254 0 0 0 1.3383964
              255 0 0 0 3.9896536
              256 0 0 0 3.622138
              257 0 0 0 4.0068293
              258 0 0 0 .6967539
              259 0 0 0 -1.0241596
              260 0 0 0 -.6127998
              261 0 0 0 1.6840285
              262 0 0 0 .18067354
              263 0 0 0 4.79304
              264 0 0 0 .1759425
              265 0 0 0 -2.2043295
              266 0 0 0 4.456694
              267 0 0 0 6.616582
              268 0 0 0 1.5001192
              269 0 0 0 3.190824
              270 0 0 0 2.6339765
              271 0 0 0 1.8066647
              272 0 0 0 3.305046
              273 0 0 0 .8451826
              274 0 0 0 1.801719
              275 0 0 0 2.687631
              276 0 0 0 1.56574
              277 0 0 0 -2.222431
              278 0 0 0 .5481677
              279 0 0 0 4.781434
              280 0 0 0 4.128241
              281 0 0 0 .496241
              282 0 0 0 -2.6174755
              283 0 0 0 -1.0750346
              284 0 0 0 3.629368
              285 0 0 0 -1.1345185
              286 0 0 0 2.586594
              287 0 0 0 -1.3876655
              288 0 0 0 2.578124
              289 0 0 0 1.9651012
              290 0 0 0 .26793197
              291 0 0 0 .1631698
              292 0 0 0 -1.437533
              293 0 0 0 -.6682289
              294 0 0 0 -.16263877
              295 0 0 0 1.359217
              296 0 0 0 .39885345
              297 0 0 0 -.7021209
              298 0 0 0 .3358777
              299 0 0 0 -1.2870698
              300 0 0 0 .8671119
              301 0 0 0 .3107343
              302 0 0 0 1.7938036
              303 0 0 0 2.870297
              304 0 0 0 .23990548
              305 0 0 0 2.4199855
              306 0 0 0 2.2893777
              307 0 0 0 2.464903
              308 0 0 0 1.4972696
              309 0 0 0 -1.148742
              310 0 0 0 1.821207
              311 0 0 0 -.55624664
              312 0 0 0 2.8431494
              313 0 0 0 3.368915
              314 0 0 0 1.8553407
              315 0 0 0 5.42203
              316 0 0 0 2.6187904
              317 0 0 0 -2.670999
              318 0 0 0 4.4314513
              319 0 0 0 6.54741
              320 0 0 0 .623268
              321 0 0 0 .8114111
              322 0 0 0 .9441531
              323 0 0 0 3.153743
              324 . . . .
              325 . . . .
              326 . . . .
              327 0 0 0 .8263388
              328 0 0 0 3.627918
              329 0 0 0 7.066031
              330 0 0 0 3.299406
              331 0 0 0 4.001568
              332 0 0 0 .3591135
              333 0 0 0 -4.1382046
              334 0 0 0 .12035535
              335 0 0 0 -.05248924
              336 0 0 0 -.19711477
              337 0 0 0 -.24318385
              338 0 0 0 3.887838
              339 . . . .
              340 . . . .
              341 . . . .
              342 0 0 0 -2.5647244
              343 0 0 0 -3.1092696
              344 0 0 0 3.651109
              345 0 0 0 3.390483
              346 0 0 0 3.724436
              347 0 0 0 -1.5071877
              348 0 0 0 -2.6320136
              349 0 0 0 -.017039597
              350 0 0 0 2.0816758
              351 0 0 0 2.38123
              352 0 0 0 2.1988816
              353 0 0 0 2.56535
              354 0 0 0 5.909122
              355 0 0 0 3.768249
              356 0 0 0 3.873747
              357 0 0 0 2.999034
              358 0 0 0 -.6891288
              359 0 0 0 3.8538575
              360 0 0 0 5.897731
              361 0 0 0 -1.566509
              362 0 0 0 -1.962781
              363 0 0 0 -1.527363
              364 0 0 0 2.0638754
              365 0 0 0 .53817505
              366 0 0 0 1.1063833
              367 0 0 0 4.700454
              368 0 0 0 -1.429755
              369 0 0 0 .8875386
              370 0 0 0 -.1925897
              371 0 0 0 .9485995
              372 0 0 0 5.177398
              373 0 0 0 2.858654
              374 0 0 0 1.7110724
              375 0 0 0 .0957566
              376 0 0 0 -2.0871358
              377 0 0 0 5.909588
              378 0 0 0 -3.0552435
              379 0 0 0 -6.834568
              380 0 0 0 -1.441031
              381 0 0 0 4.7012277
              382 0 0 0 3.9750135
              383 0 0 0 -.8384295
              384 0 0 0 1.651497
              385 0 0 0 .8495483
              386 0 0 0 -.4086961
              387 0 0 0 -2.825472
              388 0 0 0 -4.3241878
              389 0 0 0 -6.69053
              390 0 0 0 -3.535351
              391 0 0 0 .8467969
              392 0 0 0 4.492511
              393 0 0 0 -1.2885823
              394 0 0 0 -1.72348
              395 0 0 0 4.2685666
              396 0 0 0 4.08837
              397 0 0 0 6.725787
              398 0 0 0 .6768551
              399 0 0 0 4.1910324
              400 0 0 0 2.319998
              401 0 0 0 4.278198
              402 0 0 0 -2.1556764
              403 0 0 0 3.182894
              404 0 0 0 -2.3384478
              405 0 0 0 5.402298
              406 0 0 0 .14581004
              407 0 0 0 3.81223
              408 0 0 0 .6246623
              409 0 0 0 -6.023701
              410 0 0 0 -.51842165
              411 0 0 0 4.964925
              412 0 0 0 .3737543
              413 0 0 0 7.010422
              414 0 0 0 .29746783
              415 0 0 0 3.6710236
              416 0 0 0 -3.170248
              417 0 0 0 -1.8278114
              418 0 0 0 2.621568
              419 0 0 0 1.418016
              420 0 0 0 4.989111
              421 0 0 0 -2.799564
              422 0 0 0 -.8379345
              423 0 0 0 .9331465
              424 0 0 0 -2.0574691
              425 0 0 0 -6.547884
              426 0 0 0 2.849659
              427 0 0 0 -.3872715
              428 0 0 0 .504855
              429 0 0 0 2.629084
              430 0 0 0 3.338702
              431 0 0 0 -1.3835152
              432 0 0 0 -.12255343
              433 0 0 0 -4.119591
              434 0 0 0 1.5882108
              435 0 0 0 .384168
              436 0 0 0 1.2711047
              437 0 0 0 2.344106
              438 0 0 0 2.915382
              439 0 0 0 2.1089876
              440 0 0 0 .16866413
              441 0 0 0 1.3753067
              442 0 0 0 -1.0148652
              443 0 0 0 -.003113585
              444 0 0 0 2.2037373
              445 0 0 0 -1.3299094
              446 0 0 0 -1.436324
              447 0 0 0 1.8174446
              448 0 0 0 -.9061907
              449 0 0 0 2.972715
              450 0 0 0 -2.0557425
              451 0 0 0 -.26809016
              452 0 0 0 .9360279
              453 0 0 0 -1.6520773
              454 0 0 0 3.05618
              455 0 0 0 .6424983
              456 0 0 0 .4711663
              457 0 0 0 .7131944
              458 0 0 0 1.1763971
              459 0 0 0 -1.4196012
              460 0 0 0 .8481898
              461 0 0 0 -1.974276
              462 0 0 0 -1.0547433
              463 0 0 0 1.3764433
              464 0 0 0 -.8323529
              465 0 0 0 .2393252
              466 0 0 0 1.3670506
              467 0 0 0 -1.172363
              468 0 0 0 2.629783
              469 0 0 0 -.4615532
              470 0 0 0 -.50221497
              471 0 0 0 -.2840908
              472 0 0 0 -2.688898
              473 0 0 0 -.8637602
              474 0 0 0 -2.3398519
              475 0 0 0 -1.9999788
              476 0 0 0 -2.0204964
              477 0 0 0 .5824781
              478 0 0 0 .1497273
              479 0 0 0 4.941984
              480 0 0 0 .9625029
              481 0 0 0 -1.502559
              482 0 0 0 .9813345
              483 0 0 0 2.1083226
              484 0 0 0 .11741727
              485 0 0 0 1.0789403
              486 0 0 0 2.3974185
              487 0 0 0 .6348416
              488 0 0 0 1.5645576
              489 0 0 0 2.2789338
              490 0 0 0 .984327
              491 0 0 0 .5972265
              492 0 0 0 1.1730032
              493 0 0 0 1.6102564
              494 0 0 0 .7447472
              495 0 0 0 2.7202535
              496 0 0 0 1.2084086
              497 0 0 0 -.13759907
              498 0 0 0 4.0901747
              499 0 0 0 -4.1596274
              500 0 0 0 -.069970235
              501 0 0 0 -1.4353913
              502 0 0 0 -3.0630674
              503 0 0 0 -.9528926
              504 0 0 0 -.3255192
              505 0 0 0 -1.281682
              506 0 0 0 -1.1430699
              507 0 0 0 1.0492007
              508 0 0 0 -.7564256
              509 0 0 0 -.17305963
              510 0 0 0 2.964526
              511 0 0 0 .9793618
              512 0 0 0 .3299157
              513 0 0 0 2.420127
              514 0 0 0 .8825688
              515 0 0 0 .6136953
              516 0 0 0 1.0226053
              517 0 0 0 -1.1931114
              518 0 0 0 3.0183804
              519 0 0 0 -.7044319
              520 0 0 0 -.784647
              521 0 0 0 -.16522866
              522 0 0 0 -.3673746
              523 0 0 0 -.12847112
              524 0 0 0 5.51447
              525 0 0 0 4.2941794
              526 0 0 0 -2.496754
              527 0 0 0 -5.34657
              528 0 0 0 3.715836
              529 0 0 0 2.457945
              530 0 0 0 2.4089625
              531 0 0 0 4.748903
              532 0 0 0 2.303772
              533 0 0 0 -2.1994183
              534 0 0 0 .3994827
              535 0 0 0 1.7981707
              536 0 0 0 -3.121339
              537 0 0 0 1.2726983
              538 0 0 0 1.8873994
              539 0 0 0 -.3080572
              540 0 0 0 2.855128
              541 0 0 0 1.9366882
              542 0 0 0 -1.1565744
              543 0 0 0 .1882932
              544 0 0 0 .9578025
              545 0 0 0 -1.6448677
              546 0 0 0 -1.514066
              547 0 0 0 -.4175013
              548 . . . .

              With 1 being the first date in the dataset 1977-10 and 548 being the last date 2022-03.

              Thank you again for your help.

              Comment


              • #8
                You can try:

                Code:
                reg w_rollingperformance MktRF SMB HML if date==1
                and see how many observations are in the regression model (it should appear at the top right). My guess is that you have fewer number of countries with records dated back that early than the model can afford. You have four betas + intercept which means you'll need at least 4+1+1 = 6 countries, an extra +1 for the error degree of freedom.

                As for why all the betas are zero, usually it's because they have the same dependent variable value. Aka, all the countries share the same MktRF within each month, creating a flat regression line. You can check with

                Code:
                tabstat w_rollingperformance if inlist(date, 500, 510, 520, 530), by(date) stat(mean sd min max)

                Comment


                • #9
                  When I run the first code I get this error: reg w_rollingperformance MktRF SMB HML if date==1 no observations

                  As for the second code, it produced the following table

                  date | Mean SD Min Max
                  ----------+----------------------------------------
                  2018-011 | -.0699702 2.095089 -3.680611 5.909188
                  2019-01 | 2.964526 3.081287 -1.718028 11.9062
                  2019-08 | -.784647 2.531177 -6.425319 5.14885
                  2020-06 | 2.408963 2.350614 -1.418417 9.307755
                  ----------+----------------------------------------
                  Total | 1.141039 2.968849 -6.425319 11.9062
                  ---------------------------------------------------


                  Comment


                  • #10
                    The first says "no observations" which means the data do not have any valid cases for those time points, thus there were no regression models.

                    The second is odd because it looks like you do have variability in the dependent variable. Could you perhaps post the full data for a certain month, like: dataex date w_rollingperformance MktRF SMB HML if date==540? That way users here can try run the regression and investigate why all the betas showed "0".
                    Last edited by Ken Chui; 26 Apr 2022, 10:59.

                    Comment


                    • #11
                      540 4.1315246 4.49 -1.22 -1.97
                      540 2.8121884 4.49 -1.22 -1.97
                      540 5.311934 4.49 -1.22 -1.97
                      540 5.311923 4.49 -1.22 -1.97
                      540 2.749865 4.49 -1.22 -1.97
                      540 3.8946686 4.49 -1.22 -1.97
                      540 .4133448 4.49 -1.22 -1.97
                      540 3.946039 4.49 -1.22 -1.97
                      540 3.892389 4.49 -1.22 -1.97
                      540 4.0171 4.49 -1.22 -1.97
                      540 2.0891922 4.49 -1.22 -1.97
                      540 2.394556 4.49 -1.22 -1.97
                      540 2.794036 4.49 -1.22 -1.97
                      540 2.1746635 4.49 -1.22 -1.97
                      540 4.019618 4.49 -1.22 -1.97
                      540 3.64831 4.49 -1.22 -1.97
                      540 2.7158375 4.49 -1.22 -1.97
                      540 3.000491 4.49 -1.22 -1.97
                      540 2.9321954 4.49 -1.22 -1.97
                      540 2.271261 4.49 -1.22 -1.97
                      540 .4512209 4.49 -1.22 -1.97
                      540 3.302429 4.49 -1.22 -1.97
                      540 1.52 4.49 -1.22 -1.97
                      540 1.169814 4.49 -1.22 -1.97
                      540 .11628571 4.49 -1.22 -1.97
                      540 2.3228958 4.49 -1.22 -1.97
                      540 3.8977385 4.49 -1.22 -1.97
                      540 5.497185 4.49 -1.22 -1.97
                      540 0 4.49 -1.22 -1.97

                      Comment


                      • #12
                        To have your data format correctly so that other people can use, next time, please post the lines with "CODE" till ending line with "CODE".

                        Originally posted by David Connaughton View Post
                        540 4.1315246 4.49 -1.22 -1.97
                        540 2.8121884 4.49 -1.22 -1.97
                        540 5.311934 4.49 -1.22 -1.97
                        540 5.311923 4.49 -1.22 -1.97
                        540 2.749865 4.49 -1.22 -1.97
                        540 3.8946686 4.49 -1.22 -1.97
                        540 .4133448 4.49 -1.22 -1.97
                        540 3.946039 4.49 -1.22 -1.97
                        540 3.892389 4.49 -1.22 -1.97
                        540 4.0171 4.49 -1.22 -1.97
                        540 2.0891922 4.49 -1.22 -1.97
                        540 2.394556 4.49 -1.22 -1.97
                        540 2.794036 4.49 -1.22 -1.97
                        540 2.1746635 4.49 -1.22 -1.97
                        540 4.019618 4.49 -1.22 -1.97
                        540 3.64831 4.49 -1.22 -1.97
                        540 2.7158375 4.49 -1.22 -1.97
                        540 3.000491 4.49 -1.22 -1.97
                        540 2.9321954 4.49 -1.22 -1.97
                        540 2.271261 4.49 -1.22 -1.97
                        540 .4512209 4.49 -1.22 -1.97
                        540 3.302429 4.49 -1.22 -1.97
                        540 1.52 4.49 -1.22 -1.97
                        540 1.169814 4.49 -1.22 -1.97
                        540 .11628571 4.49 -1.22 -1.97
                        540 2.3228958 4.49 -1.22 -1.97
                        540 3.8977385 4.49 -1.22 -1.97
                        540 5.497185 4.49 -1.22 -1.97
                        540 0 4.49 -1.22 -1.97
                        The issue that you got no estimate is the other side being constant. In regression analysis, the independent variables cannot be a constant.

                        Code:
                              Source |       SS           df       MS      Number of obs   =        29
                        -------------+----------------------------------   F(1, 27)        =         .
                               Model |           0         1           0   Prob > F        =         .
                            Residual |           0        27           0   R-squared       =         .
                        -------------+----------------------------------   Adj R-squared   =         .
                               Total |           0        28           0   Root MSE        =         0
                        
                        ------------------------------------------------------------------------------
                                   y | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                        -------------+----------------------------------------------------------------
                                  x1 |          0  (omitted)
                                  x2 |          0  (omitted)
                                  x3 |          0  (omitted)
                               _cons |        540          .        .       .            .           .
                        ------------------------------------------------------------------------------
                        Essentially, we cannot model vertical regression line. You may have to investigate why those values are the same across country within month. And may have to consider revising those numbers separately by country.

                        Comment

                        Working...
                        X