Sunday, December 07, 2014

Creating daily search volume data from weekly and daily data

Risteski & Davcev (2014) refers to my method for getting Google Trends data for more than 90 days in their recent paper. For those interested, I've outlined the key principle in this post.

This post illustrates a method for combining daily and weekly search data from Google Trends in order to create a daily time series for over a period longer than the 90 days of daily data provided by Google Trends. For the sake of simplicity, I have only included two weeks, but the general principle can easily be extended to longer time series. SVI in the tables refers to Google Trends' search volume index.

For an example of how this can be done using R, look here.

Step 1: Collect daily search data from Google Trends and combine it into one array.

Date Daily SVI
1.1.2014 72
2.1.2014 96
3.1.2014 16
4.1.2014 70
5.1.2014 61
6.1.2014 97
7.1.2014 44
8.1.2014 32
9.1.2014 8
10.1.2014 13
11.1.2014 67
12.1.2014 9
13.1.2014 63
14.1.2014 91

Step 2: Collect weekly search data over the same time period

Date Daily SVI Weekly SVI
1.1.2014 72 20
2.1.2014 96
3.1.2014 16
4.1.2014 70
5.1.2014 61
6.1.2014 97
7.1.2014 44
8.1.2014 32 30
9.1.2014 8
10.1.2014 13
11.1.2014 67
12.1.2014 9
13.1.2014 63
14.1.2014 91

Step 3: Adjust the daily data based on the weekly data

The key here is the adjustment factor. It is the weekly SVI divided by the daily SVI for those dates where there are values for both. For other data points, the last available adjustment factor is applied.

Date Daily SVI Weekly SVI Adjustment factor Adjusted values
1.1.2014 72 20 0,3 20,0
2.1.2014 96 0,3 26,7
3.1.2014 16 0,3 4,4
4.1.2014 70 0,3 19,4
5.1.2014 61 0,3 16,9
6.1.2014 97 0,3 26,9
7.1.2014 44 0,3 12,2
8.1.2014 32 30 0,9 30,0
9.1.2014 8 0,9 7,5
10.1.2014 13 0,9 12,2
11.1.2014 67 0,9 62,8
12.1.2014 9 0,9 8,4
13.1.2014 63 0,9 59,1
14.1.2014 91 0,9 85,3

Time series plot

As can be seen from the graph below, the inter-week changes remain the same, but is adjusted down or up based on the weekly search volumes. This way, the relative volumes between weeks is unchanged and the data is comparable over periods longer than the 90 days provided by Google Trends.

Data artifacts in daily Google Trends data

An important consideration when merging daily Google Trends data together is that the first and last day of a month sometime are shown as zero in the data. This can create serious inconsistencies in the data, as we cannot make a percentage adjustment to zero values. To account for this, I recommend that the the first and last 30 days from the time series is stripped out before merging the data.

To illustrate the issue, I've copied the daily Google Trends data for the search term "CAC40" below. The value for 1 January 2014 is zero in the upper graph, while it's 77 in the upper graph.

January - February 2014


December 2013 - February 2014



David Leinweber writes more on the topic here.

9 comments:

Unknown said...

Hi Erik

When I use this method, I get values over 100. Do I need to normalize these again?

THnX :)

ErikJJ said...

No, that's expected. Nothing to worry about. If you want to rescale your numbers so that 100 is max, simply divide all by the largest and multiply by 100.

Anonymous said...

Hi Erik. Great post and great idea To use the weekly data together with the daily data.

I wonder though what the rationale behind dividing by the daily score of the day for which the weekly data is presented.
This boils down to what the weekly value is -
If it is a daily volume, provided for one day each week - then adjusting by that day only makes sense to me,

If, however, the weekly data provided by Google represents the total search volume of that week (in some relative way...),
Then it would make more sense to me to adjust each daily value as follows:

adjusted_daily_score = (original_daily_score / sum_of_original_scores_for_the_week) * weekly_value

Thanks!
Michael

Unknown said...

Hi,

I wanted this data on minute level. Could you help me attain this. What are the changes has to do in the code.

Thanks
Prakash Anand

Unknown said...

Hi, Erik. Thank you very much for the post!

I have just one little doubt: in the example you gave to calculate the factor, are you sure that the Weekly SVI of 20 should be associated to the first (and not to the last) day of the week?

Best regards
Marcelo Guzella

Unknown said...

thanks for sharing us this informative article
people can visit this site for famous celebrities life story
https://www.wrixtech.com/

Elizabeth said...

I was so anxiuos to know what my husband was always doing late outside the house so i started contacting hackers and was scamed severly until i almost gave up then i contacted this one hacker and he delivered a good job showing evidences i needed from the apps on his phone like whatsapp,facebook,instagram and others and i went ahead to file my divorce papers with the evidences i got,He also went ahead to get me back some of my lost money i sent to those other fake hackers,every dollar i spent on these jobs was worth it.Contact him so he also help you.
mail: premiumhackservices@gmail.com
text or call +1 4016006790

charles said...

You need personal informations from companies,family and friends that will better your life and you need easy access without them noticing just contact nick or you’re financially unstable or you have a bad credit score, he will solve that without stress,he and his team can clear criminal records without leaving a trace and can also anonymously credit your empty credit cards with funds you need,all these are not done free obviously but I like working with nick and his team cause they keep you updated on every step taken in order to achieve the goal and they also deliver on time,I tested and confirmed this I’m still happy on how my life is improving after my encounter with him ,you can send a mail to vladislav.nickhack@outlook.com
Text/Call +17078685071

Rebecca Michaelson said...

HELLO VIEWERS

TESTIMONY ON HOW I GOT MY LOAN €300,000.00EURO FROM A FINANCE COMPANY LAST WEEK Email for immediate response: drbenjaminfinance@gmail.com

Do you need a loan to start a business or pay your debts {Dr.Benjamin Scarlett Owen} can also help you with a legit loan offer. He Has also helped some other colleagues of mine with a loan finance. Get your Blank ATM card or CREDIT CARD deliver to your doorstep that works in all ATM machines all over the world with the help of BENJAMIN LOAN FINANCE the ATM cards can be used to withdraw at the ATM Machines or swipe, at stores and POS. they give out this cards to all interested clients worldwide, If you need a loan without cost/stress he his the right loan lender to wipe away your financial problems and crisis today. BENJAMIN LOAN FINANCE holds all of the information about how to obtain money quickly and painlessly via Email drbenjaminfinance@gmail.com

Entertaining Blogs - BlogCatalog Blog Directory
Bloggtoppen.se