## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

**Hyunyoung Choi Hal Varian
**

c Google Inc. Draft Date April 2, 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 4 Appendix 4.1 R Code: Automotive sales example used in Section 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 2 6 6 9 12 15 18 19 19

i

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 eﬀorts and that can subsequently be reﬁned for speciﬁc 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 ﬁle. 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 signiﬁcant increase in 2008, which is likely due to the economic downturn. Google classiﬁes search queries into 27 categories at the top level and 241 categories at the second level using an automated classiﬁcation 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 week of the t-th month as {xt

(k)

: t = 1, 2, · · · , T ; k = 1, · · · , 4}. The ﬁrst 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 ﬁrst week of each month to this model. Denoting this variable by xt , we have Model 1: log(yt ) ∼ log(yt−1 ) + log(yt−12 ) + xt + et

(1) (1)

(1.2)

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

CHAPTER 1. METHODOLOGY

3

300000

250000

Percentage Change

2004 2005 2006 Time 2007 2008 2009

Sales

200000

150000

100000

−50

2004

−40

−30

−20

−10

0

2005

2006 Time

2007

2008

2009

(a) Ford Monthly Sales

(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). log(yt ) = log(yt ) = 2.312 + 0.114 · log(yt−1 ) + 0.709 · log(yt−12 ) + 0.006 · xt

(1)

(1.3)

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 coeﬃcients in common are similar. The 32.4% increase in sales at July 2005 seems to be due to the employee pricing promotion. The coeﬃcient 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 deﬁned in Equation 1.5. The average of he 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

Residuals vs Fitted

Normal Q−Q

18

0.3

3

18

0.2

Standardized residuals

53

0.1

Residuals

0.0

−0.1

−0.2

−1

0

1

2

−0.3

30 30

11.8

12.0

12.2

12.4

−2

53

−2

−1

0

1

2

Fitted values

Theoretical Quantiles

Scale−Location

18 30

Residuals vs Leverage

3

1 18

1.5

Standardized residuals

Standardized residuals

1.0

0.5

−1

0

1

2

53

0.5

−2

10 0.5 30

0.0

−3

Cook’s distance 0.00 0.05 0.10 0.15 0.20 0.25

1

11.8

12.0

12.2

12.4

Fitted values

Leverage

Figure 1.3: Diagnostic Plots for the regression model

PEt

=

log(ˆt ) − log(yt ) ≈ y 1 T

T

yt − yt ˆ yt

(1.5)

MAE =

|PEt |

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 but 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.

Prediction Error in Percent 0 −30 −20 −10

October 2007 November 2007 December 2007 January 2008 February 2008 March 2008 April 2008 May 2008 June 2008 July 2008 August 2008 September 2008 Model 0 (MAE = 9.49%) Model 1 (MAE = 9.22%)

CHAPTER 1. METHODOLOGY

Figure 1.4: Prediction Error Plot

5

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 ﬁgures 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. 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 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

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

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

**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.

273: Motorcycles

85000 40 2005 2006 2007 2008

75000

65000

**467: Auto Insurance
**

85000 0 2005 2006 2007 2008

75000

65000

**610: Trucks & SUVs
**

85000 Census Week One Week Two −5 −25 2005 2006 2007 2008 −15

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 ﬁt models from Section 1.2 to the data using 1 and 2 weeks of Google Trend data. The notation

65000

75000

−30

−20

−10

−20

0

20

CHAPTER 2. EXAMPLES x610,t refers to Google category 610 in week 1 of month t. Our estimated models are Model Model Model 0: 1: 2: log(yt ) = 1.158 + 0.269 · log(yt−1 ) + 0.628 · log(yt−12 ), et ∼ N (0, 0.052 )

(1) (1)

8

(2.1)

log(yt ) = 1.513 + 0.216 · log(yt−1 ) + 0.656 · log(yt−12 ) + 0.007 · x610,t , et ∼ N (0, 0.062 ) log(yt ) = 0.332 + 0.230 · log(yt−1 ) + 0.748 · log(yt−12 ) −0.001 · x273,t + 0.002 · x467,t + 0.004 · x610,t , et ∼ N (0, 0.052 ).

(2) (1) (1)

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’.

0 Prediction Error in Percent

−5

−10

−15

