# Algorithm for Multivariable timeseries prediction (COVID forecast)

I am trying to forecast tomorrow's COVID-19 cases in my country. I tried a simple Linear Regression implementation based on the "new_positives" field but it does not work very well. I had the idea to combine multiple variables in the COVID dataset to predict tomorrow values, the model will train in a multivariate dataset in order to predict 1 value (tomorrow positives). $$(newCases,tampons, ...) \xrightarrow{\text{Predict}} (newCases)$$

$$R^{fields * entries} \rightarrow R^{1*1}$$ Is this possible? Which algorithm should i use?

I've read that one may use VAR prediction or LSTM Cells but i can't find any implementations. As language i'm using python.

Thank you.

I think that you will find linear regression good enough for your purposes. You may like to try transforming the response variable with a log function to see if that increases your accuracy.

I'm assuming that you have the impression that linear regression can only work with one x variable and one y variable. This is not the case. Linear regression as is can take in as many explanatory variables as you like.

I've written some Python using numpy to perform some simple linear regression with an intercept and two x attributes:

import numpy as np

X = np.array([[1,1,1,1,1,1], [1,2,3,4,5,6], [3,2,3,4,3,5]]).T
y = np.array([5, 20, 14, 32, 22, 38])

# coefficients
b = np.linalg.inv(X.T @ X) @ X.T @ y

# new prediction
np.array([[1], [4], [3]]).T @ b


Hope you find this useful!

• Thank you :) i'm using a multivariate regression as you explained but i would like to know if there are more "advanced" methods that can produce some more accurate results. Oct 18, 2020 at 10:34
• Certainly, you could use any old neural network implementation from sklearn to PyTorch and Tensorflow Oct 18, 2020 at 23:11