Skip to content

How to extract all VaR values?

6 messages · Brian G. Peterson, Alexios Ghalanos, Guillaume Yziquel +1 more

#
On list. Thanks. I'll take a look at it in a bit if no one beats me to it.

- Brian

-------- Original Message --------
Subject: 	Re:Re: [R-SIG-Finance] How to extract all VaR values?
Date: 	Sat, 23 Jan 2010 22:35:51 +0800 (CST)
From: 	??? <dengyishuo at 163.com>
To: 	Brian G. Peterson <brian at braverock.com>
References: 	<4B5B054F.5090207 at braverock.com> 
<1264255303705-1288195.post at n4.nabble.com>



library(rgarch)
data(sp500ret)
ctrl = list(RHO = 1,DELTA = 1e-9, MAJIT = 100,MINIT = 650,TOL = 1e-7)

spec = ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,1)), 
		mean.model = list(armaOrder = c(0,0), include.mean = TRUE), 
		distribution.model = "std")

sp500.bktest = ugarchroll(spec, data = sp500ret, n.ahead = 1, forecast.length = 100, 
		refit.every = 1, refit.window = "recursive", use.mclapply = FALSE, 
		solver = "solnp", fit.control = list(), solver.control = ctrl,
		calculate.VaR = TRUE, VaR.alpha = c(0.01, 0.025, 0.05))

#Is there anyway for me to extract everyday's VaR values?




--
???
----------
Regards,
YiShuo
--
YiShuo Deng
Phone: +86-(0)10-62264532
Mobile: +86-13651352627

School of Statistics,
Central University of Finance and Economics, Haidian District ,Beijing, 
100081, China


?2010-01-23 22:18:55?"Brian G. Peterson" <brian at braverock.com> ???

  
    
#
There is a data.frame extractor function which is documented (type 
?ugarchroll and look at the
returned class which lists methods for it).

Briefly, you type as.data.frame(x, which = "VaR", n.ahead = ...), where 
"x" is an object of class
uGARCHroll returned from running the ugarchroll function, and n.ahead is 
the n-ahead forecast horizon you
want to have a value returned for and was supplied in the call to the 
ugarchroll function.

Note that the VaR is based on the analytical evaluation of the forecast 
density returned from the GARCH
model rolling forecast.

Regards,
Alexios Ghalanos

On 1/23/2010 2:43 PM, Brian G. Peterson wrote
#
Brian G. Peterson a ?crit :
Hi.

I've just tried using rgarch, and it seems to me that there are a few 
issues with the package. I'm installing the package from R-forge:
So I tried to check the availability of the dependencies:
In the rgarch repository, I see that rgarch depends on Rsolnp:

http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/DESCRIPTION?rev=143&root=rgarch&view=markup

But somehow, on the Net, I only see things concerning Rsolnp2, which is 
available in the Rmetrics package. Moreover, in the Rmetrics repository, 
you have:

http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/Rsolnp2/IMPORTANT?rev=4479&root=rmetrics&view=markup
But Rsolnp is nowhere to be seen.

So am I hitting a real issue getting rgarch to work on my Debian R 
system? Or, plainly, how do you get rgarch working?

