[R-sig-finance] VAR, VECM, Kalman, ... non-R software recommendations?

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Sat Aug 21 01:34:14 CEST 2004


On Fri, 20 Aug 2004 17:36:03 -0700 krishna kumar wrote:

> I have mucked around with the kalman for estimating time-varying
> betas.  there was another interest
> in cointegration stuff a few weeks back.
> 
> I will clean up my code, and put it up someplace.
> 
> One suggestion i have for R-SIGGERS is to have a place to post code
> like a repository.
> Someplace like the elseiver computer physics code repository
> 
>  http://www.cpc.cs.qub.ac.uk/
> for which you have to cough up $$$.  The R-SIG repository should be
> free.
> 
> The idea is already in place for some econometric journals where you 
> have people uploading their data-sets and routines.
> It would be nice to have a facility where one can upload the code with
> a little blurb of what the routines are doing.
> 
> any ideas.??.  I am sure there is a opensource thingie that accepts
> code and a little document and that allows users to rate/leave
> comments?
> 
> If anyone knows one let me know. We are going to see more and more of 
>  
> "How do I do foo goo in R ?"    or 
> "I  know we can do boomoo in math$  but can you do it in R ?"

There are several ways of doing that more generally with R (or other
statistics software). The most obvious idea is, of course, to write a
simple R package and post it on CRAN: this can contain the R functions,
data sets, help pages, further documentation in vignettes etc.
To document what your software is doing and how it can be used, there's
the possibility to submit the package plus documentation to the Journal
of Statistical Software
  http://www.jstatsoft.org/
either for the articles section or the code snippets.

Of course, a full package might seem overkill for some simpler things.
Maybe, it would be a good idea to start a snippet package for
computational finance and econometrics with R. Maybe, we can find a
volunteer who could put something together like Greg Warnes does with
the gregmisc package which hosts nifty code snippets by various authors.

Finally, really simple things could also be posted to the list(s) and
will then be archived anyway. But this would have to be really small
pieces of code, probably.

The advantage of a full CRAN package (possibly one containing snippets
by various authors) is that this is regularly checked and hence needs to
be actively maintained...and it comes in a standard format and can be
trivially accessed via install.packages() and update.packages().
In the repositories of the journals you often find old and out-dated
code which wasn't bug-fixed although mistakes might have been
discovered, with documentation that is insufficient or not easy to
access, data sets in different formats etc. 

Best,
Z

> Just my 2 cents.
> 
> 
> 
> Jeffrey Todd Lins wrote:
> 
> >Hi Dirk,
> >
> >Yes, in stats there is a set of Kalman filter routines and you can
> >use optim for likelihood estimation. I have used it for some state
> >space modeling. There is a chapter in Zivot and Wang's book on the
> >topic as well.
> >
> >In addition initializing in the KF may be an important consideration
> >- see Harvey and/or Durbin and Koopman.
> >
> >I have never really used DSE for VAR, ended up writing the code
> >elsewhere, outside of R, but you could look at gretl, which is
> >available under GNU GPL and written in C, it contains quite a few
> >bits and pieces, I am assuming you can get the source.
> >
> >Jeff
> >
> >
> >
> >
> >
> >-----Original Message-----
> >From: r-sig-finance-bounces at stat.math.ethz.ch
> >[mailto:r-sig-finance-bounces at stat.math.ethz.ch]On Behalf Of Pijus
> >Virketis
> >Sent: Friday, August 20, 2004 7:37 PM
> >To: Dirk Eddelbuettel
> >Cc: R-sig-finance at stat.math.ethz.ch
> >Subject: RE: [R-sig-finance] VAR, VECM, Kalman,... non-R software
> >recommendations?
> >
> >
> >Dear Dirk,
> >
> >As far as my personal experience goes, I needed to estimate such
> >models some time ago, when the R toolkit for this sort of thing was
> >still almost empty, so I chose to invest in STATA: it provides a
> >fairly complete set of functions to estimate VAR, SVAR and (as of two
> >months ago) VECM models, validate their results and stability, and
> >calculate all the frequently-needed derivatives, such as the MA forms
> >(i.e. IRFs, SIRFs, ...), etc. For what it's worth, I chose STATA over
> >many other contenders in the field because it seemed to have some of
> >those R-like pro-active qualities, like frequent updates,
> >knowledgeable and involved users, and accessible developers (to which
> >I can personally attest after running into a couple of bugs in the
> >early SVAR code). The R-STATA intercommunication is made possible by
> >the foreign package, batch modes, and good old ASCII. ;) STATA
> >programming is a bit laborious, so I always only farm out the
> >absolute minimum to it, and do the remainder in R. As you said, STATA
> >let me "hit the ground running", and is really not a bad compromise.
> >
> >Of course, today R's own arsenal for time-series econometrics is
> >shaping up fast as well. Most significantly, there is now the CRAN
> >urca package by Bernhard Pfaff: it provides the means to estimate
> >VECM models (both the transitory and long-term flavours) and
> >Johansen's co-integration tests built on top them. Sadly, VAR/SVAR
> >and associated battery of helper functions are still not available,
> >as far as I am aware.
> >
> >As for the Kalman filter, there is the Kalman... family of functions
> >in stats: perhaps that's a good place to start? Sadly, I have not yet
> >had a chance to use space-state models in a proper project, so my
> >knowledge of the available tools and their relative capabilities is
> >modest. Also, if you can get to it, R. Carmona's neat book
> >"Statistical Analysis of Financial Series in S-Plus" (Springer, 2004)
> >has a few sections(6.2-6.7) on state-space models and Kalman
> >filtering thereof (S code included), with applications to finance.
> >
> >Cheers,
> >
> >Pijus
> >
> >  
> >
> >>-----Original Message-----
> >>From: r-sig-finance-bounces at stat.math.ethz.ch
> >>[mailto:r-sig-finance-bounces at stat.math.ethz.ch] On Behalf Of
> >>Dirk Eddelbuettel
> >>Sent: Friday, August 20, 2004 12:49 PM
> >>To: R-sig-finance at stat.math.ethz.ch
> >>Subject: [R-sig-finance] VAR, VECM, Kalman,... non-R software
> >>recommendations?
> >>
> >>
> >>I've been asked to run some 'modern' regressions: vector
> >>autoregression,
> >>vector error correction, kalman filter, ... 
> >>
> >>Of course, I'd love to do that in R and will probably end up
> >>writing some
> >>code for it, but as the platitude goes, I 'need to hit the
> >>ground running'.
> >>Last time I looked at Paul Gilbert's dse bundle, it promised
> >>most of this,
> >>but felt somewhat cumbersome. 
> >>
> >>Does anybody here have any particular recommendations, and in
> >>particular,
> >>warnings about software like EViews, Rats, ... in this context ?
> >>
> >>Thanks in advance,  Dirk
> >>
> >>--
> >>Those are my principles, and if you don't like them... well,
> >>I have others.
> >>    
> >>
> 
> _______________________________________________
> R-sig-finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>



More information about the R-sig-finance mailing list