In order to measure the performance of a particular security or fund against that of benchmark portfolio, the `security characteristic lines’ (SCL) are very useful.
The SCL equation is \[ \mathbb{E}(R_i)-R_F=\alpha_i+\beta_i(\mathbb{E}(R_i)-R_F) \] where \(\alpha_i\) is active return.
Suppose there are \(N\) risky assets with return \(R_1,R_2,...,R_N\) with weights \(\omega_1,\omega_2,...,\omega_N\).
The return of the portfolio is \[ R_P=\omega_1 R_1+\omega_2 R_2+...+\omega_N R_N. \]
Let \(R_M\) be the return of the market index. According to SML, \[ \mathbb{E}(R_i)=R_F+\alpha_i+\beta_i\mathbb{E}(R_M-R_F), \] which means, \[ \mathbb{E}(R_P)=R_F+\Big(\sum_{i=1}^N\omega_i \alpha_i\Big)+\Big(\sum_{i=1}^N\omega_i \beta_i\Big)\mathbb{E}(R_M-R_F), \] i.e., \[ \mathbb{E}(R_P)=R_F+\alpha_P+\beta_P\mathbb{E}(R_M-R_F), \] where \(\alpha_P=\Big(\sum_{i=1}^N\omega_i \alpha_i\Big)\) and \(\beta_P=\Big(\sum_{i=1}^N\omega_i \beta_i\Big)\).
If this is indeed the model then expected price of the portfolio is \[ \mathbb{E}(P_t|P_{t-1})=P_{t-1}\exp\{R_F+\alpha_P+\beta_P\mathbb{E}(R_M-R_F)\}, \] where \(R_P=\log(P_t)-\log(P_{t-1})\)
Factor Model
Factor models generalize the CAPM by allowing more factors than simply the market risk and the unexplained unique risk of each asset.
The model is defined as, \[ R_i-R_F=\beta_{0i}+\beta_{1i}x_{1}+...+\beta_{pi}x_{p}+\epsilon_i, \] where \(x_1,x_2,...,x_p\) are the \(p\) factors.
Typically, there are two major objectives.
If the objective is to predict the return; any factor which has a good predictive power could be used in the model. A model with good predictive power means higher chance of a good return on investment.
For example, experts in behavioral finance and data mining experts try to measure the market sentiment with good predictive power and they use the market sentiment as a factor in the model.
However, if the objective is to analyze the relationship between the return and factors, one should try to find the theoretical reason for including a factor in the model.
Factor Models in Matrix Notation
We express the factor model in the matrix notation as follows: \[ r_t=B x_t+\epsilon_t \] where \[r_t=\Bigg[\begin{array}{c} r_{t1}\\ \vdots\\ r_{tN} \end{array}\Bigg]=\Bigg[\begin{array}{c} R_{t1}-R_F\\ \vdots\\ R_{tN}-R_F \end{array}\Bigg],\] is the vector of excess return over risk-free rate on day \(t\) for \(N\) many assets, \[ B=\Bigg[\begin{array}{ccc} \beta_{11}&...&\beta_{1p}\\ \vdots&...&\vdots\\ \beta_{N1}&...&\beta_{Np}\\ \end{array}\Bigg]_{N \times p}, \] is the asset’s sensitivity matrix of factors, \[ x_t=\Bigg[\begin{array}{c} x_{t1}\\ \vdots\\ x_{tN} \end{array}\Bigg] \] is the vector of risk factors.
The portfolio return of day \(t\) is \[ r_{Pt}=\omega^Tr_t=\sum_{i=1}^N\omega_i r_{ti}, \] where \(\omega^T=\{\omega_1,...,\omega_N\}\) is the weight vector, such that \(\sum_{i=1}^N\omega_i=1\) and \(\omega_i\) is the weight of the \(i^{th}\) asset in the portfolio.
This can be expressed as \[ r_{Pt}=\omega^TBx_t+\omega^T\epsilon_t. \]
The expected portfolio return is \[ \mathbb{E}(r_{P})=\omega^TBx=\beta x, \] where \(\omega^TB=\beta\) is the portfolio’s sensitivity to risk factor \(x\).
The portfolio’s covariance matrix is \[ \begin{eqnarray*} D(r_P)&=&\omega^T B \Sigma_x B^T \omega + \omega^T \Sigma_{\epsilon} \omega,\\ &=& \omega^T\Big[B \Sigma_x B^T+\Sigma_{\epsilon}\Big]\omega,\\ &=& \omega^T\Sigma_P\omega, \end{eqnarray*} \] where \(\Sigma_{\epsilon}\) is the diagonal matrix whose each diagonal elements are the unexplained volatility of each asset, \(\Sigma_x\) is the covariance matrix of risk factor, \(B\Sigma_x B^T\) is the volatility that due to risk factor.
Benefit of Diversification
If \(\omega_i=\frac{1}{N},~~\forall~i\), then we \[ \omega^T\Sigma_{\epsilon}\omega=\frac{1}{N^2}\sum_{i=1}^N\sigma_i^2\leq \frac{\sigma_M^2}{N}, \] where \(\sigma_M^2=\max(\sigma_1^2,...,\sigma_N^2)<\infty\) is the maximum of all unexplained variances, which is finite.
Therefore \[ \omega^T\Sigma_{\epsilon} \omega \rightarrow 0, \text{ as }N\rightarrow \infty. \]
data<-read.csv("stock_treasury.csv")
# Risk Free Rate is in percentage and annualised.
# So the following conversion is required.
Rf<-data$UST_Yr_1/(100*250)
plot(ts(Rf),ylab="US Treasury 1 Year Yield")
n<-nrow(data)
## Compute log-return
ln_rt_snp500<-diff(log(data$SnP500))-Rf[2:n]
ln_rt_ibm<-diff(log(data$IBM_AdjClose))-Rf[2:n]
ln_rt_apple<-diff(log(data$Apple_AdjClose))-Rf[2:n]
ln_rt_msft<-diff(log(data$MSFT_AdjClose))-Rf[2:n]
ln_rt_intel<-diff(log(data$Intel_AdjClose))-Rf[2:n]
## log-return of the portfolio
ln_r <- cbind(ln_rt_ibm,ln_rt_apple,ln_rt_msft,ln_rt_intel)
head(ln_r)
## ln_rt_ibm ln_rt_apple ln_rt_msft ln_rt_intel
## [1,] -0.015870443 -2.858644e-02 -0.00924877 -0.011350577
## [2,] -0.021811910 8.413819e-05 -0.01479610 -0.018822896
## [3,] -0.006567005 1.391479e-02 0.01261529 0.020748139
## [4,] 0.021492855 3.769331e-02 0.02898454 0.018420655
## [5,] 0.004337269 1.063127e-03 -0.00844949 0.001897247
## [6,] -0.016930825 -2.495693e-02 -0.01258907 -0.004369651
Company | IBM | Apple | Microsoft | Intel |
---|---|---|---|---|
Weights | 20% | 30% | 25% | 25% |
——– | —— | ——- | ———– | ——- |
w = c(0.2,0.3,0.25,0.25)
ln_rt_portf = ln_r%*%w
capm_ibm<-lm(ln_rt_ibm~ln_rt_snp500)
capm_ibm_analysis<-coefficients(summary(capm_ibm))
capm_ibm_analysis <- round(capm_ibm_analysis,digits = 5)
rownames(capm_ibm_analysis)<-c("alpha","beta")
## Result of capm using lm() for IBM
capm_ibm_analysis
## Estimate Std. Error t value Pr(>|t|)
## alpha -0.00050 0.00058 -0.86605 0.3873
## beta 1.01601 0.05863 17.32801 0.0000
plot(ln_rt_snp500,ln_rt_ibm,xlab="S&P 500",ylab="ibm")
abline(capm_ibm,col="blue")
grid(col="red")
## Adjusted R-Squareed
summary(capm_ibm)$adj.r.squared
## [1] 0.5468333
rse<-summary(capm_ibm)$sigma
al <-capm_ibm$coefficients[1]-2*rse
b <- capm_ibm$coefficients[2]
abline(a= al,b= b,col=3,lty=2)
au <-capm_ibm$coefficients[1]+2*rse
abline(a=au,b=b,col=3,lty=2)
## CAPM on Microsoft
capm_msft<-lm(ln_rt_msft~ln_rt_snp500)
## Adjusted R-Squareed
summary(capm_msft)$adj.r.squared
## [1] 0.4736175
## CAPM on Apple
capm_msft<-lm(ln_rt_msft~ln_rt_snp500)
## Adjusted R-Squareed
summary(capm_msft)$adj.r.squared
## [1] 0.4736175
## CAPM on Intel
capm_intel<-lm(ln_rt_intel~ln_rt_snp500)
## Adjusted R-Squareed
summary(capm_intel)$adj.r.squared
## [1] 0.4085883
capm_portf<-lm(ln_rt_portf~ln_rt_snp500)
capm_portf_analysis<-round(coefficients(summary(capm_portf)),digit=5)
rownames(capm_portf_analysis)<-c("alpha","beta")
## Result of capm using lm() for Microsoft
capm_portf_analysis
## Estimate Std. Error t value Pr(>|t|)
## alpha 0.00008 0.00044 0.17406 0.86196
## beta 1.11029 0.04434 25.04207 0.00000
## Adjusted R-Squareed
summary(capm_portf)$adj.r.squared
## [1] 0.7162813