As I am not very experienced in financial econometrics I need help in writing R code for MC simulation for VaR estimation. Namely, reading some books and reference manuals for R packages, I ended up with the following code:
-constructing hypothetical portfolio consisting of x1 and x2
-x1 and x2 weights
-calculated means and covariance matrix
-generate 10000 scenarios for x1 and x2 with given covariance matrix sigma
-calculate portfolio value for simulated x1 and x2
-find VaR for 95%
Could someone tell me if this is the right way or not to perform MC simulation for VaR? Thanks in advance for any help or guidelines.