How to Add an Extra Vertical Axis to R Plots

December 28, 2012
By
How to Add an Extra Vertical Axis to R Plots

Especially when analyzing time series, we often need plots with two vertical axes. Researchers often expect the two series to \"move together,\" but with different locations and scales. To show that the series move together, you should give each series its own scale. One vertical scale should appear on the left side of the plot I encourage you...

Read more »

STL Transform

December 28, 2012
By

The STL transform function can be used to pass a single function over a vector. Here we use a simple function square(). #include <Rcpp.h> using namespace Rcpp; inline double square(double x) { return x*x ; } // ] std::vector<...

Read more »

UEFA, what were the odds ?

December 27, 2012
By
UEFA, what were the odds ?

Ok, I was supposed to take a break, but Frédéric, professor in Tours, came back to me this morning with a tickling question. He asked me what were the odds that the Champions League draw produces exactly the same pairings from the practice draw, and the official one (see e.g. dailymail.co.uk/…). To be honest, I don’t know much about soccer, so...

Read more »

ARMA+GARCH Experiences

December 27, 2012
By

A reader’s comment on my ARMA Models for Trading post asked about different aspects of my experience with ARMA+GARCH for trading forecasting. The more I thought about it, the more it looked like a full post. So here we go. Starting with the high level – what packages did I try? I have tried a

Read more »

My Intro to Multiple Classification with Random Forests, Conditional Inference Trees, and Linear Discriminant Analysis

December 27, 2012
By
My Intro to Multiple Classification with Random Forests, Conditional Inference Trees, and Linear Discriminant Analysis

After the work I did for my last post, I wanted to practice doing multiple classification.  I first thought of using the famous iris dataset, but felt that was a little boring.  Ideally, I wanted to look for a practice … Continue reading →

Read more »

Why Do the New Orleans Saints Lose? Data Visualization II

December 26, 2012
By
Why Do the New Orleans Saints Lose? Data Visualization II

