Translate

Monday, July 29, 2013

Quandl.com for Time Series Datasets

If you want to dig in with both feet on time series data, then quandl.com is a good choice.  The website claims to have several million datasets all of them available for free download.  It also allows you to upload data to the site with an authentication token.
Well, the site says it is easy to get data from their API directly into R, so let's have a crack at it.
My source for this code is Quandl itself:  http://www.quandl.com/help/packages/r
> #install the package
> install.packages("Quandl")
> library(Quandl)
> #search Quandl for a dataset on new home construction in the US
> Quandl.search("new home construction") #default is to display the first 3 results

Construction Employment in New Hampshire
Code: FRED/NHCONS
Desc: Thousands of Persons Seasonally Adjusted, 
Freq: monthly
Cols: Date|Value

Construction Employment in New Mexico
Code: FRED/NMCONS
Desc: Thousands of Persons Seasonally Adjusted, 
Freq: monthly
Cols: Date|Value

Construction Employment in New York
Code: FRED/NYCONS
Desc: Thousands of Persons Seasonally Adjusted, 
Freq: monthly
Cols: Date|Value

#That sux, so let's refine the search as there is nothing useful in that output

> Quandl.search("Housing Units Completed", source="FRED") #added source here and FRED stands for Federal Reserve

New Privately-Owned Housing Units Completed: Total
Code: FRED/COMPUTSA
Desc: Thousands of Units Seasonally Adjusted Annual Rate, 
Freq: monthly
Cols: Date|Value

New Privately-Owned Housing Units Completed: Total
Code: FRED/COMPUTNSA
Desc: Thousands of Units Not Seasonally Adjusted, 
Freq: monthly
Cols: Date|Value

New Privately-Owned Housing Units Completed in the South Census Region
Code: FRED/COMPUSTSA
Desc: Thousands of Units Seasonally Adjusted Annual Rate, 
Freq: monthly
Cols: Date|Value

# I will settle for Units Completed without seasonal adjustment; The dataset code is "FRED/COMPUTNSA"

> Units = Quandl("FRED/COMPUTSA") #download the data
> head(Units)
        Date          Value
1  1968-01-01  1257
2  1968-02-01  1174
3  1968-03-01  1323
4  1968-04-01  1328
5  1968-05-01  1367
6  1968-06-01  1184


There you have it.  I plan to explore the Changepoint package in an upcoming blog using this dataset.

3 comments:

  1. Good article Guys, Thanks. By the way I found this awesome site for Financial Data and Analysis : http://thinknum.blogspot.com/ It has a financial data analysis engine which brings the functionality traditionally found on wall street proprietary trading desks to an open platform. This tool is similar to PlotTool at Goldman Sachs or DataQuery at JP Morgan. Check it out, You may like it!

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete