My implementation of Berry and Berry’s hierarchical Bayes algorithm for adverse events

November 20, 2009
By

I've been working on this for quite some time (see here for a little background), so I'm pleased that it looks close to done at least as far as the core algorithm. It uses global variables for now, and I'm sure there are a couple of other bugs lurking, but here it is, after the jump.const.sqrt2pi <-...

Read more »

Mapping Biomes

November 20, 2009
By
Mapping Biomes

Recently (2008) the European Space Agency produced GlobCover (ESA GlobCover Project, led by MEDIAS-France), the highest resolution (300m) global land cover map to date. GlobCover uses 21 primary land cover classes and many more sub-classes. Land cover classification (LCC) schemes divide the earth into biomes. Biomes are the simplest way to classify vegetation which can

Read more »

Working on a drug safety project

November 20, 2009
By

In order to move some of my personal interests along, I have been trying to implement the methodology found in Berry and Berry's article Accounting for Multiplicities in Assessing Drug Safety. This methodology uses the MedDRA hierarchy to improve the p...

Read more »

Tactical asset allocation using blotter

November 18, 2009
By
Tactical asset allocation using blotter

blotter is an R package that tracks the P&L of your trading systems (or simulations), even if your portfolio spans many security types and/or currencies. This post uses blotter to track a simple two-ETF trading system. The contents of this post b...

Read more »

Design of Experiments – Power Calculations

November 18, 2009
By

Prior to conducting an experiment researchers will often undertake power calculations to determine the sample size required in their work to detect a meaningful scientific effect with sufficient power. In R there are functions to calculate either a minimum sample size for a specific power for a test or the power of a test for

Read more »

Confidence we seek…

November 18, 2009
By
Confidence we seek…

Estimating a proportion at first looks elementary. Hail to aymptotics, right? Well, initially it might seem efficient to iuse the fact that . In other words the classical confidence interval relies on the inversion of Wald’s test. A function to ease the computation is the following (not really needed!). waldci<- function(x,n,level){ phat<-sum(x)/n results<-phat + c(-1,1)*qnorm(1-level/2)*sqrt(phat*(1-phat)/n) print(results) } An exact confidence interval is

Read more »

Quantitative link strength for APE cophyloplot

November 17, 2009
By
Quantitative link strength for APE cophyloplot

