Income inequality and partisan voting in the United States

October 29, 2009
By

Lane Kenworthy, Yu-Sung Su, and I write: Income inequality in the United States has risen during the past several decades. Has this produced an increase in partisan voting differences between rich and poor? We examine trends from the 1940s thr...

Read more »

Simple R figures

October 29, 2009
By
Simple R figures

http://www.harding.edu/fmccown/R/This comes very handy.

Read more »

Kicking Ass with plyr

October 29, 2009
By
Kicking Ass with plyr

Tonight (October 29, 2009) at 5:30 PM is the Chicago R meetup at Jaks tap. Here’s more info.  I’ll be making a presentation based on my earlier blog post about plyr. The presentation will only be 8 minutes long so I’ve had to pick and choose my info carefully. OK, who am I kidding? I

Read more »

Go long on close and sell on open

October 29, 2009
By
Go long on close and sell on open

I found a description of supposed to be profitable strategy on Bloomberg. The strategy is simple – buy S&P500 index on close and sell it on next day open. So, I tested this claim and got nice P/L curve: Yes, since 1993 this strategy has generated the profit >300%. But, neither commissions or slippage are included:) Let’s

Read more »

Bioconductor 2.5 is out

October 29, 2009
By
Bioconductor 2.5 is out

For all bioinformaticians and R users out there: the Bioconductor project  for the analysis and comprehension of genomic data is out! A lot of interesting new stuff! See the full announcement here.

Read more »

Tips for Using StatET and Eclipse for Data Analysis in R

October 29, 2009
By
Tips for Using StatET and Eclipse for Data Analysis in R

My favourite editor for conducting analysis in R is the StatET plug-in for Eclipse. This post discusses an assortment of tips and tricks that I've discovered to make this editing environment even better.SearchSearch (Control + H): I maintain projects i...

Read more »

Using the “foreign” package for data conversion

October 27, 2009
By
Using the “foreign” package for data conversion

I was in a rush to convert a SPSS data into Stata format. Somehow my Stattransfer v.8 for Linux was lost and I did not want pause my work and go back to Windows just to get this one file converted. So fire Emacs+ESS+R, load the "foreign" package, did t...

Read more »

Literate programming, etc.

October 27, 2009
By
Literate programming, etc.

http://biostat.mc.vanderbilt.edu/wiki/Main/StatReport

Read more »

MultBar : Advanced multiple barplot with SEM

October 26, 2009
By
MultBar : Advanced multiple barplot with SEM

Producing this kind of graphs (below) in R can be a pain in the a*s. Here is a simple code that requires that data are presented in lists (see the example below). multbar <- function(list.of.lists,...,condnames=0,pal=colorRampPalette(c('grey','cornsilk')),seriesnames=0,legendpos='topleft',legh=TRUE,do.pty='s') { par(pty=do.pty,mgp=c(1.9,0.8,0),oma=c(0,0,0,0),mar=c(4,3,2,1),bg='transparent',bty='o',tck=0.02,yaxs='i') NofList <- length(list.of.lists) NofSubList <- length(list.of.lists]) if(condnames==0){condnames=c(1:NofList)} if(seriesnames==0){seriesnames=c(1:NofSubList)} dim.mat.treat <- (NofList+1)*NofSubList pos <- c(1:dim.mat.treat) pos <- matrix(pos,nrow=(NofList+1)) nbreaks

Read more »

R 2.10.0 is Out!

October 26, 2009
By
R 2.10.0 is Out!

The new R 2.10.0 is out! Get it from here. If you like take a look at these posts for some miscellaneous advices to make the upgrade easier. Fell free to contribute with suggestions about how to upgrade your R installation.

Read more »

Free statistics e-books for download

October 25, 2009
By

This post will eventually grow to hold a wide list of books on statistics (e-books, pdf books and so on) that are available for free download.  But for now we’ll start off with just one several books: The Elements of Statistical Learning written by Trevor Hastie, Robert Tibshirani and Jerome Friedman. you can legally download

Read more »

Example 7.16: assess robustness of permutation test to violations of exchangeability assumption

October 24, 2009
By
Example 7.16: assess robustness of permutation test to violations of exchangeability assumption

