# How to discover/approximate the causations/correlations between multiple time-series and related open source libraries?

I have the following time-series data with two value columns.

(t: time, v1: time-series values 1, v2: time-series values 2)

 t | v1 | v2
---+----+----
1 |  1 |  0
2 |  2 |  2
3 |  3 |  4
4 |  3 |  6
5 |  3 |  6
6 |  4 |  6
7 |  5 |  8
(7 rows)


I am trying to discover (or approximate) the correlation between the $$v1$$ and $$v2$$, and use that approximation for the next step predictions.

Please note, the most obvious correlation is $$v2(t)=2.v1(t-1)$$.

My question is, what are the algorithms to employ for such approximations and are there any open source implementations of those algorithms for SQL/python/javascript?

I believe you may want to look at Autoregressive Models (AR) like ARMA models. Python has implementations of all AR models. Python statsmodels have all the necessary tools you may require.

The algorithm which is best to implement this problem is the hidden Markov model because hidden Markov model is best for generative sequence and openMarkov and also you can implement this in pytorch,jax,tenserflow(all are open source).

There are a number of algorithms that could be used for such approximations, including linear regression to learn the relationship between $$v1$$ and $$v2$$. You could then use that relationship to predict $$v2$$ for new values of $$v1$$., k-nearest neighbors, and support vector machines. There are also a number of open-source implementations of these algorithms available, including scikit-learn, Weka, and TensorFlow.