Re: [R] Value at Risk

From: <gyadav_at_ccilindia.co.in>
Date: Fri, 11 May 2007 11:35:22 +0530

reply is inline

Hello Gaurav,

The function:

> VaR(tstock[,2],alpha=0.01) # gives the same VaR as above with historical
simulation
VaR
-2.86

but i tried this function for normal distribution:

> VaR.norm (tstock[,2],p=0.99)$VaR

Error in VaR.norm(tstock[, 2], p = 0.99) :

        Negative value in parameter 'ydat' @@@ if you have seen the help manual then you mus have got that you dont need to give the retun series.
R is trying to calucate the logarithm of a negative number which is why it is throwing you error.
try this instead
> XXX<-VaR.norm(stock$ESPA.STOCK.EUROPE,p=0.01)
> XXX$VaR

[1] -3.11079
>

I dont understand the way with the normal distribution :( Maybe you can help me a littble bit.
Cheers :-)

KR,
Alin Soare

2007/5/11, gyadav_at_ccilindia.co.in <gyadav_at_ccilindia.co.in>:

reply is inline

         \\\|||||///
      \\   -    -   //
       (  o   o  )

oOOo-(_)-oOOo--------
|
| Gaurav Yadav
| Assistant Manager, CCIL, Mumbai (India)
| Mob: +919821286118 Email: emailtogauravyadav_at_gmail.com
| Man is made by his belief, as He believes, so He is.
|                                           --- Bhagavad Gita 
|_______Oooo________
        oooO(      )
        (      )   )   /
         \   (    (_/
           \_ )


Hello Mr. Gaurav Yadav,
Hi Soare,
1. I want to calculate the 99%VaR/1 day for the stock fonds, after sorting the values the 5th or 6th value is it?
In Historical simulation it is the 5th value...... because it tells you to be more cautious that a higher loss 'may' be there, secondly VaR only shows the possibility and not the maximum loss which you can incur :-) cheers
2. How do I calculate it under normal distribution aproximation? Well there is also a normal method or variance - covariance method which assumes normal distribution :-)
if you want to incorporate recency effect then you can also see boudhouks method

try this paper which will give you very good understanding of various methods of VaR

http://papers.ssrn.com/sol3/papers.cfm?abstract_id=51420#PaperDownload

++++++++++++++++++

apply(tstock,2,function(x) VaR(x,alpha=0.01)) # are these the right VaR's for the stockfonds?
@@@ you can yourself see it, you have around 579 observation and 1% of it mean 5.79th observation
Thus if you become risk averse then you take the 5th smallest value and otherwise 6th value.
So just sort the returns in ascending order and then see the 5th and the 6th values

> sorted_espa_stock_europe<-sort(tstock[,2])
> sorted_espa_stock_europe[5]
[1] -2.86
> sorted_espa_stock_europe[6]

[1] -2.74
>

your code gives -2.86 thus you can get the rest :-) cheers



DISCLAIMER AND CONFIDENTIALITY CAUTION: This message and any attachments with it (the "message") are confidential and intended
solely for the addressees. Unauthorized reading, copying, dissemination, distribution or
disclosure either whole or partial, is prohibited. If you receive this message in error,
please delete it and immediately notify the sender. Communicating through email is not
secure and capable of interception, corruption and delays. Anyone communicating with The
Clearing Corporation of India Limited (CCIL) by email accepts the risks involved and their
consequences. The internet can not guarantee the integrity of this message. CCIL shall
(will) not therefore be liable for the message if modified. The recipient should check this
email and any attachments for the presence of viruses. CCIL accepts no liability for any
damage caused by any virus transmitted by this email.

DISCLAIMER AND CONFIDENTIALITY CAUTION: This message and any attachments with it (the "message") are confidential and intended solely for the addressees. Unauthorized reading, copying, dissemination, distribution or disclosure either whole or partial, is prohibited. If you receive this message in error, please delete it and immediately notify the sender. Communicating through email is not secure and capable of interception, corruption and delays. Anyone communicating with The Clearing Corporation of India Limited (CCIL) by email accepts the risks involved and their consequences. The internet can not guarantee the integrity of this message. CCIL shall (will) not therefore be liable for the message if modified. The recipient should check this email and any attachments for the presence of viruses. CCIL accepts no liability for any damage caused by any virus transmitted by this email.

        [[alternative HTML version deleted]]



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 11 May 2007 - 06:08:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 May 2007 - 06:31:53 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.