Model 0 (MAE = 7.02%) Model 1 (MAE = 5.96%) Model 2 (MAE = 5.73%) September 2008 February 2008 April 2008 November 2007 December 2007 October 2007 January 2008 August 2008 March 2008 May 2008 June 2008 July 2008

−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

9

2.2

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 ﬁrst 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 ﬁxed-eﬀects modeling approach. That is, we we assume that the short-term and seasonal lags are the same across all makes and that the diﬀerences in sales volume by make can be captured by an additive ﬁxed eﬀect.

Chevrolet

300000 300000

Chevrolet

Sales Google Trends

−20 −24

250000

Sales

200000

−32

Sales

150000

−36

2004

2005

2006

2007

2008

150000 2004

−40

200000

250000

−28

2005

2006

2007

2008

Time

Time

Toyota

45 200000 200000

Toyota

Sales Fitted

35 25

Sales

160000

Sales

15

120000

−5

2004

2005

2006

2007

2008

−15

120000 2004

160000

5

2005

2006

2007

2008

Time

Time

(a) Sales vs. Google Trends

(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 } 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 second to last week of the previous month(xi,t−1 ) to the ﬁrst 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 +0.002 · xi,t + 0.003 · xi,t − 0.001 · xi,t , ei,t ∼ N (0, 0.132 ).

(1) (2) (3) (3) (1) (k)

(2.2)

We can compare the ﬁxed eﬀects model to the separately estimated univariate models for each brand. In each of the separately estimated models case we ﬁnd a positive association with the relevant Google Trends index. Here are two examples. Chevrolet : Toyota : log(yi,t ) = 7.367 + 0.439 · log(yi,t−12 ) + 0.017 · xi,t , et ∼ N (0, 0.1142 ) log(yi,t ) = 4.124 + 0.655 · log(yi,t−12 ) + 0.003 · xi,t , et ∼ N (0, 0.0932 )

(2) (2)

(2.3)

Model (1.1) is ﬁtted 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 ﬁxed eﬀects model is that imposes the same seasonal eﬀects for each make. This may or may not be accurate. See, for example, the ﬁt 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 ﬁt with the mean absolute error falling from X to Y.

Prediction Error in Percent 0 10 0 5 −5 −20 −15 −10 −20 −10

Prediction Error in Percent

CHAPTER 2. EXAMPLES

September 2007 October 2007 November 2007 December 2007 January 2008 February 2008 March 2008 April 2008 May 2008 June 2008 July 2008 August 2008 February 2008 March 2008 April 2008 May 2008 June 2008 July 2008 August 2008 January 2008 December 2007 November 2007 October 2007

Model (1.1) (MAE = 6.18%) Model (2.2) (MAE = 5.41%) Model (2.3) (MAE = 6.31%) September 2007

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

(a) Chevrolet

(b) Toyota

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

11

CHAPTER 2. EXAMPLES

12

2.3

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 ﬁgures 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 for Real Estate Agencies is the best predictor for contemporaneous house sales.

1000 1100 1200 1300 1400

120

260000

240000

100

220000

80

900

700

200000

60

2003

2004

2005

2006

2007

2008

180000

2003

2004

2005

2006

2007

2008

(a) Number of New House Sold

(b) Prices of New House Sold

Figure 2.5: Number and Price of New House Sold

We ﬁt our model to seasonally adjusted sales ﬁgures, 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 ﬁtted to the data and Equation (2.5) shows the estimates of the

iii.

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

230000

Not Seasonally Adjusted Seasonally Adjusted

500

600

Median Sales Price Average Sales Price

40

250000

270000

800

290000

310000

330000

CHAPTER 2. EXAMPLES

96: Real Estate Agencies 378: Rental Listings & Referrals

13

20

1300

20

10

1100

10

0

900

0

−10

700

−10

−20

−30

2004

2005

2006

2007

2008

−30

Google Trends New House Sale

500

−20

2004

2005

2006

2007

2008

425: Property Management

463: Home Inspections & Appraisal

1300

20

1100

20

10

900

10

0

700

0

−10

−20

−10

Google Trends New House Sale 2004 2005 2006 2007 2008

500

2004

2005

2006

2007

2008

465: Home Insurance

−20

466: Home Financing

1300

1100

40

20

900

20

0

700

