tools for google data - grasping reality with both … 12, 2013 · tools for google data ......

47
1 Tools for Google Data Hal Varian Kauffman Blogger Conference April 2013

Upload: phamnguyet

Post on 22-May-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

1

Tools for Google Data

Hal VarianKauffman Blogger Conference

April 2013

Page 2: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

2

Google Trends

Google Correlate

Google Consumer Surveys

Page 3: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Searches for [hangover]

Which day of the week are there the most searches for [hangover]?

1: Sunday

2: Monday

3: Tuesday

4: Wednesday

5: Thursday

6: Friday

7: Saturday

Page 4: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Search index for [hangover]

Page 5: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Hangover geo

Page 6: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Hangover-vodka time series

Page 7: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Searches for [civil war]

Page 8: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Searches for [term paper]

Page 9: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Gift for boyfriend v Gift for girlfriend

Forboyfriend

For girlfriend

Page 10: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Gift for husband v Gift for wife

Forhusband

For wife

Page 11: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

11

Google Trends

Google Correlate

Google Consumer Surveys

Page 12: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Searches correlated with [weight loss]

Page 13: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Plot of [weight loss] and [best vacation spots]

New Year

Page 14: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Correlated with [weight loss] 3 weeks later

Page 15: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

15

Unemployment

Page 16: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Initial claims: good leading indicator for recessions

Grey bars indicate recessions

Page 17: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Google Correlate with initial claims data

Page 18: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Initial claims and [unemployment filing]

Page 19: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Regression models

Baseline model yt = a yt-1 + c + et gives an in-sample MAE of 3.1%

Adding the “filing for unemployment” query yt = a yt-1 + b qt + c + et gives an in-sample MAE of 3.0%

Train using t weeks, forecast t+1 (rolling window forecast)MAE of baseline = 3.2%, MAE with query = 3.2%, 0% improvement

During recession MAE of baseline = 3.7%, MAE with query = 3.3%, 8.7% improvement

Page 20: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Weekly pattern for [unemployment office]

Page 21: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Gun sales

Page 22: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

FBI gun sales background check

Page 23: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

NICS time series

[stack on] has highest raw correlation[gun shops] is chosen by statistical model

Page 24: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Trend

Page 25: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Seasonal

Page 26: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

[gun shops]

Page 27: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Searches on [gun shop]

Page 28: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

28

Google Trends

Google Correlate

Google Consumer Surveys

Page 29: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

29

How it works

Page 30: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

30

Page 31: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

31

Page 32: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

32

Page 33: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

33

b

Page 34: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

34

How this changes surveys

Anyone can do them

The cost is dramatically lower

Results come back in a few hours

Surveys can be replicated … or not

You can measure sensitivity wording

Page 35: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

35

Consumer Sentiment

Page 36: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Consumer sentiment and retail sales

Page 37: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Methodology

Time series = trend + seasonal + regression + error

Find the best predictors for regression

Fat regression problem (aka p > n)

Sometimes get good fit by chance alone

Want predictors that work out of sample

Does regression provide incremental value over trend+seasonal?

Page 38: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

BSTS: Bayesian Structural Time Series

Estimating time series: use Kalman filter techniquesExpress time series as trend + seasonal + noise (“basic structural model”)

Forecast univariate model using Kalman filter

Advantages: flexibility, adaptive, interpretable, handles non-stationarity well

Model selection using “spike and slab” Bayesian regressionSpike: prior probability that coefficient is included in regression

Slab: diffuse prior for coefficient, conditional on inclusion

Estimate a posterior probability that variable is in model

Combines well with Kalman techniques

Final forecast is weighted average of many models, with weights given by posterior probabilities (Bayesian model averaging)

Example of “ensemble estimation”

Agnostic with respect to “true model”

Tends to avoid overfitting by avoiding choice of “best” single model

Page 39: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Probability of inclusion of predictor (n=98, k= 195)

White: procyclicalBlack: countercyclical

Page 40: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Start with “trend”

Page 41: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Start with “trend”

Page 42: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Add “financial planning”

Page 43: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Add “Investing”

Page 44: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Add “Business News”

Page 45: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Add “Search Engines”

Page 46: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Add Energy and Utilities

Page 47: Tools for Google Data - Grasping Reality with Both … 12, 2013 · Tools for Google Data ... Searches for [civil war] ... Google Consumer Surveys. 2 9 How it works. 3 0. 3 1. 3 2

Challenges for the future

Private sector has high-frequency, real time data and a lot of it!

Visa, Mastercard, American Express

UPS and FedEx

Wal-Mart, Target, etc

Supermarket scanner data

Search engines

Government agencies

Long historical series, but usually low frequency

Carefully constructed but labor intensive, with delayed release and periodic revisions

How to combine the public and private data?

How to integrate massive amounts of private sector real-time information with traditional government statistics