Predicting the Present with Google Trends

Hyunyoung Choi Hal Varian c °Google Inc. Draft Date April 10, 2009

Contents 1 Methodology 1.1 Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Examples 2.1 Retail Sales . . . . . . . 2.2 Automotive Sales . . . 2.3 Home Sales . . . . . . . 2.4 Travel . . . . . . . . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

3 Conclusion

1 1 2 6 6 9 12 15 18

4 Appendix 4.1 R Code: Automotive sales example used in Section 1

i

. . . . . . . . . . . . . . . . . . . .

19 19

Motivation Can Google queries help predict economic activity? Economists, investors, and journalists avidly follow monthly government data releases on economic conditions. However, these reports are only available with a lag: the data for a given month is generally released about halfway through through the next month, and are typically revised several months later. Google Trends provides daily and weekly reports on the volume of queries related to various industries. We hypothesize that this query data may be correlated with the current level of economic activity in given industries and thus may be helpful in predicting the subsequent data releases. We are not claiming that Google Trends data help predict the future. Rather we are claiming that Google Trends may help in predicting the present. For example, the volume of queries on a particular brand of automobile during the second week in June may be helpful in predicting the June sales report for that brand, when it is released in July.i. Our goals in this report are to familiarize readers with Google Trends data, illustrate some simple forecasting methods that use this data, and encourage readers to undertake their own analyses. Certainly it is possible to build more sophisticated forecasting models than those we describe here. However, we believe that the models we describe can serve as baselines to help analysts get started with their own modelling efforts and that can subsequently be refined for specific applications. The target audiences for this primer are readers with some background in econometrics or statistics. Our examples use R, a freely available open-source statistics packageii. ; we provide the R source code for the worked-out example in Section 1.2 in the Appendix.

i. ii.

It may also be true that June queries help to predict July sales, but we leave that question for future research. http://CRAN.R-project.org

ii

Chapter 1

Methodology Here we provide an overview of the data and statistical methods we use, along with a worked out example.

1.1

Data

Google Trends provides an index of the volume of Google queries by geographic location and category. Google Trends data does not report the raw level of queries for a given search term. Rather, it reports a query index. The query index starts with the query share: the total query volume for search term in a given geographic region divided by the total number of queries in that region at a point in time. The query share numbers are then normalized so that they start at 0 in January 1, 2004. Numbers at later dates indicated the percentage deviation from the query share on January 1, 2004. This query index data is available at country and state level for the United States and several other countries. There are two front ends for Google Trends data, but the most useful for our purposes is http://www.google.com/insights/search which allows the user to download the query index data as a CSV file. Figure 1.1 depicts an example from Google Trends for the query [coupon]. Note that the search share for [coupon] increases during the holiday shopping season and the summer vacation season. There has been a small increase in the query index for [coupon] over time and a significant increase in 2008, which is likely due to the economic downturn. Google classifies search queries into 27 categories at the top level and 241 categories at the second level using an automated classification engine. Queries are assigned to particular categories using natural language processing methods. For example, the query [car tire] would be assigned to category Vehicle Tires which is a subcategory of Auto Parts which is a subcategory of Automotive.

1

CHAPTER 1. METHODOLOGY

2

Figure 1.1: Google Trends by Keywords - Coupon

1.2

Model

In this section, we will discuss the relevant statistical background and walk through a simple example. Our statistical model is implemented in R and the code may be found in the Appendix. The example is based on Ford’s monthly sales from January 2004 to August 2008 as reported by Automotive News. Google Trends data for the category Automotive/Vehicle Brands/Ford is used for the query index data. Denote Ford sales in the t-th month as {yt : t = 1, 2, · · · , T } and the Google Trends index in the k-th (k)

week of the t-th month as {xt

: t = 1, 2, · · · , T ; k = 1, · · · , 4}. The first step in our analysis is to plot

the data in order to look for seasonality and structural trends. Figure 1.2 shows a declining trend and strong seasonality in both Ford Sales and the Ford Query index. We start with a simple baseline forecasting model: sales this month are predicted using sales last month and 12 months ago. Model 0: log(yt ) ∼ log(yt−1 ) + log(yt−12 ) + et ,

(1.1)

The variable et is an error term. This type of model is known in the literature as a seasonal autoregressive model or a seasonal AR model. We next add the query index for ‘Ford’ during the first week of each month to this model. Denoting (1)

this variable by xt , we have (1)

Model 1: log(yt ) ∼ log(yt−1 ) + log(yt−12 ) + xt + et

(1.2)

