# [R] R: VaR and ES in R

podaesmeralda podaesmeralda at gmail.com
Mon Dec 22 21:52:40 CET 2014

```

From my Android phone on T-Mobile. The first nationwide 4G network.

-------- Messaggio originale --------
Da: ESMERALDA PODA <podaesmeralda at gmail.com>
Data:12/22/2014  02:44 PM  (GMT+01:00)
A: r-help at r-project.org
Oggetto: VaR and ES in R

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.

Compute the maximum likelihood estimate for the model.

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

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

Attachments area
Preview attachment Schermata 2014-12-22 alle 12.04.16.png

Schermata 2014-12-22 alle 12.04.16.png

[[alternative HTML version deleted]]

```