Professional Documents
Culture Documents
Stan Hurn
One of the most common problems in empirical asset pricing concerns the
estimation and evaluation of linear factor models. There is a large
literature on the econometric techniques to estimate and evaluate these
models which deals with the following questions.
how to estimate parameters
how to calculate standard errors of the pricing errors
how to test the model
The data are monthly percentage returns for the period July 1926 to
December 2013 (T = 1050) on 25 portfolios (r1 to r25) sorted in terms of
size and book-to-market values together with the risk free (US Treasury
bill rate) and the return on the market (S&P500 index). The data are
freely available from Ken Frenchs website:
http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html
name: capm
log: /Users/stanhurn/Dropbox/TEACHING/SIngapore/do/capm.smcl
log type: smcl
opened on: 13 Mar 2014, 17:24:36
.
. // set current working directory
. cd ~/Dropbox/Teaching/Singapore/do
/Users/stanhurn/Dropbox/TEACHING/SIngapore/do
.
. // load the data and add a few labels
. use fama_french.dta, clear
. label variable rm "Market Return"
. label variable rf "Risk Free Rate"
.
30
40
50
60
70
80
90
00
10
19
19
19
19
19
19
19
20
20
Market Return Risk Free Rate
1.5
40
20
1
Risk Free Rate
Market Return
0
.5
-20
0
-40
30
40
50
60
70
80
90
00
10
19
19
19
19
19
19
19
20
20
Market Return Risk Free Rate
Define the excess returns zit = rit rf . If the pricing factor, ft is also an
excess return then the fundamental pricing model states that the excess
returns are linear in the betas
E(zit ) = E(ft ) .
.
. // test the model
. test _cons
( 1) _cons = 0
F( 1, 1019) = 4.89
Prob > F = 0.0273
. test rm_rf=1
( 1) rm_rf = 1
F( 1, 1019) = 166.47
Prob > F = 0.0000
. test (_cons=0) (rm_rf=1)
( 1) _cons = 0
( 2) rm_rf = 1
F( 2, 1019) = 83.49
Prob > F = 0.0000
There are at least four ways to estimate the simple CAPM for all 25
portfolios in Stata:
1 Equation-by-equation OLS. Loop over the excess returns and estimate
each equation.
2 Use the mveqn command. Performs equation-by-equation OLS
automatically.
3 Use the sureg command which performs seemingly unrelated
regressions.
4 Reshape the data as long format and use statsby prefix.
forvalues i = 1/N {
qui regress zi rm_rf
}
qui mvreg z* = rm_rf
We also want to know if all the pricing errors are jointly equal to zero. We
now have to think of the time-series regressions as a panel regression with
correlated errors, E(uit ujt ) 6= 0. The classic form of the test assumes no
autocorrelation or heteroskedasticity so the the Wald test of the joint
restrictions is given by
" 2
!#1
f 1 a
J=T 1+ b0
b
b 2N
var(f )
1
b0
= aT b
b.
b = [1 2 N ]0 and
with b is the residual covariance matrix. For
convenience, the test is often written just with a positive scaling constant
aT which depends on the sample size and the factor.
The test does generalise to the case of multiple factors. Assuming normal
iid errors the test statistic is
T N K h 0 b 1 1 0 b 1
i
GRS = 1+f f
b b FN,T NK
N
in which
N = number of assets
K = number of factors
f = ET (ff )
T
b= 1
X
(ff t f )(ff t f i )0
T
t=1
. // F version
. sca tmp0 = (`T-`N-1)/`N
. sca tmp1 = grsW/`T
. sca grsF = tmp0 * tmp1
. sca pvF = Ftail(`N,`T-`N-1,grsF)
.
. di as text "Gibbons Ross Shanken test (F Version) = " as res grsF
Gibbons Ross Shanken test (F Version) = 3.7668333
. di as text "p-value = " as res pvF
p-value = 1.958e-09
. // need to drop variables so matrix does not take dimensions of data set in memory
. drop *
.
. // stata view of the matrix has 3 columns (company # slope and constant)
. // name them and use the names to break the matrix into variables
. mat colnames suregb = company beta alpha
. qui svmat suregb, names(col)
. mata
mata (type end to exit)
: st_view(alpha=.,.,"alpha")
: J = aT * alpha * invsym(sigma) * alpha
: J
96.6328742
: end
Value returned for the GRS test is 96.6328742 which is (almost) identical
to that obtained previously.
The central question of interest is why average returns vary across assets.
The answer is that the expected returns should be high if the asset has a
high exposure to the factors that carry large risk premia. Recall the
fundamental pricing model with a single factor in which the excess returns
are linear in the betas
E(zit ) = i E(ft ) .
Since the factor, ft , is also an excess return, the model applies to the
factor as well
E(ft ) = 1
where is the price of risk (risk premium) associated with the factor so
that
E(zit ) = i .
ET (zit ) = i + i .
not matched 0
matched 25 (_merge==3)
. drop _merge
.
. // second pass regression
. reg z betas, noconstant
Source SS df MS Number of obs = 25
F( 1, 24) = 31.28
Model 4.82079646 1 4.82079646 Prob > F = 0.0000
Residual 3.69828055 24 .154095023 R-squared = 0.5659
Adj R-squared = 0.5478
Total 8.51907702 25 .340763081 Root MSE = .39255
. // this time merge the estimated betas into the long data set
. merge m:1 portfolio using "./working/coefs.dta"
Result # of obs.
not matched 0
matched 25,525 (_merge==3)
. drop _merge
. save "./working/famafrenchlong.dta", replace
file ./working/famafrenchlong.dta saved
.
. // run the regressions for each time period
. statsby _b, by(dateid01) saving("./working/famamacbeth",replace) nodots: reg z betas, nocon
command: regress z betas, noconstant
by: dateid01
.
. use "./working/famamacbeth.dta", replace
(statsby: regress)
. sum _b_betas
Variable Obs Mean Std. Dev. Min Max
The general Wald form of the Gibbons, Ross, Shanken test for zero pricing
errors (b
= 0) in a linear factor model is
b0
J = aT bb 2N
The general Wald form of the Gibbons, Ross, Shanken test for zero pricing
errors (b
= 0) in a linear factor model is
b0
J = aT bb 2N
b0 V
aT bN
Js = p N(0, 1)
2N(1 + eT )
with
1 X 2 2
et = ij > cT )
bij I(b
N
i6=j
1 1
cT = (1 c/N)
T
c (0, 0.5).
. // basic version of Pesaran Yamagata test with sqrt(2*N) as the scaling factor
. mata:
mata (type end to exit)
: st_view(s2=.,.,"s2")
: st_view(alpha=.,.,"alpha")
: N = strtoreal(st_local("N"))
: aT = st_numscalar("aT")
: Jnum = aT :* alpha * invsym(diag(s2)) * alpha - N
: Jden = sqrt(2 * N)
: J = Jnum :/ Jden
: pval = 1 - normal(abs(J))
: Jnum, Jden, J, pval
1 2 3 4
: end
. // Notes:
. // 1. the test strongly rejects for whole sample
. // 2. this value is calculated using T = N so it works when GRS would fail
. // 3. now we have a problem with low power
: end
. // Notes:
. // 1. the numerator of the test is identical to the previous one
. // 2. eT=0.5 so denominator is only slightly affected
. // 3. value of this adjustment is questionable (need some MC evidence)
Screening procedure
r
log N
T = log(log T )
T
Choose
bi if
|b
i |
> T
bj