Skip to content

Posts from the ‘Software’ Category

When economic professors making simple (MS Excel) coding mistakes …


reinhart_rogoff_coding_error_0

Basic MS Excel mistake in a paper published by two Harvard Economic Professors in a top-tier Economic journal!?

This week, the hottest topic in economics or even in academia as a whole would be the paper publishes by Thomas HerndonMichael Ash and Robert Pollin |  (HAP) on 4/15/2013 critiquing a widely cited paper by Reinhart and Rogoff on the debt ration and GDP of many countries titled “Growth in a Time of Debt“.

Screen Shot 2013-04-19 at 02.29.39

What is exciting is that HAP argue that R&R has made an error when using MS Excel to analysis such macroeconomic data. That paper by HAP titled “Does High Public Debt Consistently Stifle Economic Growth? A Critique of Reinhart and Rogo ff” would probably one of legendary critique papers in economics to date.

Screen Shot 2013-04-19 at 02.37.29

As we can expect, there are many feedbacks from both academics and non-academic world. The following is the list of articles discussing this incidences.

  1. The Wall Street Journal
    Reinhart-Rogoff Response to Critique
  2. The Financial Times (Chris Cook)
    Reinhart-Rogoff recrunch the numbers
  3. The Economist
    Revisiting Reinhart-Rogoff
  4. Slate.com ()
    Is The Reinhart-Rogoff Result Based on a Simple Spreadsheet Error?
  5. Marginal Revolution (Tyler Cowen)
    An update on the Reinhart and Rogoff critique and some observations
  6. Next New Deal (Mike Konczal)
    Researchers Finally Replicated Reinhart-Rogoff, and There Are Serious Problems.
  7. Christopher Gandrud
    Reinhart & Rogoff: Everyone makes coding mistakes, we need to make it easy to find them + Graphing uncertainty
  8. Simply Statistics (Roger Peng)
    I wish economists made better plots
  9. Paul Krugman 
    Holy Coding Error, Batman
  10. Phillip Price
    Data problems, coding errors…what can be done?
  11. Next New Deal (Mike Konczal)
    Researchers Finally Replicated Reinhart-Rogoff, and There Are Serious Problems.

2012 in review by The WordPress.com


Here is a 2012 annual report for this blog produced by The WordPress.com.

My top post this year based on number of views are

  1. R-Uni (A List of Free R Tutorials and Resources in Universities webpages)
    29 COMMENTS February 2012
  2. R Style Guide
    7 COMMENTS June 2012

Click here to see the complete report.

Learn to use R for FREE with Coursera


coursera_logo_RGB

Coursera is offering free courses about R among other interesting subjects. The first one on the application of R in financial econometrics is happening this week (but you can still enroll). There are two more courses starting in January 2013 are more about using R to analyse the data. The differences between the two are stated that:

“This course (Data Analysis by Jeff Leek) will focus on how to plan, carry out, and communicate analyses of real data sets. While we will cover the basics of how to use R to implement these analyses, the course will not cover specific programming skills. Computing for Data Analysis will cover some statistical programming topics that will be useful for this class, but it is not a prerequisite for the course”.

There are more FREE online tutorials about R apart from those in Coursera. Here is the like to list of more than 90 R tutorials.

Introduction to Computational Finance and Financial Econometrics

by Eric Zivot

Learn mathematical and statistical tools and techniques used in quantitative and computational finance. Use the open source R statistical programming language to analyze financial data, estimate statistical models, and construct optimized portfolios. Analyze real world data and solve real world problems.

Next session: Dec 17th 2012 (10 weeks long)

More information: here

Data Analysis 

by Jeff Leek

Learn about the most effective data analysis methods to solve problems and achieve insight.

Next Session:
Jan 2nd 2013 (4 weeks long) You are enrolled!
Workload: 3-5 hours/week

More information: here

Computing for Data Analysis

Roger D. Peng

This course is about learning the fundamental computing skills necessary for effective data analysis. You will learn to program in R and to use R for reading data, writing functions, making informative graphs, and applying modern statistical methods.

Next Session:
Jan 22nd 2013 (8 weeks long) You are enrolled!
Workload: 3-5 hours/week

More information: here

