### Efficient Frontier

Portfolio of two assets

$\mathbb{E}(R_P)=\omega_1\mathbb{E}(R_1)+\omega_2\mathbb{E}(R_2),$

• $$\mathbb{E}(R_P)$$ is the expected return of the portfolio,

• $$\omega_i$$ is the weight of asset $$i$$,

• $$\mathbb{E}(R_i)$$ is the expected return of asset $$i$$.

• Portfolio variance $\sigma_P^2=\omega_1^2\sigma_1^2+\omega_2^2\sigma_2^2+2\omega_1\omega_2\sigma_{1,2},$

• $$\sigma_P^2$$ is the portfolio variance

• $$\sigma_i^2$$ is the variance of assets $$i$$

• $$\sigma_{1,2}$$ is the covariance between asset 1 and 2

• $$\omega_1+\omega_2=1$$

• portfolio volatility or standard deviation is $\sigma_P=\bigg\{\omega_1^2\sigma_1^2+\omega_2^2\sigma_2^2+2\omega_1\omega_2\sigma_{1,2}\bigg\}^{\frac{1}{2}}.$

Example

• Two securities, say X and Y

• $$\mathbb{E}(R_X)=5\%$$ and $$\mathbb{E}(R_Y)=4\%$$,

• $$\sigma_X^2=9\%$$, $$\sigma_Y^2=6\%$$

• $$\sigma_{XY}=3\%$$.

• The following table presents the portfolio return and volatility for five different portfolio combinations.

 $$\omega_X$$ 100% 80% 60% 40% 20% 0% $$\omega_Y$$ 0% 20% 40% 60% 80% 100% —————- ———- ———– ———- ———– ———- ———- $$\mathbb{E}(R_P)$$ 5% 4.8% 4.6% 4.4% 4.2% 4% $$\sigma_P^2$$ 9% 6.96% 5.64% 5.04% 5.16% 6% —————- ———- ———– ———- ———– ———- ———-
• Though we consider six possible choices of $$\omega_X$$; however an infinitely many choices are possible for two stocks.

Portfolio of $$N$$ assets

• Expected portfolio return

$\mathbb{E}(R_P)=\omega^T\mu,$ where $$\omega^T=\{\omega_1,\omega_2,...,\omega_N\}$$, $$\mu=\{\mu_1,\mu_2,...,\mu_N\}$$, $$\mu_i=\mathbb{E}(R_i)$$, $$i=1,2...,N$$ and

• Portfolio volatility as $\sigma_P=\sqrt{\omega^T\Sigma\omega},$ where $\Sigma=\Bigg[\begin{array}{ccc} \sigma_1^2&...&\sigma_{1N}\\ \vdots & \ddots &\vdots\\ \sigma_{N1}&...&\sigma_1^2\\ \end{array}\Bigg]$ is the portfolio covariance matrix.

• Calculate expected return and volatility for all possible portfolios that can be constructed by varying the portfolio weights of the assets.

• The set of all possible portfolios, represented by their expected return and volatilities has the characteristic shape.

• Considers 10000 portfolios, where portfolio weights are randomly simulated and corresponding portfolio return.

• Consider the global portfolio with passive investment strategy, where you want to invest in the ETF of FTSE, DAX, SMI and CAC and use the data in EuStockMarkets dataset.

Index_Value<-as.matrix(EuStockMarkets)
r<-diff(log(Index_Value))*100
no.of.portf<-10000
set.seed(1)
sigma<-mu<-rep(NA,no.of.portf)
for(i in 1:no.of.portf){
w <- sample(1:1000,4,replace=T)
w <- w/sum(w) ## weight for i-th portfolio
rp <- r%*%w   ## returns of i-th portfolio
mu[i] <- mean(rp)  ## mean return of i-th portfolio
sigma[i] <- sd(rp) ## volatility of i-th portfolio
}

##################################

plot(sigma,mu,xlab = "volatility"
,ylab="expected return",col="grey")
abline(h=0.065,col="red",lwd=2)
segments(0.8,0.04,0.8,0.065,col="blue",lwd=2)
segments(0.85,0.04,0.85,0.065,col="green",lwd=2)
arrows(0.775,0.07,0.8,0.065,col="black",lwd=2)
arrows(0.875,0.07,0.85,0.065,col="black",lwd=2)
text(0.77,0.071,"w1")
text(0.88,0.071,"w2")
points(0.779,0.065,col="blue",lwd=2)
text(0.779,0.066,"w")
points(0.81,0.07,col="blue",lwd=2)
text(0.81,0.0715,"v")

### Plot the efficient frontier
Sigma<-cov(r)
library(tseries)

er<-seq(0.045,0.075,0.001)
frontier<-matrix(NA,nrow=length(er),ncol=2)
for(i in 1:length(er)){
port_optim<-portfolio.optim(r
,pm=er[i]
,covmat=Sigma)
frontier[i,]<-c(port_optim$ps,port_optim$pm)
}
lines(frontier,col="red")