Best method is to draw risk/return relation using various combination of weights of portfolios assets. We will need to rewrite our cal_ret and cal_sd function for calculations.
> fmcgtemp &<- read.csv("CNX FMCG01-04-2010-01-04-2011.csv")
> fmcg <- fmcgtemp[[5]]
> fmcgL <- bankl(fmcg,fmcg)
> fmcgM <- mean(fmcgL)
> fmcgSD <- sd(fmcgL)
Function for rate of return
function (first,second,third)
{
a <- rep(1,times=58)
i=0
j=0
k=0
w1=0
count=0
while(w1 <=1){
w2=0
while(w1+w2 <=1){
w3=0
while(w1+w2+w3<1){
w3=1-w1-w2
a[count]= first*w1+ second*w2+third*w3
count=count+1
}
w2=w2+.1
j=j+1
}
w1=w1+.1
i=i+1
}
a
}
Function for standard deviation
function (first,second,third,cora,corb,corc)
{
a <- rep(1,times=58)
i=0
j=0
k=0
w1=0
count=0
while(w1<=1){
w2=0
while(w1+w2<=1){
w3=0
while(w1+w2+w3<1){
w3=1-w1-w2
a[count]= (second*w2)^2+(first*w1)^2+(third*w3)^2+2*w1*w2*first*second*cora+2*w1*w3*first*third*corb+2*w3*w2*second*third*corc
count=count+1
}
w2=w2+.1
j=j+1
}
w1=w1+.1
i=i+1
}
a
}
Calling both the fucntions
>X <- cal_ret(bankM,energyM,fmcgM)
> Y <- cal_sd(bankM,energyM,fmcgM,corBE,corBF,corEF)
>Plot (Y,X)
(Y represents standard deviation and X represent returns made)
This graph clearly shows there will be number of combinations of weights of various assets which will lead to higher returns and less risk.
We again need to find out, investor appetite to reach correct asset allocation.
No comments:
Post a Comment