Permutation tests (section 2.4.3) are a form of resampling based inference that can be used to compare two groups. A simple univariate two-group permutation test requires that the group labels for the observations are exchangeable under the null hypothesis of equal distributions, but allows relaxation of specific distributional assumptions required by parametric procedures such as the t-test (

Read more »

A primer to Sweave with LyX

October 24, 2009
By

This is a step-by-step guide to 'Sweave' a document in R with Lyx on Ubuntu (9.04).System: Ubuntu 9.04, LyX 1.6.2, R 2.11.0 (Development version, r50178)Install LyX with Synaptic if it is not installed yet. (Current version 1.6.2)Start LyX, go to menu ...

Read more »

Data Mining and R

October 24, 2009
By
Data Mining and R

This post lists a few data mining resources in R. I also provide a few observations on the distinction between data mining, data analysis, and statistics as it pertains to the analysis work that I do in psychology.Online ResourcesThe classic book The E...

Read more »

RSPerl : Using R from within Perl

October 23, 2009
By

Some things I write in perl some in R, sometime I use perl to write R and run R. One thing that I find very useful is the functionality of RSPerl which enables you to call R functions from within perl and on perl variables. It can also call perl from R, though I have no idea why...

Read more »

RSPerl : Using R from within Perl

October 23, 2009
By

Some things I write in perl some in R, sometime I use perl to write R and run R. One thing that I find very useful is the functionality of RSPerl which enables you to call R functions from within perl and on perl variables. It can also call perl from R, though I have no idea why...

Read more »

Scivews-K got updated

October 23, 2009
By
Scivews-K got updated

http://www.sciviews.org/SciViews-K/index.htmlThe problem is, I cannot get it to work, on either Windows or Linux.

Read more »

From ORD Sessions to R-Forge in 12 hours with RProtoBuf

October 22, 2009
By

Yesterday, via in invitation from fellow Chicago-area Google Summer of Code mentor Borja Sotomayor, I attended the Second ORD Sessions. These are happening at the HQ of Inventable where a couple of technologists and Open Source geeks from the Chicagoland area get together and riff on code for a few hours after work over some pizza and beer. Sounded good, and I...

Read more »

From ORD Sessions to R-Forge in 12 hours with RProtoBuf

October 22, 2009
By

Yesterday, via in invitation from fellow Chicago-area Google Summer of Code mentor Borja Sotomayor, I attended the Second ORD Sessions. These are happening at the HQ of Inventable where a couple of technologists and Open Source geeks from the Chicagola...

Read more »

From ORD Sessions to R-Forge in 12 hours with RProtoBuf

October 22, 2009
By

Yesterday, via in invitation from fellow Chicago-area Google Summer of Code mentor Borja Sotomayor, I attended the Second ORD Sessions. These are happening at the HQ of Inventable where a couple of technologists and Open Source geeks from the Chicagoland area get together and riff on code for a few hours after work over some pizza and beer. Sounded good, and I...

Read more »

ISO week

October 22, 2009
By

I am working with a model that produces estimates of snow water equivalent through time. Because I deal with large spatial extents, I decided to have the model produce weekly averages. The problem with this is knowing which file to access for a given d...

Read more »

ISO week

October 22, 2009
By

I am working with a model that produces estimates of snow water equivalent through time. Because I deal with large spatial extents, I decided to have the model produce weekly averages. The problem with this is knowing which file to access for a given d...

Read more »

Leap years

October 22, 2009
By

A quick function that when provided a numeric vector of years returns a boolean vector where TRUE == Leap year.is.leapyear=function(year){ #http://en.wikipedia.org/wiki/Leap_year return(((year %% 4 == 0) & (year %% 100 != 0)) | (year %% 400 == 0))}

Read more »

Leap years

October 22, 2009
By

A quick function that when provided a numeric vector of years returns a boolean vector where TRUE == Leap year.is.leapyear=function(year){ #http://en.wikipedia.org/wiki/Leap_year return(((year %% 4 == 0) & (year %% 100 != 0)) | (year %% 400 == 0))}

Read more »

Aggreate electoral targeting with R

October 22, 2009
By
Aggreate electoral targeting with R

Aggregate electoral targeting is the process of determining the likely hood of a citizen choosing to vote turnout), and which candidate that person is most likely to vote for (partisan bias) in a given race using historical turnout and partisan bias. The output from this targeting allows a campaign to project the likely number of voters, what percentages their...

Read more »

ggplot2: Two Color XY-Area Combo Chart

October 21, 2009
By
ggplot2: Two Color XY-Area Combo Chart

David@Work blog shows how to fill in the area between two crossing lines in an Excel chart. This post was also published as a guest-post on PTS blog. Let’s try to replicate this graph in ggplot2. First, load ggplot2 and generate the data frame to be used in the example (I am using a slightly

Read more »

InferenceR looks interesting

October 21, 2009
By
InferenceR looks interesting

I obtained a free academic copy of the InferenceR, which is a R IDE for Windows. I has several interesting features such as a visual debugger. It is definitely worth some further exploration. Of course, the problem (and the only problem for now) is tha...

Read more »

[, [[, $: R accessors explained

October 21, 2009
By
[, [[, $: R accessors explained

For more than ten years, I have been teaching R both formally and informally. One thing that I find often trips up students is the use of R’s accessors and mutators. ( For those readers not from a formal computer science background, an accessor is a method for accessing data in an object

Read more »

Lots of maps using R

October 21, 2009
By
Lots of maps using R

http://r-spatial.sourceforge.net/gallery/#fig01.RVery helpful!

Read more »