321k / Google-Trends

Main functions are in the file Google Trends functions.
25 stars 84 forks source link

Reindexing #3

Open paulfranz opened 8 years ago

paulfranz commented 8 years ago

The reindexing seems a little different to your other codes. Instead of calculating the adjustment factor by dividing daily through weekly, you did it the other way around. Furtermore I'm missing the part where you multiply the adjustment factor with the daily SVI. Could you explain it a little more?

mreeps commented 8 years ago

Erik,

I have a question about the results of the re-indexing as well. I tweaked your working example code to report on just Jan 2014 - Mar 2016 in the US for the term "cfa". In the attached screenshot you can see my R plot with the Google Trends output below it. The red line is the SVI column from your summary data frame. Seeing as it is the same data, it tracks with the Google Trends chart. The black line is the Reindexed column from summary, and it seems very different. There are a few giant spikes (>250) in it that do not correlate with the SVI and the other way around. Is this the expected behavior? screen shot 2016-04-03 at 8 23 48 am gt_trends.r.zip

321k commented 8 years ago

The spikes are expected behavior. It's a result of the daily series being a lot more volatile than weekly series. The main purpose of the reindexing is aligning the daily series with long term trends in the data that otherwise disappear. For a working example of the reindexing, check out this file: https://github.com/321k/Google-Trends/blob/master/Daily%20data%20example.R