The least squares estimates for this model are shown in equation (1.3). The positive coefficient on the Google Trends variable indicates that the search volume index is positively associated with Ford Sales sales.

3

−20 −50

100000

−40

−30

Percentage Change

200000 150000

Sales

250000

−10

0

300000

CHAPTER 1. METHODOLOGY

2004

2005

2006

2007

2008

2009

2004

2005

2006

Time

(a) Ford Monthly Sales

2007

2008

2009

Time

(b) Ford Google Trends

Figure 1.2: Ford Monthly Sales and Ford Query Index

Figure 1.3 depict the four standard regression diagnostic plots from R. Note that observation 18 (July 2005) is an outlier in each plot. We investigated this date and discovered that there was special promotion event during July 2005 called an ‘employee pricing promotion.’ We added a dummy variable to control for this observation and re-estimated the model. The results are shown in (1.4). (1)

log(yt ) =

2.312 + 0.114 · log(yt−1 ) + 0.709 · log(yt−12 ) + 0.006 · xt

(1.3)

log(yt ) =

2.007 + 0.105 · log(yt−1 ) + 0.737 · log(yt−12 ) + 0.005 · xt + 0.324 · I(July 2005). (1.4)

(1)

Both models give us consistent results and the coefficients in common are similar. The 32.4% increase in sales at July 2005 seems to be due to the employee pricing promotion. The coefficient on the Google Trends variable in (1.4) implies that 1% increase in search volume is associated with roughly a 0.5% increase in sales. Does the Google Trends data help with prediction? To answer this question we make a series of one-month ahead predictions and compute the prediction error defined in Equation 1.5. The average of the absolute values of the prediction errors is known as the mean absolute error (MAE). Each forecast uses only the information available up to the time the forecast is made, which is one week into the month in question.

CHAPTER 1. METHODOLOGY

4

Normal Q−Q

3

0.3

Residuals vs Fitted

1 0 −1

Standardized residuals

0.1 0.0 −0.2

−0.1

Residuals

18

2

0.2

18

53

−2

53

−0.3

30 30

11.8

12.0

12.2

12.4

−2

−1

Fitted values

0

1

2

Theoretical Quantiles

Scale−Location

Residuals vs Leverage 30

1

3

18

1.5

18

0.5

2 1 0 −1

Standardized residuals

1.0

10

−2

0.5

Standardized residuals

53

0.5

0.0

−3

30

11.8

12.0

12.2

12.4

Cook’s distance 0.00

0.05

Fitted values

0.10

0.15

1

0.20

0.25

Leverage

Figure 1.3: Diagnostic Plots for the regression model

PEt

=

MAE =

log(ˆ yt ) − log(yt ) ≈

yt − yˆt yt

(1.5)

T 1X |PEt | T t=1

Note that the model that includes the Google Trends query index has smaller absolute errors in most months, and its mean absolute error over the entire forecast period is about 3 percent smaller. (Figure 1.4). Since July 2008, both models tend to overpredict sales and Model 0 tends to overpredict by more. It appears that the query index helps capture the fact that consumer interest in automotive purchase has declined during this period.

Figure 1.4: Prediction Error Plot September 2008

August 2008

July 2008

June 2008

May 2008

April 2008

March 2008

February 2008

January 2008

December 2007

November 2007

−30

October 2007

Prediction Error in Percent

CHAPTER 1. METHODOLOGY 5

0

−10

−20

Model 0 (MAE = 9.49%) Model 1 (MAE = 9.22%)

Chapter 2

Examples 2.1

Retail Sales

The US Census Bureau releases the Advance Monthly Retail Sales survey 1-2 weeks after the close of each month. These figures are based on a mail survey from a number of retail establishments and are thought to be useful leading indicators of macroeconomic performance. The data are subsequently revised at least two times; see ‘About the surveyi. ’ for the description of the procedures followed in constructing these numbers. The retail sales data is organized according to the NAICS retail trade categories.ii.

The data is

reported in both seasonally adjusted and unadjusted form; for the analysis in this section, we use only the unadjusted data.

ID 441 442 443 444 445 446 447 448 451 452 453 454 722

NAICS Sectors Title Motor vehicle and parts dealers Furniture and home furnishings stores Electronics and appliance stores Building mat., garden equip. & supplies dealers Food and beverage stores Health and personal care stores Gasoline stations Clothing and clothing access. stores Sporting goods, hobby, book, and music stores General merchandise stores Miscellaneous store retailers Nonstore retailers Food services and drinking places

