Announcement

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

  • Geometric Mean: Bugs in meanrets Package for Portfolios?

    I was using the mvport package (SSC) written by Alberto Dorantes. The package has meanrets program for finding geometric mean, however, its results seem to be upward biased, I cross checked it with MS EXCEL and another package gmci (SSC), this is to confirm that the meanrets has bugs, or am I missing something. See the following examples


    Code:
    clear
    input float(Price t)
    12 1 
    10 2 
    12 3 
    15 4 
    13 5 
    18 6 
    24 7 
    18 8 
    17 9 
    22 10 
    end
    tsset t
    gen ri=p/l.p-1
    gen gr=ln(p/l.p)
    
     . meanrets ri gr
    Observations to calculate expected simple returns: 10
    Expected simple returns (Geometric means):
    
          Exp ret
    ri  .09984347
    gr  .06966811
    
    . gmci ri gr, add(1)
     
      Variable  |    Obs     Geometric Mean           [95% Conf. Interval]
    ------------+-----------------------------------------------------------
            ri  |      9           1.06967           0.89375       1.28021 *
            gr  |      9           1.04302           0.87249       1.24687 *
     
    (*) 1 was added to the variable(s) prior to calculating the results
    
    . sum ri gr
    
        Variable |        Obs        Mean    Std. Dev.       Min        Max
    -------------+---------------------------------------------------------
              ri |          9    .0951679     .244355       -.25   .3846154
              gr |          9    .0673484    .2337455  -.2876821   .3254224
    Note that due to non-positive values, I had add option add(1) to the gmci, which later would be deducted.
    Regards
    --------------------------------------------------
    Attaullah Shah, PhD.
    Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
    FinTechProfessor.com
    https://asdocx.com
    Check out my asdoc program, which sends outputs to MS Word.
    For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

  • #2
    I did not have a deeper look into either package, but official Stata's ameans will calculate geometric (and other) means, so I think there is little need for user-written software here.

    Best
    Daniel

    Comment


    • #3
      Adding 1 and then subtracting it at the end is at best going to give an approximation, as taking the geometric mean is **not** a linear operation. Strictly the geometric mean is either not defined or zero in the presence of zeros.

      Comment


      • #4
        Dear Attaulla:
        My command meanrets has to receive a varlist of "continuously compounded" (cc) returns, not simple returns. In your example, the variable gr is the cc returns for your series. If you type help meanrets, you will see the specification about the cc returns. Unlike ameans and gmci, with meanrets you do not have to add 1 to each return, and you do not have to substract one at the end.
        Then, in your example, you have to run meanrets with gr, that is the cc return. If you see, the result of meanrets for this variable is 0.06966811, that is the same you got with the gmci (after you substract 1).
        Let me know if I was clear.
        Thanks for the comment. I am about to release a new version of the mvport package. I will consider your point. Maybe I can change the meanrets by using simple returns instead of cc returns in the command.
        Best regards... Alberto
        Last edited by Alberto Dorantes; 20 Sep 2015, 20:14.

        Comment

        Working...
        X