Announcement

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

  • How to run independent t-test formula for two quartile portfolios after double sorting

    Dear Statalists,

    I would like to perform the following independent t-test formula for two quartile portfolios' returns, m_A and m_B are average returns individually for two quartile portfolios, S^2 is the common variance of the two quartile portfolios. Thus, I just wonder, do we have a Stata function code to run this formula or we have to calculate by hand? Many thanks for your time in advance!
    Click image for larger version

Name:	t-test.JPG
Views:	1
Size:	9.4 KB
ID:	1421563


  • #2
    you don't tell us anything about how your data are setup (please read the FAQ), so
    Code:
    help ttest

    Comment


    • #3
      Just a remark and a question unrelated to Stata:
      • in general contemporaneous portfolio returns will be correlated, so using an independent sample t-test would not make sense.
      • How do you know that both portfolios share the same volatility?

      Comment


      • #4
        @Rich Goldstein Hi Rich, thank for your reply! My apologies for replying late as I am still stuck by this issue now and really needs some help. Here is my partial data:

        P1 are the first quartile sorted portfolios based on quarters and P2 are the second quartile sorted portfolios based on quarters and P1. alpha is the b_cons from regressions.

        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input float(quarter alpha P1 P2)
              85  .02398583 1 1
            85.5  .02398583 1 1
              86  .02398583 1 1
            86.5  .02398583 1 1
        86.66666  .02398583 1 1
              87  .02398583 1 1
        87.33334  .02398583 1 1
            87.5  .02398583 1 1
            87.8  .02398583 1 1
              88  .02398583 1 1
        88.33334  .02398583 1 1
            88.5  .02398583 1 1
        88.66666  .02398583 1 1
              89  .02398583 1 1
            89.5  .02398583 1 1
            89.8  .02398583 1 1
        89.85714  .02398583 1 1
              90  .02398583 1 1
            90.3  .02398583 1 1
        90.36364  .02398583 1 1
            90.5  .02398583 1 1
              91  .02398583 1 1
        91.42857  .02398583 1 1
            91.5  .02398583 1 1
        91.83334  .02398583 1 1
              85 .013317226 1 2
            85.5 .013317226 1 2
              86 .013317226 1 2
            86.5 .013317226 1 2
        86.66666 .013317226 1 2
              87 .013317226 1 2
            87.5 .013317226 1 2
            87.6 .013317226 1 2
              88 .013317226 1 2
            88.5 .013317226 1 2
        88.57143 .013317226 1 2
              89 .013317226 1 2
            89.2 .013317226 1 2
            89.5 .013317226 1 2
        89.71429 .013317226 1 2
              90 .013317226 1 2
           90.25 .013317226 1 2
            90.5 .013317226 1 2
           90.75 .013317226 1 2
              91 .013317226 1 2
            91.5 .013317226 1 2
          91.625 .013317226 1 2
            91.8 .013317226 1 2
        91.85714 .013317226 1 2
              92 .013317226 1 2
              85 .013127223 1 3
            85.5 .013127223 1 3
              86 .013127223 1 3
            86.5 .013127223 1 3
              87 .013127223 1 3
            87.2 .013127223 1 3
           87.25 .013127223 1 3
        87.33334 .013127223 1 3
            87.5 .013127223 1 3
        87.66666 .013127223 1 3
           87.75 .013127223 1 3
        87.83334 .013127223 1 3
              88 .013127223 1 3
            88.5 .013127223 1 3
        88.66666 .013127223 1 3
              89 .013127223 1 3
        89.33334 .013127223 1 3
            89.5 .013127223 1 3
              90 .013127223 1 3
        90.14286 .013127223 1 3
        90.16666 .013127223 1 3
        90.33334 .013127223 1 3
            90.4 .013127223 1 3
            90.5 .013127223 1 3
           90.75 .013127223 1 3
              85 .009336547 1 4
            85.5 .009336547 1 4
              86 .009336547 1 4
              87 .009336547 1 4
            87.5 .009336547 1 4
            87.6 .009336547 1 4
           87.75 .009336547 1 4
              88 .009336547 1 4
        88.16666 .009336547 1 4
           88.25 .009336547 1 4
        88.33334 .009336547 1 4
            88.5 .009336547 1 4
              89 .009336547 1 4
           89.25 .009336547 1 4
            89.5 .009336547 1 4
        89.83334 .009336547 1 4
              90 .009336547 1 4
        90.14286 .009336547 1 4
        90.16666 .009336547 1 4
        90.33334 .009336547 1 4
            90.5 .009336547 1 4
              91 .009336547 1 4
            91.2 .009336547 1 4
        91.33334 .009336547 1 4
            91.5 .009336547 1 4
        end
        format %tq quarter
        ---------------

        What I want to do is to undertake the t-test for the equality of two coefficients such as the bold fronts from two regressions as follows. Can you possibly give me some ideas how to do this? Many thanks to you in advance!

        Code:
              Source |       SS           df       MS      Number of obs   =     3,422
        -------------+----------------------------------   F(1, 3420)      =    262.09
               Model |  4.34794271         1  4.34794271   Prob > F        =    0.0000
            Residual |  56.7353637     3,420  .016589288   R-squared       =    0.0712
        -------------+----------------------------------   Adj R-squared   =    0.0709
               Total |  61.0833064     3,421  .017855395   Root MSE        =     .1288
        
        ------------------------------------------------------------------------------
            vw_exret |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
             mktrf_q |   .6374946   .0393775    16.19   0.000     .5602888    .7147005
               _cons |   .0323178   .0023467    13.77   0.000     .0277168    .0369189
        ------------------------------------------------------------------------------
        (3,422 real changes made)
        
              Source |       SS           df       MS      Number of obs   =     4,303
        -------------+----------------------------------   F(1, 4301)      =    807.20
               Model |  9.24031972         1  9.24031972   Prob > F        =    0.0000
            Residual |  49.2350295     4,301  .011447345   R-squared       =    0.1580
        -------------+----------------------------------   Adj R-squared   =    0.1578
               Total |  58.4753492     4,302  .013592596   Root MSE        =    .10699
        
        ------------------------------------------------------------------------------
            vw_exret |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
             mktrf_q |   .8077173   .0284294    28.41   0.000     .7519809    .8634536
               _cons |   .0268642    .001724    15.58   0.000     .0234843    .0302441
        ------------------------------------------------------------------------------
        Last edited by Jae Li; 11 Mar 2018, 13:09.

        Comment


        • #5
          The formula you show in #1 is not applicable to the data example you show in #3 where alpha is simply a constant within each portfolio. There is no way to do a ttest of the difference between two constants.

          What you want, I believe, instead, is to compare the _cons terms from the two regressions you show at the end of #4. For that there is a formula that is related to the one you show, but different:

          Code:
          z = (alpha_1 - alpha_2)/sqrt(se_alpha_1^2 + se_alpha_2^2)
          You can calculate this with
          Code:
          scalar se_diff = sqrt(0.0023467^2 + .001724^2)
          scalar z_stat = (.0323178 - .0268642)/se_diff
          scalar p_value = 2*normal(-abs(z_stat))
          
          display se_diff, z_stat, p_value
          To make this process somewhat more automated, you can use -suest- following the two portfolio regressions.

          Code:
          regress vw_exret mkrtf_q if P2 == 1
          estimates store one
          regress vw_exret mkrtf_q if P2 == 2
          estimates store two
          
          suest one two, coefl
          
          test _b[two_mean:_cons] = _b[one_mean:_cons]
          This will give you a chi square test instead of a z-test, but the chi square statistic will be (except perhaps for some rounding/truncation errors) the square of the z-statistic, and the p-values will be the same (again, with perhaps some slight difference due to rounding).

          Comment


          • #6
            @Clyde Schechter Hi Clyde, thank you very much for your explanations and codes!!!! It's exactly what I've been looking for over months!! Thank you very much for your help! It solves my problem! Thanks a lot once again!!

            Comment

            Working...
            X