# [R] VaR and ES through MonteCarlo method

ESMERALDA PODA podaesmeralda at gmail.com
Mon Dec 22 14:17:52 CET 2014

```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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Schermata 2014-12-22 alle 12.04.16.png
Type: image/png
Size: 27610 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20141222/ebbf7952/attachment.png>
```