Anda di halaman 1dari 13

An Introduction to R for Traders

Ram Venkat Dawn Analytics

R environment
R is an open source environment for statistical computing An Integrated environment for data manipulation, calculation and graphical output R is also a dynamic and object oriented programming language !tandard install consists of around "# core packages that cover most common statistical and other tasks $RA% contains over &### contributed packages and it is growing

R , R!tudio installation
'oth R and R!tudio are available in (indows, )ac, uni* and +inu* R installation instruction , http,--cran.r project.org-doc-manuals-R admin.html Rstudio is a free open source ID/ for R, we will be using Rstudio for this tutorial R!tudio can be downloaded from http,--rstudio.org-download-

R packages and sample datasets


Installing an R package, e.g 0install.packages123uantmod 24 23uantmod5 is package for trading and we will be using this for this tutorial 6sing 3uantmod to load some basic data 6sing in built data sets of R

R as an object oriented language


/verything is an 7bject in R A brief look at an R program $alling R programs in batch mode R functions and packages http,--www.r bloggers.com-create an r package in under 8 minutes $alling R from other languages R 9rogramming )odel 9arallel R

R 7bjects and classes


$ore 7bjects
Vector +ist :unctions 7ther 7bjects )atri* Array Data :rames :actors

Data inputs and Data $leaning


Through package interfaces :rom $!V :rom Databases /*cel interface Data $leaning facilities

R ;raphics
graphics, lattice and grid packages graphics 9ackage charts, barplot,dot chart,histogram,density plots,strp charts, 3uantile plots, scatter plots, image plots, contour plots, interaction plots, sunflower plots +attice splits a chart into different panels or groups , making multiple plots on same page easy

!tatistical computing
Data Analysis , !ummary, $orrelation, principal $omponent Analysis, :actor Analysis Time !eries 9robablity Distributions !tatistical tests Regression )odels $lassification )odels $lustering

3uantmod package
2A rapid prototyping environment, where 3uant traders can 3uickly and cleanly e*plore and build trading models. 2 <uantmod e*ample on data handling <uantmod e*ample on charting <uantmod e*ample on modelling :or more , www.3uantmod.com-e*amples-

7ther packages of interest to Traders


R sig finance is your best bet to keep track of the packages, https,--stat.eth=.ch-pipermail-r sig finance 7ther packages mentioned fre3uently , Rmetrics1fportfolio4,portfolio, Rglpk>solve>+9 1portfolio optimi=ation4 'roker specific, Ibrokers 1I'4

R 'ooks and Tutorials


'ook 2R in a %utshell5 by ?oseph Adler 17@Reilly4 cran R 2An introduction to R5 http,--cran.r project.org-doc-manuals-R intro.html <uck R site , http,--www.statmethods.net- gives a discount on the book 2R in Action5 from )anning

R and time series, http,--www.stat.pitt.edu-stoffer-tsa"-

Thank Aou :or any clarification, send e mail to ramBdawnanalytics.com