Announcement

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

  • Portfolio-level asset pricing using GMM via stata

    Hi,

    I have searched this forum and the whole internet but found few material or discussion on evaluating asset pricing models via GMM using stata. Can anyone provide me an example to estimate the CAPM model via portfolios, e.g., the one in John Cochrane's book entitled "Asset pricing, revised edition" (2005, page 241-243)?


    I have not found any official or user-written command specially for portfolio-level asset pricing using GMM.
    Using the codes below, I have no problem to estimate the first two moments in equation (12.23) using the returns of 25 portfolios (r1, r2, r3, ...r25) and market premium (mktrf).

    gmm ( r1 - {gam0} - mktrf* {gam1}) /// 1st moment
    ( r2 - {gam0} - mktrf * {gam1}) ///
    ( r3 - {gam0} - mktrf * {gam1}) ///
    ( r4 - {gam0} - mktrf * {gam1}) ///
    ( r5 - {gam0} - mktrf * {gam1}) ///
    ( r6 - {gam0} - mktrf * {gam1}) ///
    ( r7 - {gam0} - mktrf * {gam1}) ///
    ( r8 - {gam0} - mktrf * {gam1}) ///
    ( r9 - {gam0} - mktrf * {gam1}) ///
    ( r10 - {gam0} - mktrf * {gam1}) ///
    ( r11 - {gam0} - mktrf * {gam1}) ///
    ( r12 - {gam0} - mktrf * {gam1}) ///
    ( r13 - {gam0} - mktrf * {gam1}) ///
    (r14 - {gam0} - mktrf * {gam1}) ///
    (r15 - {gam0} - mktrf * {gam1}) ///
    (r16 - {gam0} - mktrf * {gam1}) ///
    (r17 - {gam0} - mktrf * {gam1}) ///
    ( r18 - {gam0} - mktrf * {gam1}) ///
    ( r19 - {gam0} - mktrf * {gam1}) ///
    (r20 - {gam0} - mktrf * {gam1}) ///
    (r21 - {gam0} - mktrf * {gam1}) ///
    ( r22 - {gam0} - mktrf * {gam1}) ///
    (r23 - {gam0} - mktrf * {gam1}) ///
    ( r24 - {gam0} - mktrf * {gam1}) ///
    (r25 - {gam0} - mktrf * {gam1}), instruments(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: mktrf) winit(identity) vce(robust)


    However, whenever I try to add the third moment using the mean return of 25 portfolios (rpe), stata shows an error message such as:



    gmm ( r1 - {gam0} - mktrf* {gam1}) /// 1st moment
    ( r2 - {gam0} - mktrf * {gam1}) ///
    ( r3 - {gam0} - mktrf * {gam1}) ///
    ( r4 - {gam0} - mktrf * {gam1}) ///
    ( r5 - {gam0} - mktrf * {gam1}) ///
    ( r6 - {gam0} - mktrf * {gam1}) ///
    ( r7 - {gam0} - mktrf * {gam1}) ///
    ( r8 - {gam0} - mktrf * {gam1}) ///
    ( r9 - {gam0} - mktrf * {gam1}) ///
    ( r10 - {gam0} - mktrf * {gam1}) ///
    ( r11 - {gam0} - mktrf * {gam1}) ///
    ( r12 - {gam0} - mktrf * {gam1}) ///
    ( r13 - {gam0} - mktrf * {gam1}) ///
    (r14 - {gam0} - mktrf * {gam1}) ///
    (r15 - {gam0} - mktrf * {gam1}) ///
    (r16 - {gam0} - mktrf * {gam1}) ///
    (r17 - {gam0} - mktrf * {gam1}) ///
    ( r18 - {gam0} - mktrf * {gam1}) ///
    ( r19 - {gam0} - mktrf * {gam1}) ///
    (r20 - {gam0} - mktrf * {gam1}) ///
    (r21 - {gam0} - mktrf * {gam1}) ///
    ( r22 - {gam0} - mktrf * {gam1}) ///
    (r23 - {gam0} - mktrf * {gam1}) ///
    ( r24 - {gam0} - mktrf * {gam1}) ///
    (r25 - {gam0} - mktrf * {gam1})
    ((rpe - {gam1} *{lambda})), instruments(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: mktrf) winit(identity) vce(robust)

    to avoid a singular initial weight matrix in a model with 25 moment equations you must declare instruments
    for at least 24 equations or use winitial(unadjusted, independent) or winitial(identity)


    When I change the order of the moment, it shows another message:

    . gmm ((rpe - {gam1} *{lambda}))
    ( r1 - {gam0} - mktrf* {gam1}) /// 1st moment
    > ( r2 - {gam0} - mktrf * {gam1}) ///
    > ( r3 - {gam0} - mktrf * {gam1}) ///
    > ( r4 - {gam0} - mktrf * {gam1}) ///
    > ( r5 - {gam0} - mktrf * {gam1}) ///
    > ( r6 - {gam0} - mktrf * {gam1}) ///
    > ( r7 - {gam0} - mktrf * {gam1}) ///
    > ( r8 - {gam0} - mktrf * {gam1}) ///
    > ( r9 - {gam0} - mktrf * {gam1}) ///
    > ( r10 - {gam0} - mktrf * {gam1}) ///
    > ( r11 - {gam0} - mktrf * {gam1}) ///
    > ( r12 - {gam0} - mktrf * {gam1}) ///
    > ( r13 - {gam0} - mktrf * {gam1}) ///
    > (r14 - {gam0} - mktrf * {gam1}) ///
    > (r15 - {gam0} - mktrf * {gam1}) ///
    > (r16 - {gam0} - mktrf * {gam1}) ///
    > (r17 - {gam0} - mktrf * {gam1}) ///
    > ( r18 - {gam0} - mktrf * {gam1}) ///
    > ( r19 - {gam0} - mktrf * {gam1}) ///
    > (r20 - {gam0} - mktrf * {gam1}) ///
    > (r21 - {gam0} - mktrf * {gam1}) ///
    > ( r22 - {gam0} - mktrf * {gam1}) ///
    > (r23 - {gam0} - mktrf * {gam1}) ///
    > ( r24 - {gam0} - mktrf * {gam1}) ///
    > (r25 - {gam0} - mktrf * {gam1}), instruments(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: mktrf) winit(identity) vce(robust)

    Step 1
    could not calculate numerical derivatives -- flat or discontinuous region encountered
    could not calculate numerical derivatives -- flat or discontinuous region encountered

    When I use other specifications, sometimes the GMM criterion is not concave and never show me the results:

    Iteration 7232: GMM criterion Q(b) = .00007252 (not concave)
    Iteration 7233: GMM criterion Q(b) = .00007252 (not concave)
    Iteration 7234: GMM criterion Q(b) = .00007252 (not concave)
    Iteration 7235: GMM criterion Q(b) = .00007251 (not concave)
    Iteration 7236: GMM criterion Q(b) = .00007251 (not concave)
    Iteration 7237: GMM criterion Q(b) = .0000725 (not concave)
    Iteration 7238: GMM criterion Q(b) = .0000725 (not concave)
    Iteration 7239: GMM criterion Q(b) = .0000725 (not concave)
    Iteration 7240: GMM criterion Q(b) = .00007249 (not concave)
    Iteration 7241: GMM criterion Q(b) = .00007249 (not concave)



    Should I switch to another software for Portfolio-level asset pricing using GMM?

  • #2
    BTW, in linear regressions, we can first regress the dependent variable on independent variables to get the crude initial estimates for GMM, which is not straightforward for Portfolio-level asset pricing via GMM. Does anyone has a sample of codes to do so? Thanks.

    Comment


    • #3
      Hi Cheng Yan,

      unfortunately I don't have a solution to your problem, but I'm actually trying to implement the same moment conditions, only with less portfolios. I will try to formulate the problem a bit more precisely, so that it is easier for forum members to help us both.

      I'm trying to estimate several betas and a single risk premium with the same moment conditions:

      Click image for larger version