All the best,
#
The 'official' Rsolnp package is part of the Rino package on r-forge, 
which a search in R or google reveals(http://lmgtfy.com/?q=Rsolnp).

http://r-forge.r-project.org/projects/rino/

Regards,
-Alexios Ghalanos
On 1/24/2010 2:39 PM, Guillaume Yziquel wrote:
#
On 24 January 2010 at 15:39, Guillaume Yziquel wrote:
| I've just tried using rgarch, and it seems to me that there are a few 
| issues with the package. I'm installing the package from R-forge:
| 
| >> install.packages("rgarch",repos="http://R-Forge.R-project.org")
| > Avis dans install.packages("rgarch", repos = "http://R-Forge.R-project.org") :
| >   l'argument 'lib' manque : '/home/yziquel/R/x86_64-pc-linux-gnu-library/2.10' est utilis?
| > also installing the dependency ?Rsolnp?
| > 
| > essai de l'URL 'http://R-Forge.R-project.org/src/contrib/Rsolnp2_0.3.tar.gz'
| > Content type 'application/x-gzip' length 120837 bytes (118 Kb)
| > URL ouverte
| > ==================================================
| > downloaded 118 Kb
| > 
| > essai de l'URL 'http://R-Forge.R-project.org/src/contrib/regr0_1.0.tar.gz'
| > Content type 'application/x-gzip' length 114317 bytes (111 Kb)
| > URL ouverte
| > ==================================================
| > downloaded 111 Kb
| > 
| > * installing *source* package ?Rsolnp2? ...
| > ** R
| > ** inst
| > ** preparing package for lazy loading
| > ** help
| > *** installing help indices
| > ** building package indices ...
| > * DONE (Rsolnp2)
| > * installing *source* package ?regr0? ...
| > ** R
| > ** data
| > ** preparing package for lazy loading
| > ** help
| > Avis : ./man/drop1.regr.Rd:30: unknown macro '\lind'
| > *** installing help indices
| > ** building package indices ...
| > * DONE (regr0)
| > 
| > Les packages t?l?charg?s sont dans
| > 	?/tmp/Rtmp0M6Zuj/downloaded_packages?
| >> library(rgarch)
| > Erreur dans library(rgarch) : aucun package nomm? 'rgarch' n'est trouv?
| 
| So I tried to check the availability of the dependencies:
| 
| >> library(stats)
| >> library(graphics)
| >> library(methods)
| >> library(Matrix)
| > Le chargement a n?cessit? le package : lattice
| >> library(chron)
| >> library(Rsolnp)
| > Erreur dans library(Rsolnp) : aucun package nomm? 'Rsolnp' n'est trouv?
| >> library(Rsolnp2)
| >> library(sandwich)
| > Le chargement a n?cessit? le package : zoo
| 
| In the rgarch repository, I see that rgarch depends on Rsolnp:
| 
| http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/DESCRIPTION?rev=143&root=rgarch&view=markup
| 
| But somehow, on the Net, I only see things concerning Rsolnp2, which is 
| available in the Rmetrics package. Moreover, in the Rmetrics repository, 
| you have:
| 
| http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/Rsolnp2/IMPORTANT?rev=4479&root=rmetrics&view=markup
| 
| > new package Rsonlp2 from Alexios and Stefan added
| > 
| > This solver will be withdrawn from Rmetrics as soon as the solver package
| > Rsonlp written by Alexios Ghalanos and Stefan Theussl will be released to
| > CRAN.
| > 
| > Diethelm Wuertz
| 
| But Rsolnp is nowhere to be seen.
| 
| So am I hitting a real issue getting rgarch to work on my Debian R 
| system? Or, plainly, how do you get rgarch working?

This may or may not be related:

  Date: Sun, 24 Jan 2010 10:09:43 +0000
  From: Barry Rowlingson <b.rowlingson at lancaster.ac.uk>
  To: r-help at r-project.org
  Subject: [R] R-forge getting the wrong package

  After accusing someone of typing 'install.packages("weather")' instead
  of 'install.packages("webmaps")', I discovered that R-forge really is
  currently returning the wrong source tarball for packages after
  'Repitools' in the alphabet.

  The data returned from available.package in install.packages goes out
  of sync at 'Repitools':

  RemoteREngine                      "RemoteREngine_0.0-8.tar.gz"
  RemoteSensing                      "RemoteSensing_0.2-5.tar.gz"
  Repitools                          "RepitoolsExamples_1.01.tar.gz"
  Rglpk                              "Repitools_0.0.107.tar.gz"
  Ripop                              "Rglpk_0.3-2.tar.gz"
  Rllvm                              "Ripop_0.1.tar.gz"
  RlpSolveAPI                        "Rllvm_0.1.tar.gz"
 
  [...]

Can you please download the .tar.gz in question by hand, run R CMD INSTALL on
it and see if that works?  You may have to do that recursively for its
dependencies.  

Dirk
1 day later
#
Dirk Eddelbuettel a ?crit :
Yes. That definitely was the issue. Sorry for the bother.

All the best,