Monthly Archives: February 2013

For descriptive statistics, values below LLOQ set to …

February 3, 2013
By
For descriptive statistics, values below LLOQ set to …

That is what I read the other day. For calculation of descriptive statistics, values below the LLOQ (lower limit of quantification)  were set to.... Then I wondered, wasn't there a trick in JAGS to incorporate the presence of missing data while es...

Read more »

A package for agricultural statistic: FAOSTAT

February 3, 2013
By

After 8 years of using R, today I finally become a contributor to the community and released my first package, FAOSTAT.The package is designed to provide user with direct access to the FAOSTAT data base via R and to support the...

Read more »

Scatterplot with marginal boxplots

February 3, 2013
By
Scatterplot with marginal boxplots

Using R and ggplot2 to draw a scatterplot with the two marginal boxplotsDrawing a scatterplot with the marginal boxplots (or marginal histograms or marginal density plots) has always been a bit tricky (well for me anyway). The approach I take here is, first, to draw the three separate plots using ggplot2:the scatterplot;the horizontal boxplot to appear in the...

Read more »

Maize trade Part II: Comparison and analysis

February 3, 2013
By
Maize trade Part II: Comparison and analysis

Following my last post about the maize network, although interesting but is not very informative. What we are going to do today is to contrast the maize network with the wine trade network.The choice why we have chose wine will become clear after the...

Read more »

Visualising 2012 NFL Quarterback performance with R heat maps

February 3, 2013
By
Visualising 2012 NFL Quarterback performance with R heat maps

With only 24 hours remaining in the 2012 NFL season, this is a good time to review how the league's QBs performed during the regular season using performance data from KFFL and the heat mapping capabilities of R. #scale data to mean=0, sd=1 and convert to matrix QBscaled <- as.matrix(scale(QB2012)) #create heatmap and don't reorder

Read more »

InstallOldPackages: a repmis command for installing old R package versions

February 3, 2013
By

A big problem in reproducible research is that software changes. The code you used to do a piece of research may depend on a specific version of software that has since been changed. This is an annoying problem in R because install.packages only installs the most recent version of a package. It can be tedious to collect the old...

Read more »

Comparing individual team run production

February 3, 2013
By

Or, The 2010 Mariners: How Bad Were They?In earlier posts, I used the statistical software R to plot the trends in league average run scoring since 1901. This was the first step to answering other questions I had on my mind:How poor was the offensive performance of the 2010 Seattle Mariners?Are they showing any signs...

Read more »

data.table or data.frame?

February 2, 2013
By

I spent a portion of today trying to convince a colleague that there are times when the data.table package is faster than traditional methods in R. It took a few of the tests below to prove the point. Generate a data.frame of characters and numbers for easy plotting. df <- data.frame(letters = as.character(sample(letters, 1e+08, replace = TRUE)), ...

Read more »

A random walk ? What else ?

February 2, 2013
By
A random walk ? What else ?

Consider the following time series, What does it look like ? I know, this is a stupid game, but I keep using it in my time series courses. It does look like a random walk, doesn’t it ? If we use Philipps-Perron test, yes, it does, > PP.test(x) Phillips-Perron Unit Root Test data: x Dickey-Fuller = -2.2421, Truncation lag parameter = 6,...

Read more »

R scripts for analyzing survey data

February 2, 2013
By

Another site pops up with open code for analyzing public survey data: http://www.asdfree.com/ It will be interesting to see whether this gets used by the general public--given the growing trend of data journalism and so forth--versus academics. It is...

Read more »