Last Update: December 15, 2020
Asset pricing models consist of estimating asset expected return through its expected risk premium linear relationship with factors portfolios expected risk premiums and macroeconomic factors.
This topic is part of Investment Portfolio Analysis with R course. Feel free to take a look at Course Curriculum.
This tutorial has an educational and informational purpose and doesn’t constitute any type of trading or investment advice. All content, including code and data, is presented for personal educational use exclusively and with no guarantee of exactness of completeness. Past performance doesn’t guarantee future results. Please read full Disclaimer.
An example of asset pricing models is arbitrage pricing theory APT  which consists of estimating asset expected return through its expected risk premium linear relationship with market portfolio expected risk premium and macroeconomic factors.
1. Formula notation.
1.1. Arbitrage pricing theory APT asset risk premium formula notation.
- Note: macroeconomic factor not fixed and only included for educational purposes.
Where = asset realized risk premiums, = asset realized returns, = realized risk free returns, = asset average realized excess return, = asset market beta coefficient, = market realized risk premiums, = market realized returns, = asset macroeconomic factor beta coefficient, = realized consumer price index percentage changes macroeconomic factor, = linear regression residuals or forecasting errors.
1.2. Arbitrage pricing theory APT model formula notation.
- Note: APT formula recasting using expected returns (ex-ante) instead of average realized returns (ex-post). For full reference, please read The Arbitrage Theory of Capital Asset Pricing .
Where = asset expected return, = expected risk-free return, = asset market beta coefficient, = market expected risk premium, = market expected return, = asset macroeconomic factor beta coefficient, = expected percentage change in consumer price index macroeconomic factor.
2. R script code example.
2.1. Load R package .
2.2. APT multiple factors model data reading.
- Data: S&P 500® index replicating ETF (ticker symbol: SPY) adjusted close prices and market portfolio  monthly arithmetic returns risk premiums, U.S. consumer price index monthly arithmetic change (2007-2016).
data <- read.csv("APT-Multiple-Factors-Model-Data.txt",header=T) data <- xts(data[,2:4],order.by=as.Date(data[,1]))
2.3. APT multiple factors model multiple linear regression calculation and output.
Out: Call: lm(formula = data$SPY.RF ~ data$MKT.RF + data$CPI) Residuals: Min 1Q Median 3Q Max -0.0102618 -0.0027180 -0.0003804 0.0026426 0.0101587 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.202e-05 3.976e-04 0.106 0.916 data$MKT.RF 9.715e-01 8.036e-03 120.892 <2e-16 *** data$CPI -1.420e-01 1.144e-01 -1.241 0.217 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.003938 on 117 degrees of freedom Multiple R-squared: 0.9922, Adjusted R-squared: 0.992 F-statistic: 7425 on 2 and 117 DF, p-value: < 2.2e-16
 Stephen Ross. “The Arbitrage Theory of Capital Asset Pricing”. Journal of Economic Theory. 1976.
 Jeffrey A. Ryan and Joshua M. Ulrich. “xts: eXtensible Time Series”. R package version 0.12.1. 2020
 Eugene F. Fama and Kenneth F. French. “Common Risk Factors in the Returns on Stocks and Bonds,” Journal of Financial Economics. 1993.