Main Content

This example shows how to implement the capital asset pricing model (CAPM) using the Econometrics Toolbox™ VAR model framework.

The CAPM model characterizes comovements between asset and market prices. Under this framework, individual asset returns are linearly associated with the return of the whole market (for details, see [90], [135], and [177]). That is, given the return series of all stocks in a market ($${M}_{t}$$) and the return of a riskless asset ($${C}_{t}$$), the CAPM model for return series $$j$$ ($${R}_{j}$$) is

$${R}_{jt}-{C}_{t}={a}_{j}+{b}_{j}({M}_{t}-{C}_{t})+{\epsilon}_{jt}$$

for all assets $$j=1,...,n$$ in the market.

$$a=[{a}_{1}\phantom{\rule{0.2777777777777778em}{0ex}}...\phantom{\rule{0.2777777777777778em}{0ex}}{a}_{n}{]}^{\prime}$$ is an $$n$$-by-1 vector of *asset alphas* that should be zero, and it is of interest to investigate assets whose asset alphas are significantly away from zero. $$b=[{b}_{1}\phantom{\rule{0.2777777777777778em}{0ex}}...\phantom{\rule{0.2777777777777778em}{0ex}}{b}_{n}{]}^{\prime}$$ is a $$n$$-by-1 vector of *asset betas* that specify the degree of comovement between the asset being modeled and the market. An interpretation of element $$j$$ of $$b$$ is

If $${b}_{j}=1$$, then asset $$j$$ moves in the same direction and with the same volatility as the market, i.e., is positively correlated with the market .

If $${b}_{j}=-1$$, then asset $$j$$ moves in the opposite direction, but with the same volatility as the market, i.e., is negatively correlated with the market.

If $${b}_{j}=0$$, then asset $$j$$ is uncorrelated with the market.

In general:

$$sign({b}_{j})$$ determines the direction that the asset is moving relative to the market as described in the previous bullets.

$$|{b}_{j}|$$ is the factor that determines how much more or less volatile asset $$j$$ is relative to the market. For example, if $$|{b}_{j}|=10$$, then asset $$j$$ is 10 times as volatile as the market.

Load the CAPM data set included in the Financial Toolbox™.

```
load CAPMuniverse
varWithNaNs = Assets(any(isnan(Data),1))
```

`varWithNaNs = `*1x2 cell*
{'AMZN'} {'GOOG'}

dateRange = datestr([Dates(1) Dates(end)])

`dateRange = `*2x11 char array*
'03-Jan-2000'
'07-Nov-2005'

The variable `Data`

is a 1471-by-14 numeric matrix containing the daily returns of a set of 12 stocks (columns 1 through 12), one riskless asset (column 13), and the return of the whole market (column 14). The returns were measured from 03Jan2000 through 07Nov2005. `AMZN`

and `GOOG`

had their IPO during sampling, and so they have missing values.

Assign variables for the response and predictor series.

Y = bsxfun(@minus,Data(:,1:12),Data(:,14)); X = Data(:,13) - Data(:,14); [T,n] = size(Y)

T = 1471

n = 12

`Y`

is a 1471-by-12 matrix of the returns adjusted by the riskless return. `X`

is a 1471-by-1 vector of the market return adjusted by the riskless return.

Create a `varm`

model object that characterizes the CAPM model. You must specify the number of response series and degree of the autoregressive polynomial.

Mdl = varm(n,0);

`Mdl`

is a `varm`

model object that characterizes the desired CAPM model.

Pass the CAPM model specification (`Mdl`

), the response series (`Y`

), and the predictor data (`X`

) to `estimate`

. Request to return the estimated multivariate time series model and the estimated coefficient standard errors. `estimate`

maximizes the likelihood using the expectation-conditional-maximization (ECM) algorithm.

`[EstMdl,EstCoeffSEMdl] = estimate(Mdl,Y,'X',X);`

`EstMdl`

has the same structure as `Mdl`

, but `EstMdl`

contains the parameter estimates. `EstCoeffSEMdl`

is a structure array containing the estimated standard errors of the parameter estimates. `EstCoeffSEMdl`

:

Contains the biased maximum likelihood standard errors.

Does not include the estimated standard errors of the intra-period covariances.

Display the regression estimates, their standard errors, their *t* statistics, and *p*-values. By default, the software estimates, stores, and displays standard errors from maximum likelihood.

results = summarize(EstMdl); results.Table

`ans=`*24×4 table*
Value StandardError TStatistic PValue
___________ _____________ __________ __________
Constant(1) 0.0044305 0.0013709 3.2319 0.0012298
Constant(2) 0.00016934 0.0012625 0.13413 0.8933
Constant(3) -0.00039977 0.00072318 -0.5528 0.5804
Constant(4) -0.00067309 0.00070971 -0.9484 0.34293
Constant(5) 0.00018643 0.001389 0.13421 0.89324
Constant(6) 0.0046034 0.0014338 3.2107 0.0013242
Constant(7) 0.0015126 0.00088576 1.7077 0.087697
Constant(8) -0.00022511 0.00050184 -0.44856 0.65375
Constant(9) 0.00020429 0.00072638 0.28124 0.77853
Constant(10) 0.00016834 0.00042152 0.39937 0.68962
Constant(11) 0.0004766 0.00086392 0.55167 0.58118
Constant(12) 0.00083861 0.00093527 0.89665 0.3699
Beta(1,1) 1.385 0.20647 6.708 1.9727e-11
Beta(2,1) 1.4067 0.19016 7.3974 1.3886e-13
Beta(3,1) 1.0482 0.10892 9.6237 6.353e-22
Beta(4,1) 0.84687 0.10689 7.9226 2.3256e-15
⋮

Response series 6 has a significant asset alpha.

sigASymbol = Assets(6)

`sigASymbol = `*1x1 cell array*
{'GOOG'}

As a result, `GOOG`

has exploitable economic properties.

All asset betas are greater than 3. This indicates that all assets are significantly correlated with the market.

However, `GOOG`

has an asset beta of approximately `0.37`

, whereas all other asset betas are greater than or close to 1. This indicates that the magnitude of the volatility of `GOOG`

is approximately 37% of the market volatility. The reason for this is that `GOOG`

steadily and almost consistently appreciated in value while the market experienced volatile horizontal movements.

For more details and an alternative analysis, see Capital Asset Pricing Model with Missing Data.