ID 47 11 5 12-48 71 45 12-233 18-68 20-263 18-73 18 18-531 71

Google Categories Title Automotive Home & Garden Computers & Electronics Construction & Maintenance Food & Drink Health Energy & Utilities Apparel Sporting Goods Mass Merchants & Department Stores Shopping Shopping Portals & Search Engines Food & Drink

Table 2.1: Sectors in Retail Sales Survey i. ii.

http://www.census.gov/marts/www/marts.html http://www.census.gov/epcd/naics02/def/NDEF44.HTM

6

CHAPTER 2. EXAMPLES

7

As we indicated in the introduction, Google Trends provides a weekly time series of the volume of Google queries by category. It is straightforward to match these categories to NAICS categories. Table 2.1 presents top level NAICS categories and the associated subcategories in Google Trends. We used these subcategories to predict the retail sales release one month ahead.

−20

65000

0

20

75000

40

85000

273: Motorcycles

2005

2006

2007

2008

−30

65000

−20

75000

−10

0

85000

467: Auto Insurance

2005

2006

2007

2008

−25

65000

−15

75000

Census Week One Week Two

−5

85000

610: Trucks & SUVs

2005

2006

2007

2008

Figure 2.1: Sales on ‘Motor vehicle and parts dealers’ from Census and corresponding Google Trends data.

Under the Automotive category, there are fourteen subcategories of the query index. From these fourteen categories, the four most relevant subcateories are plotted against Census data for sales on ‘Motor Vehicles and Parts’ (Figure 2.1) We fit models from Section 1.2 to the data using 1 and 2 weeks of Google Trend data. The notation

CHAPTER 2. EXAMPLES

8

(1)

x610,t refers to Google category 610 in week 1 of month t. Our estimated models are Model

0:

log(yt ) = 1.158 + 0.269 · log(yt−1 ) + 0.628 · log(yt−12 ), et ∼ N (0, 0.052 )

Model

1:

log(yt ) = 1.513 + 0.216 · log(yt−1 ) + 0.656 · log(yt−12 ) + 0.007 · x610,t , et ∼ N (0, 0.062 )

Model

2:

log(yt ) = 0.332 + 0.230 · log(yt−1 ) + 0.748 · log(yt−12 )

(2.1)

(1)

(2)

(1)

(1)

−0.001 · x273,t + 0.002 · x467,t + 0.004 · x610,t , et ∼ N (0, 0.052 ). Note that the R2 moves from 0.6206 (Model 0) to 0.7852 (Model 1) to 0.7696 (Model 2). The models show that the query index for ‘Trucks & SUVs’ exhibits positive association with reported sales on ‘Motor Vehicles and Parts’.

Prediction Error in Percent

0

−5

−10

−15

Model 0 (MAE = 7.02%) Model 1 (MAE = 5.96%) Model 2 (MAE = 5.73%) September 2008

August 2008

July 2008

June 2008

May 2008

April 2008

March 2008

February 2008

January 2008

December 2007

November 2007

October 2007

−20

Figure 2.2: Prediction Error Plot

Figure 2.2 illustrates that the mean absolute error of Model 1 is about 15% better than model 0, while Model 2 is about 18% better in terms of this measure. However all forecasts have been overly optimistic since early 2008.

CHAPTER 2. EXAMPLES

2.2

9

Automotive Sales

In Section 2.1, we used Google Trends to predict retail sales in ‘Motor vehicle and parts dealers’. While automotive sales are an important indicator of economic activity, manufacturers are likely more interested in sales by make. In the Google Trends category Automotive/Vehicle Brands there are 31 subcategories which measure the relative search volume on various car makes. These can be easily matched to the 27 categories reported in the ’US car and light-truck sales by make’ tables distributed by Automotive Monthly. We first estimated separate forecasting models for each of these 27 makes using essentially the same method described in Section 1.1. As we saw in that section, it is helpful to have data on sales promotions when pursuing this approach. Since we do not have such data, we tried an alternative fixed-effects modeling approach. That is, we we assume that the short-term and seasonal lags are the same across all makes and that the differences in sales volume by make can be captured by an additive fixed effect.

2005

2006

2007

300000 250000

2008

2004

2005

2006

Time

Time

Toyota

Toyota

2007

2008

2007

2008

−15 2004

2005

2006

2007

Time

(a) Sales vs. Google Trends

2008

Sales

160000

200000

Sales Fitted

120000

25 15 −5

5

160000 120000

Sales

200000

35

45

2004

200000

Sales

−40

150000

−36

200000

−32

−28

250000

−24

300000