I’m going to continue with my ‘making data visually appealing to the masses’ kick. I happen to like graphics and graphing data. I also happen to like American football (For the record, however, I’m a soccer player first, a rugby … Continue reading →

Read more »

Opening Large CSV Files in R

December 26, 2012
By
Opening Large CSV Files in R

Before heading home for the holidays, I had a large data set (1.6 GB with over 1.25 million rows) with columns of text and integers ripped out of the company (Kwelia) Database and put into a .csv file since I was going to be offline a lot over the break. I tried opening the csv file

Read more »

Science-y New Year’s Resolution: Learn to Code

December 26, 2012
By
Science-y New Year’s Resolution:  Learn to Code

In a 1995 interview Steve Jobs said he thought that computer programming should be a liberal art. In other words, he thought everyone’s education should include a year of learning a computer language, because it teaches you how to think in a certain way. If that was true in 1995, just think how much more

Read more »

Oracle R Enterprise 1.3 released

December 26, 2012
By

We're pleased to announce the latest release of Oracle R Enterprise, now available for download. Oracle R Enterprise 1.3 features new predictive analytics interfaces for in-database model building and scoring, support for in-database sampling and partitioning techniques, and transparent support for Oracle DATE and TIMESTAMP data types to facilitate data preparation for time series analysis and forecasting. Oracle...

Read more »

Recoding Polytomous Items with Missing Categories

December 26, 2012
By

This function helps prepare data for analysis with models that require polytomous items to be coded from 0 to N without missing categories, such as the Partial Credit Model (Masters, 1982). When there are no missing categories, an item that was suppos...

Read more »

Shiny Pubmed Word Clouds

December 26, 2012
By

Recently, I’ve started working on my website redesign, including the redesign of my research page. As somebody who works with different types of networks on (almost) daily basis, it would be easy to just create pretty network pictures and use … Continue reading →

Read more »

Wrapper functions in GNU R

December 26, 2012
By

Recently I have been working with GNU R optimization routines a lot. Function optim has a nice trace option that allows to monitor optimization progress. Another standard function optimize has no such feature but it is pos...

Read more »

R Markdown to other document formats

December 26, 2012
By

Perhaps you have a file written in Markdown with embedded R of the kind that RStudio makes so nice and easy but you’d like a range of output formats to keep your collaborators happy.  Say latex, pdf, html and MS Word.  Here’s what you might do I shall imagine your file is called doc.Rmd Install pandoc

Read more »

MeRRy ChRistmas!

December 25, 2012
By
MeRRy ChRistmas!

Merry Christmas is.R() readers! Thanks for accompanying us through an excellent first semester of R blogging, and for your feedback and enthusiasm. To celebrate, we’ve built an image mosaic from the shiny, happy avatars of our over 600 (!) Twitter followers. Click for a beautiful mosaic! We’ll be back in 2013 with...

Read more »

Common words in the Gathering Storm

December 25, 2012
By
Common words in the Gathering Storm

The Wheel of Time is a series of books started by Robert Jordan. Unfortunately he died too early. Like all fans of the series I feel very lucky that Brandon Sanderson was able to continue these books. The first book Sanderson wrote was the Gathering St...

Read more »

Who Survived on the Titanic? Predictive Classification with Parametric and Non-parametric Models

December 24, 2012
By
Who Survived on the Titanic? Predictive Classification with Parametric and Non-parametric Models

I recently read a really interesting blog post about trying to predict who survived on the Titanic with standard GLM models and two forms of non-parametric classification tree (CART) methodology. The post was featured on R-bloggers, and I think it's worth a closer look. The basic idea was to figure out which of these three

Read more »

Who Survived on the Titanic? Predictive Classification with Parametric and Non-parametric Models

December 24, 2012
By
Who Survived on the Titanic? Predictive Classification with Parametric and Non-parametric Models

I recently read a really interesting blog post about trying to predict who survived on the Titanic with standard GLM models and two forms of non-parametric classification tree (CART) methodology. The post was featured on R-bloggers, and I think it's worth a closer look. The basic idea was to figure out which of these three

Read more »

More about Aggregation by Group in R

December 24, 2012
By
More about Aggregation by Group in R

Motivated by my young friend, HongMing Song, I managed to find more handy ways to calculate aggregated statistics by group in R. They require loading additional packages, plyr, doBy, Hmisc, and gdata, and are extremely user-friendly. In terms of CPU time, while the method with summarize() is as efficient as the 2nd method with by()

Read more »

Make a Christmas Tree in R with random ornaments/presents

December 24, 2012
By
Make a Christmas Tree in R with random ornaments/presents

Happy holidays!     Link to Gist

Read more »

24 Christmas Gifts from is.R

December 24, 2012
By
24 Christmas Gifts from is.R

The is.R blog has been on a roll in December with their Advent CalendaR feature: daily tips about R to unwrap each day leading up to Christmas. If you haven't been following it, start with today's post and scroll down. Sadly there isn't a tag to collect all these great posts together, but here are a few highlights: December...

Read more »

Miles of iles

December 24, 2012
By
Miles of iles

An explanation of quartiles, quintiles deciles, and boxplots. Previously “Again with variability of long-short decile tests” and its predecessor discusses using deciles but doesn’t say what they are. The *iles These are concepts that have to do with approximately equally sized groups created from sorted data. There are 4 groups with quartiles, 5 with quintiles … Continue reading...

Read more »

Latent Class Analysis with poLCA

December 24, 2012
By
Latent Class Analysis with poLCA

On an airplane the other day, I learned of a method called latent class (transition) analysis, and it sounded like an interesting thing to try in R. Of course, as with everything R, There is a Package for That, called poLCA, written by none other than Drew Linzer (of Votamatic fame) and Jeffrey Lewis. I...

Read more »

Labeling the Vertical Axis in R Plots

December 24, 2012
By
Labeling the Vertical Axis in R Plots

I show how to position the vertical axis label of an R plot above the axis and orient it horizontally as suggested by Stephen Few. I encourage you to share this with others and contribute to the conversation at Labeling the Vertical Axis in R Plots, which first appeared at carlislerainey.com. For more of my thoughts and...

Read more »

Identical Champions League Draw: What Were the Odds?

December 24, 2012
By
Identical Champions League Draw: What Were the Odds?

A number of news outlets have reported a peculiar quirk that arose during Friday’s Champions League draw. Apparently, the sport’s European governing body, UEFA, ran a trial run the day before the main event, and the schedule chosen during this event was identical to that of the actual draw on Friday. Given this strange coincidence,

Read more »

Aggregation by Group in R

December 23, 2012
By
Aggregation by Group in R

Efficiency Comparison among 4 Methods above

Read more »

My R year

December 23, 2012
By
My R year

End-of-year posts are corny but, what the heck, I think I can let myself delve in to corniness once a year. The following code gives a snapshot of what and how was R for me in 2012. outside.packages.2012 <- list(used.the.most = c('asreml', 'ggplot2'), largest.use.decline = c('MASS', 'lattice'), same.use = c('MCMCglmm', 'lme4'), would.like.use.more = 'JAGS')  

Read more »

Data Import Efficiency – A Case in R

December 23, 2012
By
Data Import Efficiency – A Case in R

Below is a piece of R snippet comparing the data import efficiencies among CSV, SQLITE, and HDF5. Similar to the case in Python posted yesterday, HDF5 shows the highest efficiency.

Read more »

Binary Classification – A Comparison of “Titanic” Proportions Between Logistic Regression, Random Forests, and Conditional Trees

December 23, 2012
By
Binary Classification – A Comparison of “Titanic” Proportions Between Logistic Regression, Random Forests, and Conditional Trees

Now that I’m on my winter break, I’ve been taking a little bit of time to read up on some modelling techniques that I’ve never used before. Two such techniques are Random Forests and Conditional Trees.  Since both can be used … Continue reading →

Read more »

Measuring the Gerrymander with spatstat

December 23, 2012
By
Measuring the Gerrymander with spatstat

Well, to be specific, I mean measuring district compactness (a very interesting subject, see these three articles for starters). There are myriad ways of measuring the “oddness” of a shape, including a comparison of the area of the district to its circumcircle, the moment of inertia of the shape, the probability that a path connecting...

Read more »

Sponsors