Mapping Public Opinion: A Tutorial

July 18, 2012
By
Mapping Public Opinion: A Tutorial

At the upcoming 2012 summer meeting of the Society of Political Methodology, I will be presenting a poster on Isarithmic Maps of Public Opinion. Since last posting on the topic, I have made major improvements to the code and robustness of the modeling approach, and written a tutorial that illustrates the production of such maps. This … Continue reading →

Read more »

Time zones

July 18, 2012
By
Time zones

Say we have some following raw data. It consists of a timestamp and a corresponding value. There is a peak at exactly midnight (00:00:00). Each timestamp is fully specified. It contains a date, a time of day, and a time zone offset indication. In this case +0000, meaning the data is 0 hours away the UTC timezone. "timestamp","value""25-04-2012...

Read more »

Course at Monash (#1)

July 18, 2012
By
Course at Monash (#1)

Here are the slides for the first day of my course at Monash University, Melbourne, in the Special Lectures in Econometrics, with a strong similarity with the slides of my course in Wharton, two years ago. (Be sure to check slide 67! If the update on slideshare works from my flat in Melbourne…) Filed under:

Read more »

Gamification Quantification

July 18, 2012
By

Surveys become engaging when they become games, or at least, take on some of the characteristics of games.  This is the argument made by those advocating the gamification of marketing research [http://researchaccess.com/2011/12/market-researc...

Read more »

bubble plot in R

July 18, 2012
By
bubble plot in R

Motived by the post from FlowingData(http://flowingdata.com/2010/11/23/how-to-make-bubble-charts/), I made this plot with R code below:par(mfrow=c(3,1), mar=c(4,6,4,4))for(ty in c("protein_coding","lincRNA","piRNA")){          ...

Read more »

A closer look at data suggests Johns Hopkins is still the #1 US hospital

July 18, 2012
By
A closer look at data suggests Johns Hopkins is still the #1 US hospital

The US News best hospital 2012-20132 rankings are out. The big news is that Johns Hopkins has lost its throne. For 21 consecutive years Hopkins was ranked #1, but this year Mass General Hospital (MGH) took the top spot displacing Hopkins to #2. Howeve...

Read more »

Preparing public data for analysis with R

July 18, 2012
By
Preparing public data for analysis with R

In most data science applications, preparing the data is at least half the job. Finding where the data lives, figuring out how to access it, finding the right records, filtering, cleaning and transforming the data ... all of this has to be done before the statistical analysis can even begin. Fortunately, the R language has many tools for data...

Read more »

How to track Twitter unfollowers in R

July 18, 2012
By
How to track Twitter unfollowers in R

I have Twitter account and it is relatively easy to see new followers or subscribers. However, I was looking for ways to know who are the unfollowers. I have noticed, that some (un)subscriptions happen in bulks, which made me thinking that either I tweeted some bullshit and upset bunch of people or spam bots work

Read more »

Johns Hopkins Coursera Statistics Courses

July 18, 2012
By

Computing for Data Analysis Data Analysis Mathematical Biostatistics Bootcamp

Read more »

Monitor with R: Moisture in Sunflower Seeds Intact

July 18, 2012
By
Monitor with R: Moisture in Sunflower Seeds Intact

I had the opportunity today to check the performance of a calibration (moisture in intact sunflower seed in reflectance).This is always a exciting moment:  Does the performance of the calibration for the new validation set is as expected duri...

Read more »

Project Euler — problem 15

July 18, 2012
By
Project Euler — problem 15

The 15th problem in Project Euler. Starting in the top left corner of a 22 grid, there are 6 routes (without backtracking) to the bottom right corner. How many routes are there through a 2020 grid? Mmm… walk in the … Continue reading →

Read more »

50 Shades of Grey Wordcloud

July 17, 2012
By
50 Shades of Grey Wordcloud

Sometimes you just want to see what all the fuss is about. File this under the 'because I can' category: I proudly (?) present - a wordcloud produced from the text of E. L. James' "50 Shades of Grey".For a book which is getting all this press about bei...

Read more »

Trends in run scoring, NL edition (more R)

July 17, 2012
By

Last time around I used R to plot the average runs per game for the American League, starting in 1901. Now I’ll do the same for the National League.  I'll save a comparison of the two leagues for my next post.A fundamental principal of programming is that code can be repurposed for different sets of datas. So...

Read more »

Create an R package in under 6 minutes

July 17, 2012
By
Create an R package in under 6 minutes

Storing your favorite R functions is best done by creating your own R package. This is a quick way to get started with two example functions.Enjoy!

Read more »

R for Ecologists: Creating a Site x Species Matrix

July 17, 2012
By
R for Ecologists: Creating a Site x Species Matrix

Today I’m going to adress a fairly common problem in ecology that has been coming up frequently as of late. The issue is how to create a site x species matrix for community composition analysis (i.e. ordination). Moreover, ecologists have to do … Continue reading →

Read more »

Plotting the Frequency of Twitter Hashtag Usage Over Time with R and ggplot2

July 17, 2012
By
Plotting the Frequency of Twitter Hashtag Usage Over Time with R and ggplot2

The 20th annual ISMB meeting was held over the last week in Long Beach, CA. It was an incredible meeting with lots of interesting and relevant talks, and lots of folks were tweeting the conference, usually with at least a few people in each concurrent ...

Read more »

The R packages in a data scientist’s toolbox

July 17, 2012
By

John Myles White, self-described "statistics hacker" and co-author of "Machine Learning for Hackers" was interviewed recently by The Setup. In the interview, he describes his some of his go-to R packages for data science: Most of my work involves programming, so programming languages and their libraries are the bulk of the software I use. I primarily program in R,...

Read more »

Hierarchical Cluster Analysis (ChemoSpec) – 01

July 17, 2012
By
Hierarchical Cluster Analysis (ChemoSpec) – 01

I have been in previous post using the ChemoSpec package for some oil data (olive and sunflower). My spectra has now a range from 1100nm to 2200nm and is raw (not treated mathematically) . I want to start using the ChemoSpec package to start using the ...

Read more »

“Computing for Data Analysis” with R on coursera

July 17, 2012
By
“Computing for Data Analysis” with R on coursera

Just stumbled on across a course on coursera titled “Computing for Data Analysis” taught by Roger D. Peng the Johns Hopkins Bloomberg School of Public Health. Here is the description of the course. In this course you will learn how to program in R and how to use R for effective data analysis. You will learn … Continue reading...

Read more »

Criticism 5 of NHST: p-Values Measure Effort, Not Truth

July 17, 2012
By
Criticism 5 of NHST: p-Values Measure Effort, Not Truth

Introduction In the third installment of my series of criticisms of NHST, I focused on the notion that a p-value is nothing more than a one-dimensional representation of a two-dimensional space in which (1) the measured size of an effect and (2) the precision of this measurement have been combined in such a way that

Read more »

Optical Art with R

July 16, 2012
By
Optical Art with R

Last week, in a post entitled Bridget Riley exhibition in London, the author Markus Gesmann wrote an R script reproducing one of Riley's famous art pieces: Movement in Squares.This reminded me of my own first "brush" with Op art. It was in art class ye...

Read more »

Factor Attribution to improve performance of the 1-Month Reversal Strategy

July 16, 2012
By
Factor Attribution to improve performance of the 1-Month Reversal Strategy

Today I want to show how to use Factor Attribution to boost performance of the 1-Month Reversal Strategy. The Short-Term Residual Reversal by D. Blitz, J. Huij, S. Lansdorp, M. Verbeek (2011) paper presents the idea and discusses the results as applied to US stock market since 1929. To improve 1-Month Reversal Strategy performance authors

Read more »

Data mining for network security and intrusion detection

July 16, 2012
By
Data mining for network security and intrusion detection

In preparation for “Haxogreen” hackers summer camp which takes place in Luxembourg, I was exploring network security world. My motivation was to find out how data mining is applicable to network security and intrusion detection. Flame virus, Stuxnet, Duqu proved that static, signature based security systems are not able to detect very advanced, government sponsored

Read more »

Convenient access to Gapminder’s datasets from R

July 16, 2012
By
Convenient access to Gapminder’s datasets from R

In April, Hans Rosling examined the influence of religion on fertility. I used R to replicate a graphic of his talk:> library(datamart) > gm <- gapminder() > #queries(gm) > # > # babies per woman > tmp <- query(gm, "TotalFertilityRate") > babies <- as.vector(tmp) > names(babies) <- names(tmp) > babies <- babies > countries <- names(babies) > # > # income per capita, PPP adjusted > tmp <- query(gm, "IncomePerCapita") >...

Read more »

Holt-Winters forecast using ggplot2

July 16, 2012
By
Holt-Winters forecast using ggplot2

R has great support for Holt-Winter filtering and forecasting. I sometimes use this functionality, HoltWinter & predict.HoltWinter, to forecast demand figures based on historical data. Using the HoltWinter functions in R is pretty straightforward. Let's say our dataset looks as follows; demand <- ts(BJsales, start = c(2000, 1), frequency =  Read more...

Read more »

Using integer programming in R to optimize cargo loads

July 16, 2012
By
Using integer programming in R to optimize cargo loads

Linear Programming is a mathematical technique used to find the values of some variables (within the bounds of some defined constraints) to find the maximum value of a quantity. For example, consider this problem from the FishyOperations blog: A trading company is looking for a way to maximize profit per transportation of their goods. The company has a train...

Read more »

Example 9.38: dynamite plots, revisited

July 16, 2012
By
Example 9.38: dynamite plots, revisited

Dynamite plots are a somewhat pejorative term for a graphical display where the height of a bar indicates the mean, and the vertical line on top of it represents the standard deviation (or standard error). These displays are commonly found in many scientific disciplines, as a way of communicating group differences in means. Many...

Read more »

Holt-Winters forecast using ggplot2

July 16, 2012
By
Holt-Winters forecast using ggplot2

R has great support for Holt-Winter filtering and forecasting. I sometimes use this functionality, HoltWinter & predict.HoltWinter, to forecast demand figures based on historical data. Using the HoltWinter functions in R is pretty straightforward. Let's say our dataset looks as follows; demand <- ts(BJsales, start = c(2000, 1), frequency = 12) plot(demand) Now I pass the timeseries object to HoltWinter and...

Read more »

Best Books for Social Scientists on Bayesian Analysis

July 16, 2012
By

I list and discuss the three books on Bayesian analysis that I recommend to social scientists.

Read more »