Name:	moment conditions.PNG
Views:	1
Size:	11.9 KB
ID:	1422011


      (Source: Cochrane(2005), p. 241)

      So, the first two moment conditions are used to estimate the betas (and also the alphas) in time-series regressions, i.e. beta of portfolio1, beta of portfolio 2, ..., beta of portfolio 25. In total, we get 25 different betas (one for each portfolio).

      These 25 betas are then used as the regressors in the last moment condition in the picture above to estimate a single lambda in a cross-sectional regression that can price all portfolios at once.

      The goal is to estimate all moment conditions at once, instead of only estimating the first two moment conditions, storing the estimated betas and then running gmm a second time with only the last moment condition the estimated betas as the regressors. Incorporating all moment conditions at once, should account for the fact that the betas in the last moment condition are actually estimated and not observed.

      I cannot wrap my head around how to incorporate the last moment condition to estimate a single lambda.

      All help would be greatly appreciated!

      Sincerely,
      Michael

      Comment


      • #4
        Hello Michael,

        Thanks for this clarification. It helps a lot. I am going to try to revise my codes and see what happen.

        Best
        Cheng

        Comment


        • #5
          Hi Cheng,

          I was wondering whether you found a solution to our problem. Unfortunately, I am still struggling.

          Best
          Michael

          Comment


          • #6
            Dear Michael,

            Sorry for the late reply. I have been away for the Xmas holiday in the last month. I am still struggling as well but I feel I am close to it. It is all about writing out moment conditions.

            Best
            Cheng

            Comment

            Working...
            X