Sales Google Trends

150000

Sales

Chevrolet −20

Chevrolet

2004

2005

2006

Time

(b) Actual & Fitted Sales

Figure 2.3: Sales and Google Trends for Top 2 Makes, Chevrolet & Toyota

CHAPTER 2. EXAMPLES

10

Denote the automotive sales from the i-th make and t-th month as {yi,t : t = 1, 2, · · · , T ; i = 1, · · · , N } (k)

and the corresponding i-th Google Trends index as {xi,t : t = 1, 2, · · · , T ; i = 1, · · · , N ; k = 1, 2, 3}. Considering the relatively longer research time associated car purchase, we used Google Trends from the (3)

(1)

second to last week of the previous month(xi,t−1 ) to the first week of the month in question (xi,t ) as predictors. The estimates from Equation (2.2) indicate that the the Google Trends index for a particular make in the last two week of last month is positively associated with current sales of that make. log(yi,t )

=

2.838 + 0.258 · log(yi,t−1 ) + 0.448 · log(yi,t−12 ) + δi · I(Car Make)i (1)

(2)

(3)

+0.002 · xi,t + 0.003 · xi,t − 0.001 · xi,t , ei,t ∼ N (0, 0.132 ).

(2.2)

We can compare the fixed effects model to the separately estimated univariate models for each brand. In each of the separately estimated models case we find a positive association with the relevant Google Trends index. Here are two examples. (2)

Chevrolet :

log(yi,t ) = 7.367 + 0.439 · log(yi,t−12 ) + 0.017 · xi,t , et ∼ N (0, 0.1142 )

Toyota :

log(yi,t ) = 4.124 + 0.655 · log(yi,t−12 ) + 0.003 · xi,t , et ∼ N (0, 0.0932 )

(2.3)

(2)

Model (1.1) is fitted to each brand and compared to Model (2.2) and Model (2.3). As before, we made rolling one-step ahead predictions from 2007-10-01 to 2008-09-01. We found that Model 1.1 performed best for Chevrolet while Model 2.3 performed best for Toyota, as shown in Figure 2.4. One issue with the fixed effects model is that imposes the same seasonal effects for each make. This may or may not be accurate. See, for example, the fit for Lexus in Figure 2.4. In December, Lexus has traditionally run an ad campaign suggesting that a new Lexus would be a welcome Christmas present. Hence we observe a strong seasonal spike in December Lexus sales which is not present with other makes. In this case, it makes sense to estimate a separate model for Lexus. Indeed, if we do this we estimate a separate model for Lexus, we get an improved fit with the mean absolute error falling from X to Y.

July 2008 August 2008

August 2008

March 2008

February 2008

January 2008

December 2007

November 2007

October 2007

July 2008

Model (1.1) (MAE = 6.18%) Model (2.2) (MAE = 5.41%) Model (2.3) (MAE = 6.31%) June 2008

−10

June 2008

−5 May 2008

0

May 2008

5 April 2008

(a) Chevrolet

April 2008

March 2008

February 2008

January 2008

December 2007

−20

November 2007

−15

October 2007

September 2007

Prediction Error in Percent −20

September 2007

Prediction Error in Percent

CHAPTER 2. EXAMPLES 11

10

0

−10

Model (1.1) (MAE = 7.95%) Model (2.2) (MAE = 11.16%) Model (2.3) (MAE = 9.17%)

(b) Toyota

Figure 2.4: Prediction Error Plot by Make - Chevrolet & Toyota

CHAPTER 2. EXAMPLES

2.3

12

Home Sales

The US Census Bureau and the US Department of Housing and Urban Development release statistics on the housing market at the end of each month.iii. The data includes figures on ‘New House Sold and For Sale’ by price and stage of construction. New House Sales peaked in 2005 and have been declining since then (Figure 2.5(a)). The price index peaked in early 2007 and has declined steadily for several months. Recently the price index fell sharply (Figure 2.5(b)). The Google Trends ‘Real Estate’ category has 6 subcategories (Figure 2.6) - Real Estate Agencies (Google Category Id: 96), Rental Listings & Referrals(378), Property Management(425), Home Inspections & Appraisal(463), Home Insurance(465), Home Financing(466). It turns out that the search index

2003

2004

2005

2006

2007

2008

(a) Number of New House Sold

330000 310000

260000

290000

240000

270000

220000

250000

200000

Median Sales Price Average Sales Price 2003

2004

2005

2006

2007

230000

40

Not Seasonally Adjusted Seasonally Adjusted

180000

500

600

60

700

