Monthly Archives: January 2010

ggplot2 Tutorial: Scatterplots in a Series of Small Multiples

January 11, 2010
By

It took several months after learning about ggplot2 before I gave it a try myself.  I was apprehensive about learning a new graphics system with a new set of commands.  Thing is, if you've ever used plot() in R, you already know how to use much of the functionality in ggplot2!  In this tutorial I want to show you...

Read more »

Lattice: Multivariate Data Visualization with R

January 11, 2010
By
Lattice: Multivariate Data Visualization with R

I have just reviewed Sarkar‘s Lattice: Multivariate Data Visualization with R for the Journal of the Royal Statistical Society Series A.  I would highly recommend the book to all R users who wish to produce publication quality g...

Read more »

Progress bars in R (part II) – a wrapper for apply functions

January 10, 2010
By
Progress bars in R (part II) – a wrapper for apply functions

In a previous post I gave some examples of how to make a progress bar in R. In the examples the bars were created within loops. Very often though I have situations where I would like have a progress bar when using apply(). The plyr package provides several apply-like functions also including progress bars, so

Read more »

LSPM with snow

January 10, 2010
By
LSPM with snow

My last post provided examples of how to use the LSPM package. Those who experimented with the code have probably found that constrained optimizations with horizons > 6 have long run-times (when calc.max >= horizon).This post will illustrate how the s...

Read more »

Outlawing Gay Marriage

January 10, 2010
By

Given the recent votes on same-sex marriage in New Jersey and Portugal, I wanted to test a seemingly innocuous claim that touches upon very broad issues in political theory: does the degree of directness of a “democratic” vote predict whether the vote will promote or prohibit same-sex marriage? Naively, it seemed clear to me that

Read more »

Pivot tables in R

January 9, 2010
By
Pivot tables in R

A common data-munging operation is to compute cross tabulations of measurements by categories. SQL Server and Excel have a nice feature called pivot tables for this purpose. Here we'll figure out how to do pivot operations in R.Let's imagine an experim...

Read more »

Typos in Chapter 4

January 9, 2010
By
Typos in Chapter 4

Chapter 4 of “Introducing Monte Carlo Methods with R” has four typos (so far) in the exercises: – In Exercise 4.5, the should not be in bold fonts (!) – In Exercise 4.9, I commented too many lines when revising and thus the variance terms vanished. It should read – In Exercise 4.13, following the removal of

Read more »

sequential ideal point estimates

January 9, 2010
By
sequential ideal point estimates

Out of curiosity, I produced a “sequential” set of ideal point estimate for the (current) 111th U.S. Senate, plotting the results in the graph attached below (click on the thumbnail); as is conventional, red is Republican and blue is Democratic. The analysis uses all 373 non-unanimous roll calls in the 111th Senate thus far. Each

Read more »

Killing Yourself: An Addendum

January 9, 2010
By

In further support of the claim that a lot of deaths are partly self-induced, here’s a fascinating piece by Wired on the extraordinary rise in the percent of deaths among the young caused by their own poor decisions. It’s remarkable that, for the young, modern science has already made the world so safe that humanity,

Read more »

Because it’s Friday: Gravity Wells

January 8, 2010
By
Because it’s Friday: Gravity Wells

It's a little strange to see a web comic come up with such interesting visualizations, but xkcd has followed up on their movie timelines charts with this illustration of the gravitational attraction of the various bodies in the solar system. The gravitational force at the surface of the planet or moon determines how high you'd need to jump in...

Read more »