Le code R
for(i in seq(from=1, to=2, by=.05)){
rf=0.05
mu=matrix(c(.15,.26),nrow=2,ncol=1)
mue=mu-rf
sigma=matrix(c(.24,.37),nrow=2,ncol = 1)
corr=.8
cov=corrsigma[1,1]sigma[2,1]
mup=.18
varcov=matrix(c((sigma[1,1])^2,cov,cov,(sigma[2,1])^2),nrow=2,ncol=2,byrow
=TRUE)
lambda=(mup-rf)/(t(mue)%%solve(varcov)%%mue)
omega=lambda[1,1]solve(varcov)%%mue
omega3=1-omega[1,]-omega[2]
retp=t(mue)%*%omega
sigmap=sqrt(t(omega)%%varcov%%omega)}