800

80

900

100

120

1000 1100 1200 1300 1400

for Real Estate Agencies is the best predictor for contemporaneous house sales.

2008

(b) Prices of New House Sold

Figure 2.5: Number and Price of New House Sold

We fit our model to seasonally adjusted sales figures, so we drop the 12-month lag used in our earlier model, leaving us with Equation (2.4).

Model 0: log(yt ) ∼ log(yt−1 ) + et ,

(2.4)

where et is an error term. The model is fitted to the data and Equation (2.5) shows the estimates of the iii.

http://www.census.gov/const/www/newressalesindex.html

CHAPTER 2. EXAMPLES

13 378: Rental Listings & Referrals

2004

2005

2006

2007

1300 1100 900 700

−20

500

500

Google Trends New House Sale

−30

−30

−20

700

−10

−10

900

0

0

1100

10

10

1300

20

20

96: Real Estate Agencies

2008

2004

2006

2007

2008

2004

2005

2006

2007

30

900 700

−10

2008

2004

2005

2006

2007

2008

2004

2005

1100

40

900 700

500

Google Trends New House Sale 2006

2007

2008

500

−20

−20

700

0

0

900

20

20

40

1100

60

1300

466: Home Financing

1300

465: Home Insurance

500

Google Trends New House Sale

−20

500

−20

−10

700

0

0

900

10

1100

1100

20

30 20 10

1300

463: Home Inspections & Appraisal

1300

425: Property Management

2005

2004

2005

2006

2007

2008

Figure 2.6: Time Series Plots: New House Sold vs. Subcategories of Google Trends

model. The model implies that (1) house sales at (t − 1) are positively related to house sales at t, (2) the search index on ‘Rental Listings & Referrals’(378) is negatively related to sales, (3) the search index for ‘Real Estate Agencies’(96) is positively related to sales, (4) the average housing price is negatively associated with sales. (1)

(2)

Model 1: log(yt ) = 5.795 + 0.871 · log(yt−1 ) − 0.005 · x378,t + 0.005x96,t − 0.391 · Avg Pricet(2.5) The one-step ahead prediction errors are shown in Figure 2.7(a). The mean absolute error is about 12% less for the model that includes the Google Trends variables.

800

1000

1200

1400

14

600

Seasonally Adjusted Annual Sales Rate in 1,000

CHAPTER 2. EXAMPLES

2004

2005

2006

2007

2008

Time

(a) Seasonally Adjusted Annual Sales Rate vs. Fitted

Model 0 (MAE = 6.91%) Model 1 (MAE = 6.08%)

5 0 −5 −10

July 2008

June 2008

May 2008

April 2008

March 2008

February 2008

January 2008

December 2007

November 2007

October 2007

September 2007

−15 August 2007

Prediction Error in Percent

10

(b) 1 Step ahead Prediction Error

Figure 2.7: New One Family House Sales - Fit and Prediction

CHAPTER 2. EXAMPLES

2.4

15

Travel

The internet is commonly used for travel planning which suggests that Google Trends data about destinations may be useful in predicting visits to that destination. We illustrate this using data from the Hong Kong Tourism Board.iv.

2007

5 10 15

110

−5 0 −15

50000

−35

−25

40000

2006

2007

2008

Italy

−25

20

30

2005

2008

2004

2005

2006

2007

2008

−35 −55 −65 2004

2005

2006

2007

2008

India 120 100 80 60 40 20

10 20 30 40 50 60 70 80 90

30 20 2007

90000 100000

10 0 2006

80000

−20 −10 2005

70000

50000 40000 30000 2004

−45

2008

0

70 60

2007

40

50

60000

2006

Japan

−20

2005

8000

−10 2004

6000

−30 −50

2008

130

2007

110

2006

Australia

15000 20000 25000 30000 35000 40000 45000

2005

120000

2004

4000

15000

−10 −20 −30

10000

10000

15000

0

0

10

20

20000

10

60000

70000

50

2004

40

40

30000

2008

25000

30

25000

0 10 20 30 40 50 60 70 80 90

−45 2006

France

−15

2005

14000

2004

12000

2008

Germany

20000

Britain

10000

70 60

40000

50 2007

35000

40 30 2006

30000

20 10 0 −10 2005

25000

110000 90000 70000 2004

45000

Canada

20000

130000

USA

2004

2005

2006

2007

2008

Figure 2.8: Visitors Statistics and Google Trends by Country Note: The black line depictes visitor arrival statistics and red line depicts the Google Trends index by country.

