User Account Control (Windows)

January 11, 2011
By

When using Windows Vista / 7, Windows' User Account Control can be annoying. When is R going to be Windows 7 ready, asking for elevated priviliges only when needed? I guess the problem lies in the structure of packages.Running Rgui.exe "as Administrato...

Read more »

OpenData + R + Google = Easy Maps

January 11, 2011
By
OpenData + R + Google = Easy Maps

The release of the R package “googleVis” has made the production of interactive maps through Google’s Chart Tools a simple task. Ignoring the some basic data manipulation the below map...

Read more »

Reasons for Transitioning to Vim: Bringing LaTeX, R, Sweave and More under One Roof

January 10, 2011
By

This post describes the reasons for my transition to Vim. Brief Background Over the years I've used a lot of different text editors on Windows. In general, I've used whatever text editor came with a program. When I started using R, I moved from Rgui t...

Read more »

Reasons for Transitioning to Vim: Bringing LaTeX, R, Sweave and More under One Roof

January 10, 2011
By
Reasons for Transitioning to Vim: Bringing LaTeX, R, Sweave and More under One Roof

This post describes the reasons for my transition to Vim.Brief BackgroundOver the years I've used a lot of different text editors on Windows.In general, I've used whatever text editor came with a program.When I started using R, I moved from Rgui throug...

Read more »

Six places left for the forecasting workshop

January 10, 2011
By

There are six places left for the forecasting workshop I am giving in Switzerland in June. If you were thinking of going, book in fast!

Read more »

Emacs Starter Kit for the Social Sciences: Now Easier to Install

January 10, 2011
By

New in nerdery this week, it’s now a bit easier to install the Emacs Starter Kit for the Social Sciences that I put together (based on lots of great work by Phil Hagelberg and, more recently, Eric Schulte). In the past, the fact that AucTeX was b...

Read more »

Le Monde puzzle [1]

January 10, 2011
By
Le Monde puzzle [1]

Following the presentation of the first Le Monde puzzle of the year, I tried a simulated annealing solution on an early morning in my hotel room. Here is the R code, which is unfortunately too rudimentary and too slow to be able to tackle n=1000. #minimise \sum_{i=1}^I x_i #for 1\le x_i\le 2n+1, 1\e i\le I

Read more »

Run R in parallel on a Hadoop cluster with AWS in 15 minutes

January 10, 2011
By

If you're looking to apply massively parallel resources to an R problem, one of the most time-consuming aspects of the problem might not be the computations themselves, but the task of setting up the cluster in the first place. You can use Amazon Web Services to set up the cluster in the cloud, but even that take some time,...

Read more »

Revolution R with Eclipse Helios

January 10, 2011
By

One of the reasons that I don’t often take advantage of the cool features in Revolution R is that I absolutely can’t stand their Visual Studio interface. Previously, if I wanted to run something in RevoR, I fired up the … Continue reading →

Read more »

Seasonal pair trading

January 10, 2011
By
Seasonal pair trading

quanttrader.info is a good quantitative repository, where I found an idea about seasonal spreads play. The idea of seasonal pair trading differs from pairs trading in a way, that it doesn’t try to find deviation from the spread’s mean, but it looks at seasonal spread patterns. In some cases it is easier to find an

Read more »

Example 8.20: Referencing lists of variables, part 2

January 10, 2011
By
Example 8.20: Referencing lists of variables, part 2

In Example 8.19, we discussed how to refer to a group of variables with sequential names, such as varname1, varname2, varname3. This is trivial in SAS and can be done in R as we showed.It's also sometimes useful to refer to all variables which begin w...

Read more »

Abusing Amazon’s Elastic MapReduce Hadoop service… easily, from R

January 10, 2011
By
Abusing Amazon’s Elastic MapReduce Hadoop service… easily, from R

JD Long's experimental segue package makes it easy to use Amazon's Elastic MapReduce service to fire up a Hadoop cluster and use it for non-Big Data, computationally-intensive tasks. The package provides a cluster-aware version of lapply() which "just works".

Read more »

Install R Packages wherever needed

January 10, 2011
By

I frequently occupy computers everywhere with extensive MCMC tasks. Installing R doesn't take long, but it can be very annoying if you manually have to install dozens of R packages before your code is able to run. Well, now I use the following command ...

Read more »

Install R Packages wherever needed

January 10, 2011
By

I frequently occupy computers everywhere with extensive MCMC tasks. Installing R doesn't take long, but it can be very annoying if you manually have to install dozens of R packages before your code is able to run. Well, now I use the following command ...

Read more »

General-purpose MCMC draw saver for R

January 10, 2011
By

If you do MCMC with R, you probably know how nasty "bookkeeping" of draws can be. So I quickly coded up a small function which does everything for you. Every parameter has to begin with "mcmc_" or another to-be-defined string, then just run mcmcsave...

Read more »

General-purpose MCMC draw saver for R

