# [R] VaR and ES through MonteCarlo method

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Mon Dec 22 22:42:53 CET 2014

```Unfortunately for you, there is a no-homework policy on this list. Please read the Posting Guide.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.

On December 22, 2014 5:17:52 AM PST, ESMERALDA PODA <podaesmeralda at gmail.com> wrote:
>Hi everybody,
>
>This is the homework I am trying to solve.
>
>Ex. Assume that you have a position of 144530 shares of Bill inc.. The
>object Y2 contains an iid sample of the returns for these shares.
>Assume
>that data follow a Student distribution.
>
>   1.
>
>   Compute the maximum likelihood estimate for the model.
>    2.
>
>   Compute the estimation of V aRα and of ESα for α = 0.99 based on the
>obtained estimates, using a parametric formula or with the pure Monte
>Carlo
>   method
>3. Obtain a bootstrap confidence interval for V aRα and of ESα for α =
>0
>   .99 at a confidence level 0.90, using B = 1000 replications.
>
>I solved point 1. (you can see the screenshot attached).
>However in point 2, where I have to compute VaR and ES, based on the
>estimates obtained in point 1. I typed this:
>
>#POINT 2
>
>q<-114530
>
>n.val <- 10000
>
>x <- rt(n=n.val, obj=mle.t)
>
>loss.mc <- -Q*x
>
>but, I obtain error. I am working with a student distribution. I need
>particularly
>the obj=mle.t since I need to work on the estimate I have obtained.
>
>Can somebody, who is familiar with VaR and ES give me some hint through
>this?
>
>I would really appreciate this.
>
>Best
>
>Esmeralda
>
>
>------------------------------------------------------------------------
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help