Dear users,
I need help in understanding steps of Monte Carlo simulation for VaR
estimation. Here is the simplified example of what i was trying to do, but
I suppose this is not appropriate way for performing MC simulation.

Suppose that our portfolio consist of x1 and x2 (with equal weights), which
returns are given:

sh<-matrix(c(rnorm(100,0,0.01),rnorm(100,0,0.015)),ncol=2)
colnames(sh)<-c("x1","x2")
w<-matrix(c(0.5,0.5),ncol=1)

>From this I calculated portfolio returns, mean and variance:

pr<-sh%*%w
pmu<-mean(pr)
sigma<-cov(sh)
pvar<-t(w)%*%sigma%*%w

Now I was trying to generate 10 scenarios (keeping the correlation between
x1 and x2). Then calculate portfolio mean for each scenario and from that
mean distribution  calculate 95% VaR. Here I am sure  these aren't good
steps and I that I am missing something in part of keeping a correlation
between x1 and x2:

l<-list("vector",10)
cd<-chol(cov2cor(sigma))
#generate 10 scenarios#
mu<-apply(sh,2,mean)
sd<-apply(sh,2,sd)
for (i in 1:10)
{
l[[i]]<-matrix(c(rnorm(10,mu[1],sd[1]),rnorm(10,mu[2],sd[2])),ncol=2)%*%cd
}

mc<-sapply(l,function(x) mean(x%*%w))

quantile(mc,p=0.05)


Thanks in advance and any help is really appreciated.

Andrija

	[[alternative HTML version deleted]]

