Thank you for answer Arun. This was very helpful and now I understand how
it should be done.

Andrija

On Mon, Nov 21, 2011 at 9:39 AM, Arun.stat <arun.kumar.saha@gmail.com>wrote:

> Hi Andrija, I am not sure why you need to replicate 10 times. Instead you
> should want to replicate once with, say, 1000 simulation and then get the
> 5th percentile of the portfolio return distribution. Here you go:
>
> l<-list("vector",1)
> mu<-apply(sh,2,mean)
> sigma<-cov(sh)
> #generate 1 replication
> l<-list("vector",1)
> for (i in 1:1)
> {
> l[[i]]<-rmnorm(1000,mu,sigma) # this will generate 1000 possible asset
> returns based on the same statistical characteristic as in 'sh'
>                                                          # I assume, 'sh'
> is your historical asset return
> }
>
> l <- l[[1]]
> pr_simulated <- apply(l, 1, function(x) return(sum(x * c(0.5, 0.5)))) #
> simulated portfolio return
> quantile(pr_simulated, 0.05, type = 3) # your Portfolio VaR (95%)
>
> PS: I used rmnorm() function for drawing random number from a multivariate
> normal, which is from 'mnormt' package.
>
> HTH,
>
> Thanks and regards,
> _____________________________________________________
>
> Arun Kumar Saha, FRM
> QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST
> Visit me at: http://in.linkedin.com/in/ArunFRM
> _____________________________________________________
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Monte-Carlo-simulation-for-VaR-estimation-tp4082611p4090907.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> R-SIG-Finance@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>

	[[alternative HTML version deleted]]