The Hong Kong Tourism Board publishes monthly visitor arrival statistics, including ‘Monthly visitor arrival summary’ by country/territory of residence, the mode of transportation, the mode of entry and other criteria. We use visitor arrival statistics by country from January 2004 to August 2008 for this iv.

http://partnernet.hktourismboard.com

CHAPTER 2. EXAMPLES

16

analysis. The foreign exchange rate defined as HKD/Domestic currency is used as another predictor for visitor volume. The Beijing Olympics were held from 2008-08-08 to 2008-08-24 and the traffic at July 2008 and August 2008 is expected to be lower than usual so we use dummy variable to adjust the traffic difference during those periods. ‘Hong Kong’ is one of the subcategories in under Vacation Destinations in Google Trends. The countries of origin in our analysis are USA, Canada, Great Britain, Germany, France, Italy, Australia, Japan and India. The visitors from these 9 countries are around 19% of total visitors to Hong Kong during the period we examine. The visitor arrival statistic from all countries shows seasonality and an increasing trend over time, but the trend growth rates differ by country(Figure 2.8). Here we examine a fixed effects model. In Equation 2.6. ‘Countryi ’ is a dummy variable to indicate each country and the interaction with log(yi,t−12 ) captures the different year-to-year growth rate. ‘Beijing’ is another dummy variable to indicate Beijing Olympics period. log(yi,t )

=

2.412 + 0.059 · log(yi,t−1 ) + βi,12 · log(yi,t−12 ) × Countryi (2)

(3)

+ δi · Beijing × Countryi + 0.001 · xi,t + 0.001 · xi,t + ei,t , ei,t ∼ N (0, 0.092 ) From Equation (2.6)), we learn that (1) arrivals last month are positively related to arrivals this month, (2) arrivals 12 months ago are positively related to arrivals this month, (3) Google searches on ‘Hong Kong’ are positively related to arrivals, (4) during the Beijing Olympics, travel to Hong Kong decreased. Table 2.2 is an Analysis of Variance table from Model 2.6. It shows that most of the variance is explained by lag variable of arrivals and that the contribution from Google Trends variable is statistically significant. Figure 2.9 shows the actual arrival statistics and fitted values. The model fits remarkably well with Adjusted R2 equal to 0.9875.

CHAPTER 2. EXAMPLES

log(y1) Country log(y12) (2) xi,t (3) xi,t Beijing Country:log(y12) Country:Beijing Residuals

17 Df 1 8 1 1 1 1 8 8 366

Sum Sq 234.07 5.82 9.02 0.44 0.03 0.41 0.23 0.14 2.93

Mean Sq 234.07 0.73 9.02 0.44 0.03 0.41 0.03 0.02 0.01

F value 29,220.86 90.74 1,126.49 54.34 3.87 51.23 3.59 2.12

Pr(>F) < 2.2e-16 < 2.2e-16 < 2.2e-16 1.13E-12 0.049813 4.53E-12 0.000504 0.033388

*** *** *** *** * *** *** *

Table 2.2: Estimates from Model (2.6) Note: Signif. codes: ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.10

60000

40000 2006

2007

2008

30000

20000

25000

40000

30000

50000

35000

110000 70000 80000 90000 2005

Britain

70000

Canada 45000

130000

USA

2005

2006

2007

2008

2005

2006

France 25000

2008

10000 8000

10000

6000

15000

15000

20000

20000

12000

25000

2007

Italy 14000

Germany

2006

2007

2008

2005

2006

2007

2008

Japan

30000

90000

40000

100000

50000

110000

120000

60000

Australia

2005

2006

2007

2008

2005

2006

2007

2005

2008

2006

2007

2008

India

15000 20000 25000 30000 35000 40000 45000

2005

Actual Fitted

2005

2006

2007

2008

Figure 2.9: Visitors Statistics and Fitted by Country Note: The black line depicts the actual visitor arrival statistics and red line depicts fitted visitor arrival statistics by country.

Chapter 3

Conclusion We have found that simple seasonal AR models and fixed-effects models that includes relevant Google Trends variables tend to outperform models that exclude these predictors. In some cases, the gain is only a few percent, but in others can be quite substantial, as with the 18% improvement in the predictions for ’Motor Vehicles and Parts’ and the 12% improvement for ’New Housing Starts’. One thing that we would like to investigate in future work is whether the Google Trends variables are helpful in predicting “turning points” in the data. Simple autoregressive models due remarkably well in extrapolating smooth trends; however, by their very nature, it is difficult for such models to describe cases where the direction changes. Perhaps Google Trends data can help in such cases. Google Trends data is available at a state level for several countries. We have also had success with forecasting various business metrics using state-level data. Currently Google Trends data is computed by a sampling method and varies somewhat from day to day. This sampling error adds some additional noise to the data. As the product evolves, we expect to see new features and more accurate estimation of the Trends query share indices.

