Example 7.22: the Knapsack problem

January 13, 2010
By
Example 7.22: the Knapsack problem

The website http://rosettacode.org/wiki/Knapsack_Problem describes a fanciful trip by a traveler to Shangri La. They can take as many as they want of three valuable items, as long as they fit in a knapsack. The knapsack will hold no more than 25 weight units, and no more than 25 volume units. The problem is to maximize the...

Read more »

Making Maps with R

January 13, 2010
By
Making Maps with R

***This tutorial has been updated, please click here*** I frequently use R (a free software environment for statistical computing and graphics) for data analysis.  As almost all my data are spatial it is often good to produce a map of the results without having to export the data into another GIS package. I am often

Read more »

Rcpp 0.7.2

January 13, 2010
By

pre{ border: 1px solid black ; } Rcpp 0.7.2 is out, checkout Dirk's blog for details selected highlights from this new version: character vectors if one wants to mimic this R code in C > x

Read more »

Rcpp 0.7.2

January 12, 2010
By

Not even two weeks after the Rcpp 0.7.1 release, Romain and I have a new one to present: Rcpp 0.7.2. It has been uploaded to CRAN and Debian, and the respective package management systems should carry them around in the next few hours. As always, th...

Read more »

Rcpp 0.7.2

January 12, 2010
By

Not even two weeks after the Rcpp 0.7.1 release, Romain and I have a new one to present: Rcpp 0.7.2. It has been uploaded to CRAN and Debian, and the respective package management systems should carry them around in the next few hours. As always, the l...

Read more »

Rcpp 0.7.2

January 12, 2010
By

Not even two weeks after the Rcpp 0.7.1 release, Romain and I have a new one to present: Rcpp 0.7.2. It has been uploaded to CRAN and Debian, and the respective package management systems should carry them around in the next few hours. As always, th...

Read more »

Academics’ Slang: Orthogonal

January 12, 2010
By

H. G. Wells famously said that, “statistical thinking will one day be as necessary for efficient citizenship as the ability to read and write.” I think we’re getting closer to that day: even the Supreme Court of the United States plan...

Read more »

In case you missed it: December roundup

January 12, 2010
By

In case you missed them, here are some articles from last month of particular interest to R users. This post looked at a climate change controversy involving the weather in Darwin, Australia and a review of the source data using R. This post showed how to access global weather data from the US National Centers for Environment Prediction using...

Read more »

A new twist on the identifier mapping problem

January 11, 2010
By
A new twist on the identifier mapping problem

Yesterday, Deepak wrote about BridgeDB, a software package to deal with the “identifier mapping problem”. Put simply, biologists can name a biological entity in any way that they like, leading to multiple names for the same object. Easily solved, you might think, by choosing one identifier and sticking to it, but that’s apparently way too

Read more »

Typos in Chapter 5

January 11, 2010
By
Typos in Chapter 5

After writing the solutions to the odd-numbered exercises in Chapter 5 of “Introducing Monte Carlo Methods with R”., I alas found the following typos, two of which are rather major (Exercise 5.3 and Example 5.16). I apologise to the readers these typos may confuse. – Exercise 5.3 has no simple encompassing set and the constraint should

Read more »

R exams

January 11, 2010
By
R exams

As posted yesterday, today was the day of my Exploratory Statistics exam, turned into 3 R exams because of the lack of terminals for the students to work on. (We tried to encourage students to use their own laptop but less than twenty registered…) If you happen to be interested in those exams, they are

Read more »

Bay Area User Group: R-Powered Web Apps

January 11, 2010
By

For those in the San Francisco area, tomorrow night's Bay Area R User Group meeting -- to be held at Twitter's HQ -- is a must-see. The theme is "R-Powered Web Apps" and features guest speakers Jeroen Ooms and Jeff Horner. (Disclosure: REvolution Computing is sponsoring Jeroen's appearance at this event.) We've featured Jeroen's awesome web-based applications using R...

Read more »

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 »

RClimate Script Introduction

January 10, 2010
By
RClimate Script Introduction

Would you like to be able to generate a GISS temperature anomaly trend chart on your PC with just 1 line of R script? What about downloading the R script to your PC so that you can edit the script to fit your needs? In this post I present my first RClimate Script so that users

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 »

External pointers with Rcpp

January 8, 2010
By

pre{ border: 1px solid black ; font-size: x-small; } One of the new features of Rcpp is the XPtr class template, which lets you treat an R external pointer as a regular pointer. For more information on external pointers, see Writing R extensions...

Read more »

Example 7.21: Write a function to simulate categorical data

January 8, 2010
By
Example 7.21: Write a function to simulate categorical data

In example 7.20, we showed how to simulate categorical data. But we might anticipate needing to do that frequently. If a SAS function weren't built in and an equivalent R function not available in a package, we could build them from scratch.SASThe SAS code is particularly tortured, since we must parse the parameter string to extract the...

Read more »

Learning R via Python…or the other way around (with video!)

January 8, 2010
By

Last night I was one of five speakers at the NYC R Statistical Programming Meetup. The topic last night was dubbed the R Rosetta Stone, and the intent was to show how R as a language translated into several other analytical platforms and programming languages. Other speakers covered MATLAB, SAS, SQL/Postges and Clojure/Incanter—I

Read more »

R Tutorial Series: ANOVA Tables

January 8, 2010
By
R Tutorial Series: ANOVA Tables

The commonly applied analysis of variance procedure, or ANOVA, is a breeze to conduct in R. This tutorial will explore how R can be used to perform ANOVA to analyze a single regression model and to compare multiple models.Tutorial FilesBefore we begin,...

Read more »

Codecogs – Open-Source library of numerical components

January 8, 2010
By

The Codecogs website provides an Open-source library of functions for numerical analysis. One interesting component available on the website is the LaTeX equation editor which can be used to create graphics files of equations to include on webpages. The webpage describe this component as a A web-based LaTeX equation editor that generates graphical images and HTML

Read more »

Review of ‘Computational Statistics: An Introduction to R’ in JSS

January 7, 2010
By

Somehow missed during the the end-of-year switchover was the fact that my review of Guenther Sawitzki's Computational Statistics: An Introduction to R (CRC / Chapman \& Hall, 2009) is now up on the Journal of Statistical Software website.

Read more »