An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20100701/73ff5262/attachment.pl>
R-Finance Tutorial
3 messages · Ben Nachtrieb, Brian G. Peterson, Gabor Grothendieck
On 07/01/2010 07:59 AM, Ben Nachtrieb wrote:
Yes, I am a programmer; however, R is set up quite a bit different. It seems like there are lots of redundancy in the community/resources. For example there seem to be 3 or 4 time series packages. Also, the responses I have received regarding my original question suggested 5 or 6 different packages and only 1 of those packages was mentioned more than once by the respondents. (Thank you!) From this perspective (finding and locating what to 'dive into'), I have found R very difficult. Also, R is very different from most languages I have used so that transition is quite challenging as well.
Those redundancies serve different needs. So, in time series, a couple of packages are historical (e.g. ts, its), some are more general than just finance (e.g. zoo) and others are optimized for large financial time series (e.g. xts, and arguably timeSeries) with timeSeries, it is used by default in all the RMetrics packages, so if you need to do something they do well (e.g. pricing algorithms, or some Garch methods) then you will use timeSeries. xts, being optimized for financial time series applications, is probably the best 'default' for you to use, because it has conversion methods for all the other classes. In the dedicated finance packages, similar 'specific purpose' answers will apply. Many of the topics you mentioned are covered by multiple packages because different authors had different needs. R is not a monolithic entity. Many different people write packages as needed to solve particular problems. You we not very specific in describing your particular problem, so you'll get answers from many different points of view.
That said I am committed to becoming an expert in R and see its wonderful efficiencies once it is understood by the user.
Well, the MASS book was a good suggestion, and the task views: http://cran.r-project.org/web/views/ (this could have been found by using rseek.org or Google on 'r-project task views') Regards, - Brian
Date: Thu, 01 Jul 2010 05:08:10 -0400 From: Sarbo<cmdr_rogue at hotmail.com> To: r-sig-finance at stat.math.ethz.ch Subject: Re: [R-SIG-Finance] R-Finance Tutorial Message-ID:<BLU0-SMTP60983592AF405DD1ABC6F5E2CD0 at phx.gbl> Content-Type: text/plain What Patrick wrote. Learning R is really best done simply by diving straight in. It's not a difficult language to learn, even if some of its quirks are really peculiar. One good book to start with would be "Modern Applied Statistics with R" by Venables and Ripley, which provides code, graphs, and suggestions on how to write good, robust R code. On Wed, 2010-06-30 at 08:56 -0600, Ben Nachtrieb wrote:
Hello, Does anyone have any good R-Finance tutorials? I can perform basic operations in R and I have a Master's degree in finance/investments; however, I would like to ties these together with an R-Finance tutorial. In other words, I need better understanding of the best packages and built-in functions available to me and how to use them.
I
don't want to reinvent the wheel so-to-speak. Basically I do quant analysis on forex, futures, and equities. So it is
the
usual time series, trade execution, portfolio, security ranking, back testing, optimization, etc. related functions and packages I am interested in. I will be using these programatically, so a good "front-end" or UI is not necessary (and would not be used). Does anyone have any good R-Finance tutorials? What I do not need is a Tutorial on R or Finance separately. I already have "Time Series Analysis - With Applications in R end
Edition",
but that is it...at this point. Thanks!
Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock
On Thu, Jul 1, 2010 at 8:59 AM, Ben Nachtrieb <ben.nachtrieb at gmail.com> wrote:
Patrick, Yes, I am a programmer; however, R is set up quite a bit different. It seems like there are lots of redundancy in the community/resources. For example there seem to be 3 or 4 time series packages. Also, the responses I have received regarding my original question suggested 5 or 6 different packages and only 1 of those packages was mentioned more than once by the respondents. (Thank you!) From this perspective (finding and locating what to 'dive into'), I have found R very difficult. Also, R is very different from most languages I have used so that transition is quite challenging as well. That said I am committed to becoming an expert in R and see its wonderful efficiencies once it is understood by the user. Thanks! Ben
There are typically multiple ways to do something in R and there are often multiple packages to do the same thing. Sometimes there is a preferred package but in other cases it just boils down to personal preference. Regarding your comment on time series frameworks, these: - "zoo" and "xts" packages (these two packages are closely related), - the rmetrics group of packages and - "fts" (and also an older package "its" by the same author as "fts") all have facilities to represent irregularly spaced series such as you would need in finance. There is also "rts" in the "tseries" package. "ts" class in the core of R and the "tis" package can represent regularly spaced series and, of course, since regularly spaces series are a subset of irregularly spaced you can also use irregularly spaced series package for regularly spaced series. Each of the frameworks has its own characteristics and and since many are under continual development they are moving targets so comments can get quickly outdated; however, being a "zoo" developer I can at least speak to that one. In terms of learning, the interface to "zoo" is very similar to that of "ts" in the core of R so if you know "ts" then its relatively easy to pick up "zoo" and visa versa - if you know "zoo" its easy to pick up "ts". Particular attention was paid to making it compatible with and to work the same as the rest of R. Also "zoo" is particularly general with the ability to represent an unlimited number of time classes and all the series from any of the other frameworks can be represented as zoo objects. Mixtures are possible so that, for example, you can have a "zoo" object which uses the "timeDate" class of rmetrics as its time class. The various "as" functions in "zoo" can be used to translate among the representations in many of the other packages. It also has a long history yet is still under active development, has quite a bit of documentation and has spawned an ecosystem of over 50 other packages that depend on or are used with it. Thus its easy to move back and forth among "zoo" and "ts" and "xts" providing additional flexibility. Some elements of the "zoo" package can be used without using "zoo" objects at all including certain lattice graphics which have since migrated to the "lattice" package (which is distributed as part of the R download), "yearmon" and "yearqtr" time classes and the "na.locf" function. To learn more, see this page: http://cran.r-project.org/web/packages/zoo and read the three vignettes (pdf documents) linked there. Also at the bottom of the same web page in the reverse dependencies portion of that page are links to the 50 or so other packages that depend on or use ". (The "zoo" FAQ also has such a list.) You can click on each of those and find out more info on each of those packages. You can also access the "zoo" vignettes mentioned above like this from within R: library(zoo) vignette(package = "zoo") vignette("zoo") vignette("zoo-faq") etc. and can also list the help information from that web page or from within R like this: help(package = zoo) and get individual help page like this, e.g. to get the help page on the zoo command: ?zoo That will bring up a local web page which you can read. Also at the bottom of that page click on "Index" to get a detailed list of links to help pages of other commands which you can click on in turn. Then try the same thing with the related "xts" package ("xts" is a subclass of "zoo") and also the "FinTS" package (which has no vignette but does have a book associated with it which you may wish to read). "FinTS" has a GUI to run its scripts that you start like this: runscript()