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?

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?

## Comment