0

−20

Google Trends New House Sale 2004 2005 2006 2007 2008

500

−20

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. 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.

(1) (2)

500

700

900

1100

40

1300

60

500

700

900

1100

1300

30

30

500

700

900

1100

1300

CHAPTER 2. EXAMPLES

14

Seasonally Adjusted Annual Sales Rate in 1,000

600 2004

800

1000

1200

1400

2005

2006 Time

2007

2008

(a) Seasonally Adjusted Annual Sales Rate vs. Fitted

10 Prediction Error in Percent 5 0 −5 −10 −15

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

September 2007

November 2007

December 2007

February 2008

August 2007

October 2007

January 2008

April 2008

March 2008

May 2008

(b) 1 Step ahead Prediction Error

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

June 2008

July 2008

CHAPTER 2. EXAMPLES

15

2.4

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.

130000 45000 70000

USA

60 70 40000

Canada

110

Britain

5 10 15

2004 2005 2006 2007 2008

0 10 20 30 40 50 60 70 80 90

110000

60000

35000

40

50000

90000

20

30000

40000

25000

10

70000

−10

20000

30000

0

2004

2005

2006

2007

2008

2004

2005

2006

2007

2008

40

50

Germany

25000 25000 30

France

Italy

14000 12000 −15

2004 2005 2006 2007 2008

20

20000

20

30

40

20000

10000

10

10

0

15000

15000

−10

−10

8000

−20

−30

6000

10000

−30

10000

−50

4000

2004

2005

2006

2007

2008

2004

2005

2006

2007

2008

15000 20000 25000 30000 35000 40000 45000

70

Australia

60000

Japan

120000 130

India

100

2004 2005 2006 2007 2008

60

110

50

50000

40

10 20 30 40 50 60 70 80 90

90000 100000

30

20

40000

10

0

−20 −10

80000

30000

70000

2004

2005

2006

2007

2008

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

−20

0

20

40

60

80

120

−65

−55

−45

−35

0

−25

−45

−35

−25

−15

30

−5 0

50

CHAPTER 2. EXAMPLES analysis.

16

The foreign exchange rate deﬁned 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 traﬃc at July 2008 and August 2008 is expected to be lower than usual so we use dummy variable to adjust the traﬃc diﬀerence 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 diﬀer by country(Figure 2.8). Here we examine a ﬁxed eﬀects model. In Equation 2.6. ‘Countryi ’ is a dummy variable to indicate each country and the interaction with log(yi,t−12 ) captures the diﬀerent 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 signiﬁcant. Figure 2.9 shows the actual arrival statistics and ﬁtted values. The model ﬁts remarkably well with Adjusted R2 equal to 0.9875.

CHAPTER 2. EXAMPLES 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

17

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

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

**Table 2.2: Estimates from Model (2.6)
**

Note: Signif. codes: ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.10

130000

40000

45000

110000

35000

70000 80000 90000

30000

20000

25000

2005

2006

2007

2008

2005

2006

2007

2008

30000

40000

50000

60000

70000

USA

Canada

Britain

2005

2006

2007

2008

Germany

25000 25000

France

14000

Italy

20000

20000

15000

15000

2005

2006

2007

2008

10000

2005

2006

2007

2008

6000

2005

8000

10000

12000

2006

2007

2008

15000 20000 25000 30000 35000 40000 45000

Australia

60000 120000

Japan

India

Actual Fitted

40000

30000

2005

2006

2007

2008

90000

2005

100000

110000

50000

2006

2007

2008

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 ﬁtted visitor arrival statistics by country.

Chapter 3

Conclusion

We have found that simple seasonal AR models and ﬁxed-eﬀects 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 diﬃcult 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

- Hr_Exam2010V2AK
- Forecasting
- Educational Design Research
- Chapter 2;Forecasting
- Arimaы
- Brand
- Notes on Forecasting With Moving Averages--Robert Nau
- Forecasting Supply Planning.pdf
- LC 10 Forecasting
- Sales & Distribution Management
- 317(1)
- 2016 2
- p State 0705 Final
- Mima Tutorial
- Disse 2
- Demand Forecasting
- 1-s2.0-S1526612514000681-main
- Buckley Domalski1988 HeatingValue RDF
- Cpr
- 2 - The Forecaster's Toolbox-ClassNotes
- tugas agung
- Descriptive Statistics gelatin
- Are There Any Reliable Leading20130917123809
- Smith 1940 Specific Gravity Latex
- Predicting the Future Accounting Earnings Empirical Evidence From the Palestine Securities Exchange
- InTech-Effective Run in and Optimization of an Injection Molding Process
- unit-1 basic principles of measurements.pdf
- Yamijala Thesis
- Regression Tutorial 101 With NumXL
- Chapter 10

