Testing and Measuring the Capital Asset Pricing Model

Overview



Data Collection



The first step to running a CAPM analysis is to collect and process the data. In general, you will want all the relevant data for a single date as a single object in an array. The following table shows the required elements for two records.



The CAPM analysis regresses the excess return against the market excess return. As such, the excess return needs to be computed on each record. The following code uses the array map method to append the excess to the object.


let processed = data.map(p=>({
  ...p,
  marketExcess:p.marketReturn - p.riskFree,
  excess:p.return - p.riskFree
}));
	
					


Regression



After creating the necessary data set, the next step is to run a regression against the data. The CAPM equation is
{% r_i = \alpha_i + r_{risk free} + \beta_i \times r_m + e_i %}
This is a linear equation and well suited to standard OLS Regression. However, there are choices to be made here. The theory assumes that the alpha is zero. When running the regression, one must choose whether to set the intercept to zero, or to let the regression calculate an intercept. As a matter of testing whether the theory is true, one would let the regression compute the intercept, and then use the tactics of Hypothesis testing (see below) to test the likelihood that the alpha is in fact zero.

However, when the goal is to measure the beta (which is the regression coefficient of the market return), one must choose whether to set the intercept to zero of not.

Hypothesis Tests



The Capital Asset Pricing Model assumes that {% \alpha %} (the intercept in the regression) is zero. When running a regression, it is highly unlikely that the computed value will come out as zero. However, it may still be true that the theoretical (expectation) value is in fact zero.

To test whether alpha is in fact true usually involves running a hypothesis test. For linear regression, the hypothesis can be tested by comparing the intercepts t-stat or p-stat to the relevant tables.

Contents