Is there a correlation between searches for “Formula E” and “Electric vehicles” on Google?
First we download a data files from Google Trends - us-searches, containing searches for the US only. I think this is the data used in the graphic shared.
# read in the US data
usSearches <- read.csv("raw_data/us-searches.csv")
names(usSearches) <- c("month", "fe", "electric")
# Let's take a quick look at the data
head(usSearches, 10)
## month fe electric
## 1 2004-01 5 27
## 2 2004-02 7 37
## 3 2004-03 9 39
## 4 2004-04 8 57
## 5 2004-05 13 72
## 6 2004-06 4 53
## 7 2004-07 3 37
## 8 2004-08 4 35
## 9 2004-09 10 39
## 10 2004-10 9 39
As you can see from the output above, we have a dataset containing 2 variables - “fe” (monthly search volumes for ‘Formula E’) and “electric” (monthly search volumes for ‘Electric Vehicles’). There are 157 observations in total, to cover the period from 2004 - date.
Now, we can use R to examine the correlation between our 2 variables.
# What is the correlation between the two searches?
cor.test(usSearches$fe, usSearches$electric)
##
## Pearson's product-moment correlation
##
## data: usSearches$fe and usSearches$electric
## t = -3.5988, df = 155, p-value = 0.0004295
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.4162292 -0.1265632
## sample estimates:
## cor
## -0.2776961
None, really. What we care about above is the final number output(-0.278), which tells us there’s a correlation of -0.278 between the two, suggesting that when searches for one term increase, searches for the other decrease.
# Filter the data to include only data after June 2014
recentUS <- usSearches %>% filter(month >= "2014-06-01")
# What is the correlation between the two searches?
cor.test(recentUS$fe, recentUS$electric)
##
## Pearson's product-moment correlation
##
## data: recentUS$fe and recentUS$electric
## t = 1.8912, df = 30, p-value = 0.06829
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.02518432 0.60609314
## sample estimates:
## cor
## 0.3263758
This time around, our correlation test tells us that the correlation is 0.326 (“medium”, according to Cohen’s rule of thumb). However, since the boundaries of our 95% confidence intervals include the number 0, we can’t say with any real confidence that the correlation is not 0.
TLDR: There does not appear to be any significant correlation between searches for Formula E and Electric vehicles.