Monthly Archives: May 2012

How to do parallel R loops within Windows and Linux. No more expensive Matlab worker licenses

How to do parallel R loops within Windows and Linux. No more expensive Matlab worker licenses

The major reasons I switched from Matlab was for exactly this. Under Matlab, the worker licenses will kill but now you can you can do this for free under R. Thanks to makers of these adequate R packages.

If you follow this tutorial

http://viksalgorithms.blogspot.ca/2012/01/parallel-r-loops-for-windows-and-linux.html

You should hjave no problems executing these commands as I tried with no issues. Just do note the proper R packages you need in your backend depending on your operating system of Windows versus Linux.

Using non parametric package within R with proper working tutorial

 

Using non parametric package within R with proper working tutorial

This link and PFF looks good:

http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-nonparametric-regression.pdf

Although, it is in S and SPplus, it is fully compatible with R. The only question is how to get the data as there is no mention of the source.

This one seems to work better though with improved explanation:

http://cran.r-project.org/web/packages/np/vignettes/np.pdf

Using the np R packahe

Youtube video on using RCaller R package to call R from within Java application

Youtube video on using RCaller R package to call R from within Java application

This seems to work o from within a Linux virtual machine:

http://www.mhsatman.com/rcaller.php

http://stdioe.blogspot.ca/2011/07/rcaller-20-calling-r-from-java.html

Ensure to use RCaller 2..7 JAR for the above example to work.

http://stdioe.blogspot.ca/2011/07/rcaller-20-calling-r-from-java.html

[youtube_sc url=”http://www.youtube.com/watch?v=fHt0cq-6BvM” playlist=”r java”]

 

An excellent tutorial on how to use the Pairs Trading package in R

An excellent tutorial on how to use the Pairs Trading package in R

http://www.r-bloggers.com/pair-trading-strategy-how-to-use-pairtrading-package/

I can verify the above code works from end to end. The impressive thing is it is much simpler tha the Matlab version with their webinar. Here you estimate, generate the signal, and perform a backtest. It shows how easy some of these R packages are.

 

A working introduction to time series analysis in R

A working introduction to time series analysis in R

From

http://www.statoek.wiso.uni-goettingen.de/veranstaltungen/zeitreihen/sommer03/ts_r_intro.pdf

Some notes :

On page 13 for :summary(lm(lbeer t+t2+sin.t+cos.t))

Ensure you have summary(lm(lbeer ~ t+t2+sin.t+cos.t)) to work

As of page 19, I am not sure where to retreieve LakeHuron data. Is it part part of the timeSeries package folder?  I could not find it

There also appears to be a more advanced PDF at

http://www.stats.uwo.ca/faculty/aim/tsar/tsar.pdf

I was able to get the code working on Pages 34, 40

Excellent tutorial on using urca R package for VAR, Cointegration, Statistical Tests, Non Stationary Processes, benchmarks and estimating models

Excellent tutorial on urca R package for VAR, Cointegration, Statistical Tests, Non Stationary Processes , benchmarks, estimating models
Wow! This tutorial at http://www.pfaffikus.de/download/tutorial-useR2008.pdf is quite excellent! As I look for cointegration tests like Dickey Fuller, this tutorial has it! Also, there are some demos on VAR with traditional processes. I must say I have validated some of the R code which seems to work ok! Plots work too!  Also, there are some very good definitions and algo equations given. Thus far, this is an excellent resource to see the power of R in forecasting! There seems to be no question of how data is generated as it is randomly generated.  No wonky data conversion here in these examples!

R source code example on how to trade using a GARCH Volatility Forecast

R source code example on how to trade using a GARCH Volatility Forecast

I found this link:

http://www.r-bloggers.com/trading-using-garch-volatility-forecast/

I am using RStudio so I can confirm sthat the code seems to be ok but the plots fail with a message;
> plotbt.custom.report.part1(regime.switching.garch, regime.switching, buy.hold)
Error in plot.window(…) : Logarithmic axis must have positive limits
In addition: Warning message:
In xy.coords(x, y, xlabel, ylabel, log) :
  3120 y values <= 0 omitted from logarithmic plo

Could it be the data used? I am not sure but I only need the data anyhow. Looks good but still need to validate it as I get more comfortable with R.

How to list files and get and set current working directory in R

How to list files and get and set current working directory in R

getwd returns an absolute filepath representing the current working directory of the R process; setwd(dir) is used to set the working directory to dir.

Usage

getwd()

setwd(dir)

list.files()

Look at to understand R functions and how to maniupulate their objects

http://stackoverflow.com/questions/9036059/r-execute-function-as-if-it-were-entered-in-an-interactive-session