18

Chapter 4

Appendix 4.1

R Code: Automotive sales example used in Section 1

##### Import Google Trends Data google = read.csv(’googletrends.csv’); google$date = as.Date(google$date); ##### Sales Data dat = read.csv("FordSales.csv"); dat$month = as.Date(dat$month); ##### get ready for the forecasting; dat = rbind(dat, dat[nrow(dat), ]); dat[nrow(dat), ’month’] = as.Date(’2008-09-01’); dat[nrow(dat), -1] = rep(NA, ncol(dat)-1); ##### Define Predictors - Time Lags; dat$s1 = c(NA, dat$sales[1:(nrow(dat)-1)]); dat$s12 = c(rep(NA, 12), dat$sales[1:(nrow(dat)-12)]); ##### Plot Sales & Google Trends data; par(mfrow=c(2,1)); plot(sales ~ month, data= dat, lwd=2, type=’l’, main=’Ford Sales’, ylab=’Sales’, xlab=’Time’); plot(trends ~ date, data= google, lwd=2, type=’l’, main=’Google Trends: Ford’, ylab=’Percentage Change’, xlab=’Time’); ##### Merge Sales Data w/ Google Trends Data google$month = as.Date(paste(substr(google$date, 1, 7), ’01’, sep=’-’)) dat = merge(dat, google); ##### Define Predictor - Google Trends ## t.lag defines the time lag between the research and purchase. ## t.lag = 0 if you want to include last week of the previous month and ## 1st-2nd week of the corresponding month ## t.lag = 1 if you want to include 1st-3rd week of the corresponding month t.lag = 1; id = which(dat$month[-1] != dat$month[-nrow(dat)]); mdat = dat[id + 1, c(’month’, ’sales’, ’s1’, ’s12’)]; 19

CHAPTER 4. APPENDIX mdat$trends1 = dat$trends[id + t.lag]; mdat$trends2 = dat$trends[id + t.lag + 1]; mdat$trends3 = dat$trends[id + t.lag + 2]; ##### Divide data by two parts - model fitting & prediction dat1 = mdat[1:(nrow(mdat)-1), ] dat2 = mdat[nrow(mdat), ] ##### Exploratory Data Analysis ## Testing Autocorrelation & Seasonality acf(log(dat1$sales)); Box.test(log(dat1$sales), type="Ljung-Box") ## Testing Correlation plot(y = log(dat1$sales), x = dat1$trends1, main=’’, pch=19, ylab=’log(Sales)’, xlab= ’Google Trends - 1st week’) abline(lm(log(dat1$sales) ~ dat1$trends1), lwd=2, col=2) cor.test(y = log(dat1$sales), x = dat1$trends1) cor.test(y = log(dat1$sales), x = dat1$trends2) cor.test(y = log(dat1$sales), x = dat1$trends3) ##### Fit Model; fit = lm(log(sales) ~ log(s1) + log(s12) + trends1, data=dat1); summary(fit) ##### Diagnostic Plot par(mfrow=c(2,2)); plot(fit) #### Prediction for the next month; predict.fit = predict(fit, newdata=dat2, se.fit=TRUE);

20

Predicting the Present with Google Trends

Apr 10, 2009 - Denote Ford sales in the t-th month as {yt : t = 1, 2, ··· ,T} and the Google Trends index in the .... i. http://www.census.gov/marts/www/marts.html ii.

304KB Sizes 1 Downloads 235 Views

Recommend Documents

Predicting the Present with Bayesian Structural Time Series - CiteSeerX
Jun 28, 2013 - Because the number of potential predictors in the regression model is ... 800. 900. Thousands. Figure 1: Weekly (non-seasonally adjusted) .... If there is a small ...... Journal of Business and Economic Statistics 20, 147–162.

pdf-146\quantifying-the-present-and-predicting-the-past ...
... apps below to open or edit this item. pdf-146\quantifying-the-present-and-predicting-the-pas ... rchaeological-predictive-modeling-by-us-department.pdf.

pdf-146\quantifying-the-present-and-predicting-the-past-theory ...
... OUR ONLINE LIBRARY. Page 3 of 7. pdf-146\quantifying-the-present-and-predicting-the-pas ... rchaeological-predictive-modeling-by-us-department.pdf.