The VDO of this course are also available in YouTube channel of Dr.Roger Peng. So you can check it out below.

Playlist: Week 1

Playlist: Week 2

Playlist: Week 3

Playlist: Week 4

Visualising Tourism Data using R with googleVis package


Inspired by Mages’s post on Accessing and plotting World bank data with R (using googleVis package), I created one visualising tourism receipts and international tourist  arrivals of various countries since 1995. The data used are from the World Bank’s country indicators.

To see the motion chart, double click a picture below.

Tourism googleVis

R_logo_small

 Code

install.packages("googleVis")
library('googleVis')

getWorldBankData <- function(id='SP.POP.TOTL', date='1960:2010',
 value="value", per.page=12000){
 require(RJSONIO)
 url <- paste("http://api.worldbank.org/countries/all/indicators/", id,
 "?date=", date, "&format=json&per_page=", per.page,
 sep="")

 wbData <- fromJSON(url)[[2]]

 wbData = data.frame(
 year = as.numeric(sapply(wbData, "[[", "date")),
 value = as.numeric(sapply(wbData, function(x)
 ifelse(is.null(x[["value"]]),NA, x[["value"]]))),
 country.name = sapply(wbData, function(x) x[["country"]]['value']),
 country.id = sapply(wbData, function(x) x[["country"]]['id'])
 )

 names(wbData)[2] <- value

 return(wbData)
}

getWorldBankCountries <- function(){
 require(RJSONIO)
 wbCountries <-
 fromJSON("http://api.worldbank.org/countries?per_page=12000&format=json")
 wbCountries <- data.frame(t(sapply(wbCountries[[2]], unlist)))
 wbCountries$longitude <- as.numeric(wbCountries$longitude)
 wbCountries$latitude <- as.numeric(wbCountries$latitude)
 levels(wbCountries$region.value) <- gsub(" \\(all income levels\\)",
 "", levels(wbCountries$region.value))
 return(wbCountries)
}

## Create a string 1960:this year, e.g. 1960:2011
years <- paste("1960:", format(Sys.Date(), "%Y"), sep="")

## International Tourism Arrivals
inter.tourist.arrivals<- getWorldBankData(id='ST.INT.ARVL',
 date=years, value="International tourism, number of arrivals")

## International Tourism Receipts
tourism.receipts <- getWorldBankData(id='ST.INT.RCPT.CD', date=years,
 value="International tourism, receipts (current US$)")

## Population
population <- getWorldBankData(id='SP.POP.TOTL', date=years,
 value="population")

## GDP per capita (current US$)
GDP.per.capita <- getWorldBankData(id='NY.GDP.PCAP.CD',
 date=years,
 value="GDP.per.capita.Current.USD")

## Merge data sets
wbData <- merge(tourism.receipts, inter.tourist.arrivals)
wbData <- merge(wbData, population)
wbData <- merge(wbData, GDP.per.capita)

## Get country mappings
wbCountries <- getWorldBankCountries()

## Add regional information
wbData <- merge(wbData, wbCountries[c("iso2Code", "region.value",
 "incomeLevel.value")],
 by.x="country.id", by.y="iso2Code")

## Filter out the aggregates and country id column
subData <- subset(wbData, !region.value %in% "Aggregates" , select=
 -country.id)

## Create a motion chart
M <- gvisMotionChart(subData, idvar="country.name", timevar="year",
 options=list(width=700, height=600))

## Display the chart in your browser
plot(M)

# save as a file
print(M, file="myGoogleVisChart.html")

R in the Press


Here is the list of press reports and news about R

  1. Bits (A blog under The New York Times)
    R you ready for R?
    by Ashlee Vance
    Published: January 8, 2009, 1:52 PM
  2. The New York Times
    Data Analysts Captivated by R’s Power
    by Ashlee Vance
    Published: January 6, 2009
  3.  InfoWorld
    The BI battle isn’t between IBM and SAS
    The little known open source project R may be the disruptor in this billion-dollar market
    By Zack Urlocker
    Published: December 2nd, 2009
  4. TechCrunch
    Big Data Right Now: Five Trendy Open Source Technologies
    by Tim Gasper
    Published: Saturday, October 27th, 2012
%d bloggers like this: