MATLAB Examples

Estimate Capital Asset Pricing Model Using SUR

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 docid:econ_ug.f0-2601, docid:econ_ug.brz_lcd, and docid:econ_ug.buwglyz). 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) + \varepsilon_{jt}$$

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

$a = [a_1\;...\; 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\;...\;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:

  • ${\rm 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 and Process Data

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

load CAPMuniverse
varWithNaNs = Assets(any(isnan(Data),1))
dateRange = datestr([Dates(1) Dates(end)])
varWithNaNs =

  1x2 cell array

    {'AMZN'}    {'GOOG'}

dateRange =

  2x11 char array


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 =


n =


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 Multivariate Time Series Model

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.

Estimate Multivariate Time Series 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.

Analyze Coefficient Estimates

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);
ans =

  24x4 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
    Beta(5,1)            1.1322       0.20921         5.4118      6.2381e-08
    Beta(6,1)           0.37419       0.21595         1.7328        0.083135
    Beta(7,1)           0.85821       0.13341         6.4329      1.2518e-10
    Beta(8,1)           0.91566      0.075585         12.114      8.8812e-34
    Beta(9,1)            1.1456        0.1094         10.471      1.1758e-25
    Beta(10,1)          0.81969      0.063487         12.911      3.8891e-38
    Beta(11,1)           1.0105       0.13012          7.766      8.1009e-15
    Beta(12,1)           1.0991       0.14087         7.8022      6.0848e-15

Response series 6 has a significant asset alpha.

sigASymbol = Assets(6)
sigASymbol =

  1x1 cell array


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 docid:finance_examples.example-ex03245913.