Electricity Use in California: Past Trends and Present ... | Google Sites
first observation about these data is that annual consumption and peak load are .... in the agricultural, mining, construction, or manufacturing sectors. Data on.

Electricity Use in California: Past Trends and Present ...
http://enduse.lbl.gov/Projects/CAdata.html. Also Energy Policy vol 31 ... In 2000, the building sector accounted for 2/3 of annual electricity consumption and 3/4 of ...

Predicting the Drama of the Commons with ...
Aug 18, 2010 - investing in technology that facilitates the exploitation of natural resources and thus .... over the lake and fish at their preferred, sometimes remote spot(s). ... leaders who invited the village members to a “fishermen‟s meeting

Predicting Neuronal Activity with Simple Models of the ...
proposed by Brette and Gerstner therefore seems ide- ally suited to deal with these issues [6]. It includes an additional mechanism that can be tuned to model.

Predicting visibilities in MeqTrees with UVBrick - GitHub
SixpackImageComponent (Python). FFTBrick ... interpolated visibilities as a function of frequency and time. ... enables one to calculate V(u,v,w) from V(u,v,w=0).

The Present Simple Tense_part I_Uses of the Present Simple.pdf ...
The Present Simple Tense_part I_Uses of the Present Simple.pdf. The Present Simple Tense_part I_Uses of the Present Simple.pdf. Open. Extract. Open with.

Present Your Teeth The Best Way With Teeth Whitening Products.pdf ...
Page 1 of 1. Present Your Teeth The Best Way With Teeth Whitening Products. The at home teeth whitening kit is the product that helps you to get your teeth whiter and brighter through. different types of products. These kits are very much effective a

Are You Satisfied with Life?: Predicting ... - Dr Michal Kosinski
Keywords: Social networking · Facebook · Satisfaction with life ... are posting about their lives, family, and social interactions making sites like. Twitter, Facebook .... qualitative interpretation of SWL scores [10], we consider models with aver

Predicting Winning Price in Real Time Bidding with Censored Data.pdf ...
Displaying Predicting Winning Price in Real Time Bidding with Censored Data.pdf. Predicting Winning Price in Real Time Bidding with Censored Data.pdf.

Read PDF Predicting Events with Astrology Read ...
PDF online, PDF new Predicting Events with Astrology, Online PDF Predicting Events with Astrology Read PDF Predicting Events with Astrology, Full PDF ...

PRESENT-SIMPLE-VS-PRESENT-CONTINUOUS.pdf
Whoops! There was a problem loading more pages. Whoops! There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. PRESENT-SIMPLE-VS-PRESENT-CONTINUOUS.pdf. PRESENT-SI

Predicting Response in Mobile Advertising with ...
Sparse data / cold-‐start. • Desiderata: – Accurate ... Webpage (= page ID) ... Response Predic`on Framework page p ad a day d. pCTR. K latent factors. K latent.

Predicting wildfire occurrence distribution with spatial ...
Apr 7, 2015 - compared with the period from 1970 to 1986 (Westerling et al. 2006). ... management. Spatial point process (SPP) modelling (Stoyan and Penttinen. 2000) provides a promising approach for investigating wildfire occurrences at .... 1340 fi

Predicting Winning Price in Real Time Bidding with Censored Data.pdf
Predicting Winning Price in Real Time Bidding with Censored Data.pdf. Predicting Winning Price in Real Time Bidding with Censored Data.pdf. Open. Extract.

Predicting Search User Examination with Visual Saliency Information
⋆School of Computer and Information, HeFei University of Technology, Hefei, China ..... peaked approximately 600 ms after page loading and decreased over time. ... experimental search engine system to control the ranking position ...

Predicting Search User Examination with Visual Saliency Information
⋆School of Computer and Information, HeFei University of Technology, Hefei, China ..... training to predict eye fixations on images. The results of these work indicated that ...... eye-tracking study of user interactions with query auto completion.

Are You Satisfied with Life?: Predicting ... - Dr Michal Kosinski
Abstract. Social media can be beneficial in detecting early signs of emo- tional difficulty. We utilized the Satisfaction with Life (SWL) index as a cognitive health ...

Predicting drug activity - STEM
making it or testing it. The likelihood that a ... molecular model building they provide a good way of visualising molecules and beginning to ... From the website:.

9.3 Predicting Redox Reactions
Write the half-reaction equations (reverse the direction of the oxidation reaction). 6. Use multipliers to balance the electrons. 7. Combine the half reactions to give ...