Skip carousel

- Business Statistics/Series-3-2010(Code3009)
- NBC News SurveyMonkey Toplines and Methodology 8 22-8 28
- NBC News SurveyMonkey Toplines and Methodology 7 25-731
- NBC News SurveyMonkey Toplines and Methodology 6 13-6 19
- NBC News SurveyMonkey Toplines and Methodology 7 18-724
- CBS News 2016 Battleground Tracker, Methods
- NBC News SurveyMonkey Toplines and Methodology 9 12 9 18
- Go p Race Survey Monkey Top Lines
- CBS News 2016 Battleground Tracker, Methods
- CBS News 2016 Battleground Tracker
- NBC-SM Nov Rep Primary Toplines Methodology ONLY 11.20.15
- CBS News 2016 Battleground Tracker
- CBS News 2016 Battleground Tracker, Methods
- CBS News 2016 Battleground Tracker, Methods
- NBC News SurveyMonkey Toplines and Methodology 7 11-7 17
- NBC News SurveyMonkey Toplines and Methodology 10.3-10.9
- NBC News|SurveyMonkey Weekly Election Tracking Poll
- CBS News 2016 Battleground Tracker, Methods
- NBC News SurveyMonkey Toplines and Methodology 8 8-8 14
- NBC News SurveyMonkey Toplines and Methodology 6 27-7 3
- NBC News SurveyMonkey Toplines and Methodology 8 1-8 7
- Business Statistics Level 3/series 3-2009
- Toplines Questions 1
- tmp39C
- tmp88BA.tmp
- 59947_1990-1994
- 59916_1985-1989
- SAJ_8_2011_26-37
- Rev Frbclev 1985q2
- NBC News SurveyMonkey Toplines and Methodology 8 8-8 14

- [Dutch] Raamwerk beveiliging webapplicaties, Govcert
- [Dutch] Sociale Netwerken en Privacy PI 2009 5
- Enisa Briefing
- [Dutch] 'Databases – Over ICT-beloftes, informatiehonger en digitale autonomie
- Opt-in Dystopias
- [Dutch] Scrapen
- Internet usage in 2009 in the European Union (statistics)
- Letter from Apple to US representatives Markey and Barton on its Location-based services, July 12, 2010
- State of the eUnion
- Facebook’s Response to Questions from the Data Inspectorate of Norway, september 2011
- An Analysis of Private Browsing Modes in Modern Browsers
- Enisa Cloud Computing Risk Assessment
- Hearing on The Collection and Use of Location Information for Commercial Purposes February 24, 2010
- Algorithmic Tools for Data-Oriented Law Enforcement (phd Thesis by Tim Cocx)
- [Dutch] DEFINITIEVE BEVINDINGEN
- Know Privacy Final Report
- [Dutch] Privacy & Internet
- [Dutch] Zoekmachines en de Wbp (Search engines and privacy legislation)
- Flash Cookies and privacy
- [Dutch] Krabbels en Respect Plz
- [Dutch] Roadmap voor Vertrouwen in de Informatiesamenleving
- Ambtenaar 2.0 artikel in personeelsblad CBP, september 2009
- Tailored Advertising (survey published sep 2009)
- [Dutch] Wieowie Enquete Rapport
- On the Anonymity of Home/Work Location Pairs
- Opinion on Online Social Networking by Working Party 29
- [Dutch] Alles onder controle?
- Study of MITM Attacks Against Smartphone Devices
- We Are All Here (Multiple Groups on a Social Network Site)
- Open Trust Frameworks for Open Gov 2009-08-10

Sign up to vote on this title

UsefulNot usefulRead Free for 30 Days

Cancel anytime.

Close Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Close Dialog## This title now requires a credit

Use one of your book credits to continue reading from where you left off, or restart the preview.

Loading