Skip to main content
1 of 2
LiKao
  • 2.7k
  • 1
  • 21
  • 25

While your idea might give you some initial indication about a relationship, there is a lot to be careful about here:

  1. Stock prices (just like any time series) often depend on the stock price on the previous day. So if you leave out this variable, you are leaving out a lot of information of your model that should be in there. Essentially putting in stock prices from previous days is a common method in time series modeling (have a look at AR and ARIMA models).
  2. There may be some lack between the number of searches and the time it takes for those to affect the stock prices. So if you just put in the search data at day X and the stock price on the same day, you are limiting your model to strongly. It is better to also include number of searches on previous days.
  3. The more previous days you include, the more your model is bound to also give false positive results. You should include some method to constrain the influence of previous days (intuitively: the longer back the search data, the less likely it is to influence the stock prices). You can either do this in a Bayesian setting (set more constrained priors to previous data) or by using L1 or L2 regularization (with higher regularization the further back the data is taken).
  4. There are a number of packets you could use. Here is one in pymc3. You can find more examples here, under "time series".
LiKao
  • 2.7k
  • 1
  • 21
  • 25