January 10, 2011
By

If you do MCMC with R, you probably know how nasty "bookkeeping" of draws can be. So I quickly coded up a small function which does everything for you. Every parameter has to begin with "mcmc_" or another to-be-defined string, then just run mcmcsave...

Read more »

R function for extracting F-test P-value from linear model object

January 10, 2011
By

I thought it would be trivial to extract the p-value on the F-test of a linear regression model (testing the null hypothesis R²=0). If I fit the linear model: fit<-lm(y~x1+x2), I can't seem to find it in names(fit) or summary(fit). But summary(fit)$fstatistic does give you the F statistic, and both degrees of freedom, so I wrote this function to...

Read more »

Really useful bits of code that are missing from R

January 10, 2011
By
Really useful bits of code that are missing from R

There are some pieces of code that are so simple and obvious that they really ought to be included in base R somewhere. Geometric mean and standard deviation – a staple for anyone who deals with lognormally distributed data. geomean <- function(x, na.rm = FALSE, trim = 0, ...) { exp(mean(log(x, ...), na.rm = na.rm,

Read more »

R interface to Google Chart Tools

January 10, 2011
By

Hans Rosling eat your heart out! It is now possible to interface R statistics software to Google’s Gapminder inspired Chart Tools. The plots below were produced using the googleVis R package and three datasets from the Gapminder website. The first shows the relationship between income, life expectancy and population for 20 countries with the highest ...

Read more »

EmEditor R code macro – Almost interactive R development for Emeditor

January 10, 2011
By

Get the new macro now hosted on githubEdit 18th Jan 2011: The below text refers to the old version of the macro and is no longer relevant, a new post will  describe the new macro, and it is also documented on the github site.As a follow ...

Read more »

Using R for Introductory Statistics, Chapter 4, Model Formulae

January 10, 2011
By
Using R for Introductory Statistics, Chapter 4, Model Formulae

Several R functions take model formulae as parameters. Model formulae are symbolic expressions. They define a relationship between variables rather than an arithmetic expression to be evaluated immediately. Model formulae are defined with the tilde ope...

Read more »

Using R for Introductory Statistics, Chapter 4, Model Formulae

January 10, 2011
By
Using R for Introductory Statistics, Chapter 4, Model Formulae

Several R functions take model formulae as parameters. Model formulae are symbolic expressions. They define a relationship between variables rather than an arithmetic expression to be evaluated immediately. Model formulae are defined with the tilde ope...

Read more »

Batting and Bowling performance in Ashes 2010 – 2011

January 9, 2011
By
Batting and Bowling performance in Ashes 2010 – 2011

English cricket is strong once again. And it is great to see that (after all they invented the gentleman's game).In a sharp contrast to previous tours of Australia, England outplayed Australia on their home ground in the recently concluded Ashes 2...

Read more »

Batting and Bowling performance in Ashes 2010 – 2011

January 9, 2011
By
Batting and Bowling performance in Ashes 2010 – 2011

English cricket is strong once again. And it is great to see that (after all they invented the gentleman's game).In a sharp contrast to previous tours of Australia, England outplayed Australia on their home ground in the recently concluded Ashes 2...

Read more »

LearnR Toolkit To Help Excel Users Move Up To R

January 9, 2011
By
LearnR Toolkit To Help Excel Users Move Up To R

As a former  Excel chart user, I want to help current Excel users make the transition to more advanced charting R with as little difficulty as possible. This post introduces my LearnR Toolkit to help Excel users move up to … Continue reading ...

Read more »

From one extreme (0) to another (1): challenge failed, but who cares…

January 9, 2011
By
From one extreme (0) to another (1): challenge failed, but who cares…

Just after arriving in Montréal, at the beginning of September, I discussed statistics of my blog, and said that it might be possible - or likely - that by new year's Eve, over a million page would have been viewed on my blog (from Google's count...

Read more »

R and Google Visualization API

January 8, 2011
By
R and Google Visualization API

R interfaces with the powerful Google Visualization API with the package googleVis (see here). It's relatively easy to convert your graphics in R to interactive graphics to post on a web browser. And the graphics are quite nice, as seen below in a simple graph of some of my data collected from this summer on seed predation to...

Read more »

RcppArmadillo 0.2.11

January 8, 2011
By

Just before Xmas, Conrad Sanderson released version 1.1.0 of Armadillo, his templated C++ library for linear algebra. Which I only noticed this week, so here comes version 0.2.11 of RcppArmadillo, our Rcpp-based integration into R. The only other ...

Read more »

The Automatic Millionaire & Amortization

January 8, 2011
By
The Automatic Millionaire & Amortization

Dan Byrne of Vanderbilt University gave me a book back in October titled The Automatic Millionaire by David Bach. The book is an easy read and full of sound advice that I intend to take. Bach espouses a plan for retirement built on the principles of “paying yourself first” (i.e. before taxation, 401(k), 403(b)), making

Read more »