Just add a third column with link strength to the association matrix plotCophylo2 <- function (x, y, assoc = assoc, use.edge.length = use.edge.length, space = space, length.line = length.line, gap = gap, type = type, return = return, col = col, show.tip.label = show.tip.label, font = font) { if(ncol(assoc)==2) { assoc <- cbind(assoc,rep(1,nrow(assoc))) } res

Read more »

swfDevice is nearing completion

November 17, 2009
By

My new R package, swfDevice, is getting close to its first release. This package enables native R graphics output as swf (flash) files. It also as the ability to create animations with player controls. The main project page is here and the results of the test suite are here. Here are some samples: http://swfdevice.r-forge.r-project.org/swfDevice_test29.swf http://swfdevice.r-forge.r-project.org/swfDevice_test28.swf

Read more »

R tip: Extracting median from survfit object

November 17, 2009
By

A colleague wanted to extract the median value from a survival analysis object, which turned out to be a pain as the value is not stored in the object, but calculated on the fly by a print method.> library(survival)> fit > survfit(fit)Call: survfit(formula = fit)records n.max n.start events median 0.95LCL 0.95UCL ...

Read more »

R tip: Extracting median from survfit object

November 17, 2009
By

A colleague wanted to extract the median value from a survival analysis object, which turned out to be a pain as the value is not stored in the object, but calculated on the fly by a print method. > library(survival)> fit > survfit(fit)Call: survfit(formula = fit)records n.max n.start events median 0.95LCL 0.95UCL ...

Read more »

R functions for Dienes (2008) Understanding Psychology as a Science

November 17, 2009
By

I recently wrote a review of Understanding psychology as a science: an introduction to scientific and statistical inference by Zoltan Dienes (2008). Dienes' book covers Neyman-Pearson null hypothesis significance testing, Bayesian inference and the lik...

Read more »

Seminar: Reproducible Research with R, LaTeX, & Sweave

November 16, 2009
By

Theresa Scott, instructor of the previously mentioned R workshop and weekly R clinic, is giving a lecture entitled "Reproducible Research with R, LaTeX, & Sweave" in MRB III, room 1220, this Wednesday 11/18 at 1:30.  You can see more details about the lecture here. Looks like her slides as well as much more introductory material on R, Latex, and Sweave...

Read more »

Infomaps using R – Visualizing German unemployment rates by district on a map

November 16, 2009
By
Infomaps using R – Visualizing German unemployment rates by district on a map

Lately, David Smith from REvolution Computing set out to challenge the R community with the reprocuction of a beautiful choropleth map (= multiple regions map/thematic map) on US unemployment rates he had seen on the Flowing Data blog. Here you can find the impressing results. Being a fan of beautiful visualizations I tried to produce

Read more »

R in Action – early thoughts

November 16, 2009
By
R in Action – early thoughts

I was invited to review the book R in Action written by Rob Kabacoff. Since I consider the Quick-R website, created by the same smart guy, one of the most valuable resources about R, It is both an honor and a pleasure to have the opportunity to take an...

Read more »

R in Action – early thoughts

November 16, 2009
By
R in Action – early thoughts

I was invited to review the book R in Action written by Rob Kabacoff. Since I consider the Quick-R website, created by the same smart guy, one of the most valuable resources about R, It is both an honor and a pleasure to have the opportunity to take an...

Read more »

The Top Scores for Canabalt, Take 2

November 15, 2009
By
The Top Scores for Canabalt, Take 2

Introduction As promised on Thursday, here’s my second pass at a statistical analysis of Canabalt scores. There are some useful results I’ll present right at the start, and then there are some results that are more or less worthless, except that working through my own mistakes helped me to think more clearly about statistical modeling in

Read more »

OpenMX

November 15, 2009
By
OpenMX

Looks promising: http://openmx.psyc.virginia.edu/Right now it cannot be build from source because there are some comparabilities between OpenMx and R 2.10.0, but I assume this will be resolved soon.And the development seems to be quite active.

Read more »

R Tutorial Series: Scatterplots

November 12, 2009
By
R Tutorial Series: Scatterplots

A scatterplot is a useful way to visualize the relationship between two variables. Similar to correlations, scatterplots are often used to make initial diagnoses before any statistical analyses are conducted. This tutorial will explore the ways in whic...

Read more »

Canabalt

November 12, 2009
By
Canabalt

At the office today, I got into a discussion with two of my fellow graduate students about the distribution of scores you can get while playing Canabalt. Because (1) the layout of the levels in the game is fully randomized and (2) the difficulty of certain actions (specifically jumping through windows) is exceptionally high, we

Read more »

Graph Examples from Visualizing Data by William Cleveland

November 12, 2009
By
Graph Examples from Visualizing Data by William Cleveland

The trellis graphics approach was pioneered by various statistical researchers and the ideas are used extensively in the book “Visualizing Data” by William Cleveland. There are various resources on the website for trellis graphics including S code for creating the majority of the graphs that appear in the book. Inspired by efforts on the Learning

Read more »

Sweave-Lyx from terminal on Mac

November 12, 2009
By

Mark Heckmann writes:In your paper "Using Sweave with Lyx" (great work bty) you pointed out that one can see the sweave error code when processing when starting lyx from the terminal. I just changed from Windows to Mac so that's new for me. Could you s...

Read more »

Sweave-Lyx from terminal on Mac

November 12, 2009
By

Mark Heckmann writes:In your paper "Using Sweave with Lyx" (great work bty) you pointed out that one can see the sweave error code when processing when starting lyx from the terminal. I just changed from Windows to Mac so that's new for me. Could you s...

Read more »

Example 7.17: The Smith College diploma problem

November 12, 2009
By
Example 7.17: The Smith College diploma problem

Smith College is a residential women's liberal arts college in Northampton, MA that is steeped in tradition. One such tradition is to give each student at graduation a diploma at random (or more accurately, in a haphazard fashion). At the end of the ceremony, a diploma circle is formed, and students pass the diplomas that they receive to...

Read more »

Create Animations in PDF Documents Using R

November 11, 2009
By

ince animation 1.0-9, we will be able to create a PDF document with an animation embedded in it; the function is saveLatex(), and its usage is similar to saveMovie() and saveSWF(): you pass an R expression for creating animations to this function, and this expression will be evaluated in the function; the image frames get

Read more »

Introduction à Monte Carlo en R

November 11, 2009
By
Introduction à Monte Carlo en R

Following a proposal by Springer-Verlag Paris, I have decided to translate Introducing Monte Carlo Methods with R with George Casella into French, since a new collection of R books (in French) is planed for the Spring of 2010. The translation will a priori be done by Joachim Robert and Robin Ryder, under my supervision and

Read more »

Rcpp 0.6.8

November 10, 2009
By

As memtioned when I announced release 0.6.7 of Rcpp two days ago, a new version 0.6.8 was due because of my oversight of also adapting Makevars.win (used on that other OS) to the new file layout. So 0.6.8 went onto CRAN and into Debian earlier in th...

Read more »

Rcpp 0.6.8

November 10, 2009
By

As memtioned when I announced release 0.6.7 of Rcpp two days ago, a new version 0.6.8 was due because of my oversight of also adapting Makevars.win (used on that other OS) to the new file layout. So 0.6.8 went onto CRAN and into Debian earlier in the ...

Read more »

Rcpp 0.6.8

November 10, 2009
By

As memtioned when I announced release 0.6.7 of Rcpp two days ago, a new version 0.6.8 was due because of my oversight of also adapting Makevars.win (used on that other OS) to the new file layout. So 0.6.8 went onto CRAN and into Debian earlier in th...

Read more »

R / Finance 2010 Call for Papers

November 9, 2009
By

Jeff sent the following while I had connectivity issues and I hadn't gotten around to posting it here. So without further ado, and given the success of our initial R / Finance 2009 conference about R in Finance, here is the call for papers for next ...

Read more »