R for the Technical Analysis Challenge



This page relates to the autumn 2003 Technical Analysis Challenge and the related working paper.

Introduction to R

R is free, open-source software that provides an environment for data analysis, graphics and statistics. You can download the software, documentation and so on from the R Project website.

An introduction to using R is "Some hints for the R beginner".

An exposition of some of the merits of R is "An Introduction to the S Language".


R for the Technical Analysis Challenge Data

1) Download ("save frame as" or "save page as" or "save as") the csv files earlydata.csv and latedata.csv and have the files on your computer (with the same filenames). Also download R_for_tac_data.txt into the same location.

2) Start R:
If you are on Windows, then use the "change dir" item in the file menu in R to change the working directory to wherever the csv files are.

If you are on Linux or Unix, start R in the directory where the csv files are.

If you are on a Macintosh, you'll have to figure out what to do yourself (but it is likely to be reasonably simple).

3) Type the following to R:

source("R_for_tac_data.txt")

(followed by hitting the "enter" key). This will execute the commands that are in R_for_tac_data.txt. If all goes well, you should have three objects in your workspace, the names of which you can see with:

ls()

Each of the three objects is a matrix where each column represents a price series.


4) You can also download plotfunctions.R which contains functions that create plots of the data. Before you can use the functions, you will need to source the file into R:

source("plotfunctions.R")

The plot functions are used like:

early.plot()

This will ask you to hit the "return" key before you see a plot. You may need to change the focus from the graphics window to the command window. (You may also find it convenient to change the size of the command window.) The other two plotting functions are called similarly:

late.plot()
all.plot()


The commands above produce plots as are given in the pdf files of plots. Perhaps the most likely variation would be:

all.plot(mfrow=c(1,1))

which produces one plot per page rather than four plots per page.

R Mailing Lists

The R-help mailing list provides a place where questions can be asked (and usually expeditiously answered) about using R. There is also a mailing list specifically for those who are interested both in R and finance.

You can join the R-help mailing list via the R Project website.
Sign up to the R-finance list via:
https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-finance



Go to Burns Statistics Home.

Direct access to this page is
http://www.burns-stat.com/page/Tutor/r_for_tac.html

Last Modified: 2010 March 07