Welsh test by permutations

November 1, 2009
By
Welsh test by permutations

WelshPerm <- function(response,variable,nperm=999,...){ base <- oneway.test(response~variable,...) base.p <- base$p.value base.W <- base$statistic count <- 1 # Permutation loop for(i in 1:nperm){ SAMPLE <- sample(response) we...

Read more »

R Tutorial Series: Summary and Descriptive Statistics

November 1, 2009
By
R Tutorial Series: Summary and Descriptive Statistics

Summary (or descriptive) statistics are the first figures used to represent nearly every dataset. They also form the foundation for much more complicated computations and analyses. Thus, in spite of being composed of simple methods, they are essential ...

Read more »

Adventures with Comcast: Part ohnoesnotanotherone in an ongoing series

October 31, 2009
By

Regular readers of this blog (yes, both of you!) may remember the computer/broadband/ directory that this post appears in as the collection of my Comcastic (yeah right) experiences with my ISP. But I think this week may top everything. I'll just...

Read more »

Adventures with Comcast: Part ohnoesnotanotherone in an ongoing series

October 31, 2009
By

Regular readers of this blog (yes, both of you!) may remember the computer/broadband/ directory that this post appears in as the collection of my Comcastic (yeah right) experiences with my ISP. But I think this week may top everything. I'll just try t...

Read more »

Adventures with Comcast: Part ohnoesnotanotherone in an ongoing series

October 31, 2009
By

Regular readers of this blog (yes, both of you!) may remember the computer/broadband/ directory that this post appears in as the collection of my Comcastic (yeah right) experiences with my ISP. But I think this week may top everything. I'll just...

Read more »

Sorting a matrix/data.frame on a column

October 30, 2009
By
Sorting a matrix/data.frame on a column

mat.sort <- function(mat,n) { mat),] <- mat return(mat) } a <- matrix(rnorm(100),ncol=10) mat.sort(a,1)

Read more »

useR! 2006

October 30, 2009
By

Last week, I attended the 2006 UseR! conference: here is a (long) summary of some of the talks that took place in Vienna -- since there were up to six simultaneous talks, I could not attend all of them... In this note: 0. General remarks 1. Tutorial:...

Read more »

R graphics

October 30, 2009
By
R graphics

I just finished reading Paul Murrel's book, "R graphics". There are two graphical systems in R: the old ("classical" -- in the "graphics" package) one, and the new ("trellis", "lattice", "grid" -- in the "lattice" and "grid" packages) one. The first...

Read more »

The grammar of graphics (L. Wilkinson)

October 30, 2009
By
The grammar of graphics (L. Wilkinson)

Though this book is supposed to be a description of the graphics infrastructure a statistical system could provide, you can and should also see it as a (huge, colourful) book of statistical plot examples. The author suggests to describe a statistical...

Read more »

Statistics with R

October 30, 2009
By

I have just uploaded the new version of my "Statistics with R": http://zoonek2.free.fr/UNIX/48_R/all.htmlThe previous version was one year and a half old, so in spite of the fact I have not had much time to devote to it in the past two years, it might...

Read more »

Use R 2009 Conference

October 30, 2009
By
Use R 2009 Conference

I did not attend the conference this year, but just read through the presentations. There is some overlap with other R-related conferences, such as R in Finance or the Rmetrics workshop. http://www.agrocampus-ouest.fr/math/useR-2009/ http://www.rinfin...

Read more »

Decimal log scale on a plot

October 30, 2009
By
Decimal log scale on a plot

R only does natural (neperian) log scales by default, and this is lame. Here is a simple code to do decimal log scale, pretty much a requirement for scientists… The force(x/y)lim options works for natural and log scales (for the later case, you need to specify the power of 10 that you want : c(-2,2)

Read more »

Long R, Short Excel

October 29, 2009
By
Long R, Short Excel

R is very speedy statistical package that's like an F-18A Hornet, versus Excel which is like a paper airplane. R is professional sports, Excel is Pop Warner. R is Mona Lisa, Excel is stick figures. R is ... okay, you get the idea. I'm long R, and short...

Read more »

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 »