Multi-Variate Time Series Forecasting (VAR Model)| Complete Python Tutorial

Ғылым және технология

In this tutorial i guide you through a multi-variate time series forecasting project. I implement the Vector Auto Regression(VAR) model in python. I cover:
1. Preparing data for time series analysis
2. Converting non-stationary data to stationary data
3. Running the granger causality test for vector auto regression
4. Visualizing your time series data
5. Using VAR class to find order of your time series
6. Forecasting into the future using the VARMAX class in python
Do subscribe to the channel and like the video if you want more videos like this!
Github Source Code: github.com/nachi-hebbar/Multi...
You can connect with me on my socials:
Linkedin: / nachiketa-hebbar-86186...
My 2nd KZread Channel: / @nachitalks
My medium account(I publish blogs here): / nachihebbar
Recommended Books to get better at Time Series Analysis and Python:
1)Practical Time Series Analysis: amzn.to/31lsLhq
2)Time Series with Python: amzn.to/2Ez073m
3)Hands-On Time Series Analysis with R: amzn.to/3aUxuKq

Пікірлер: 61

  • @maaleem90
    @maaleem90 Жыл бұрын

    Ah brother again. I don't know why but I think though there are many turtorials on KZread I landed on your channel the reason I think is that I admire you coz you look like my age, and when a person gets a someone form whom he can learn whose age is same of his then it's a great pleasure and admiration

  • @rawoofmohammed6377
    @rawoofmohammed6377 Жыл бұрын

    Excellent Brother!! Good Job you explained it very well :👏

  • @mihirnaik3383
    @mihirnaik33832 жыл бұрын

    Thanks Buddy, great content!

  • @junoli8294
    @junoli8294 Жыл бұрын

    Life saver. Your explanation and demonstration is way better than ChatGPT.

  • @shadrackdarku8613
    @shadrackdarku86132 жыл бұрын

    great content. very helpful

  • @kokoaphool
    @kokoaphool2 жыл бұрын

    Excellent content !!

  • @ajayrao4226
    @ajayrao42263 жыл бұрын

    Helpful, thanks for explaining each line

  • @NachiketaHebbar

    @NachiketaHebbar

    3 жыл бұрын

    you're welcome :)

  • @user-zs5cv4kk7h
    @user-zs5cv4kk7h2 жыл бұрын

    Fantastic Video. Have a fantastic day Nachiketa

  • @SannidhiPHebbar
    @SannidhiPHebbar Жыл бұрын

    This is very helpful. thanks for sharing the video

  • @pawankulkarni7634
    @pawankulkarni7634 Жыл бұрын

    Can you please include all variables and forecast the results with different forecasting algorithms. This one I found interesting. For multivariate forecasting can we use Arima ? I am newbie to forecasting. So any related help/ comment will be appreciated.

  • @jamesscott3045
    @jamesscott30452 жыл бұрын

    Great job man

  • @tanmaychess
    @tanmaychess2 жыл бұрын

    Brilliant bro!

  • @chandrahasminajigi7160
    @chandrahasminajigi71602 жыл бұрын

    Helpful video 🎉

  • @carlosequihua839
    @carlosequihua8392 жыл бұрын

    Excelentes videos nuevo seguidor :)

  • @brandyhorne1997
    @brandyhorne1997 Жыл бұрын

    This is great - and I like how you go through the code. I am new to Python - transitioning from R - and understanding "why" to code something a particular way can be difficult when someone doesn't explain it. So thank you!

  • @maaleem90

    @maaleem90

    Жыл бұрын

    Madam, if you don't mind answering my query. Iam aged 24 and learning data science . I learnt R but just some basic stuff. Iam more shifted towards python coz I thought in future i can be able to switch my career from data science to some core programming and with python I learnt ML and deep learning stuff . What do you advise me on this. Is it a good thought or I should also be learning more of R.

  • @khanm276
    @khanm2762 жыл бұрын

    Thanks, great stuff!

  • @NachiketaHebbar

    @NachiketaHebbar

    2 жыл бұрын

    Thanks!

  • @amansharma-hx3vv
    @amansharma-hx3vv2 жыл бұрын

    Really helpful 👍

  • @vengspachava1866
    @vengspachava18663 жыл бұрын

    Good....Informative

  • @Alfonso00MA
    @Alfonso00MA Жыл бұрын

    Great work

  • @bhavinmoriya9216
    @bhavinmoriya92162 жыл бұрын

    Thanks for the fantastic video. If I were to use all columns how would I apply granger causality?

  • @gjayadevan2
    @gjayadevan22 жыл бұрын

    brilliant!

  • @tagoreji2143
    @tagoreji21435 ай бұрын

    It was Simply Superb Bro 🙌. Also Nice Name 👍. Video with Detailed explanation of parameters would be Nice. Thank you

  • @rolind4717
    @rolind47172 жыл бұрын

    Love the parrots in the background! You could teach them to say AI, AI, AI.

  • @user-rr6dq3lg7k
    @user-rr6dq3lg7k Жыл бұрын

    Great video! I was wondering how you would test for white-nose residuals in the VAR vector error terms given that you got 4 lags to be optimal from AIC?

  • @thalesferraz
    @thalesferraz Жыл бұрын

    Thanks for sharing

  • @umairnazir5579
    @umairnazir557911 ай бұрын

    good work

  • @ravi2438
    @ravi2438 Жыл бұрын

    Pls some more on tutorial on multi variate forecasting ...time series. .like Dart , pycaret....thanks in advance...

  • @vidhyaa9169
    @vidhyaa9169 Жыл бұрын

    If the variables are of different scales , is it imperative to scale them all like you do for typical ML models ? Good video btw. Thanks.

  • @chaitrabellur8743
    @chaitrabellur87432 жыл бұрын

    Thanks dude

  • @subrahmanyamkesani7304
    @subrahmanyamkesani73042 жыл бұрын

    Hi, Nice video!!. I have a query. At 10:40, Why "train_df" is simply used in VARMAX() function instead of "train_df.df()[1:] " ? What is the role of "enfore_stationarity=True" ? does "enforce_stationarity=True" makes the model to calculate and select such a "p" value where sufficient stationarity is available ?

  • @shrutiiyyer2783
    @shrutiiyyer27832 ай бұрын

    Great explanation thanks, what about the p-values of each of the variables in the varmax model? I don't think all of those variables are significant from what I see in the summary of model fitting step.

  • @4h03min
    @4h03min Жыл бұрын

    감사합니다

  • @ars007bond
    @ars007bond2 жыл бұрын

    hey lovely video, i wanted to ask that in ad fuller test why u used print(realgdp/realcons) when i am using the same on other data set it is not working, please help.

  • @hanooltari
    @hanooltari2 жыл бұрын

    11:16 I have a question. so are the standard errors the values for all the residual error terms?

  • @SusmitaMelodies
    @SusmitaMelodies2 жыл бұрын

    Is it helpful for forecasting sales with multiple dependent variable?

  • @khaqim4148
    @khaqim41482 жыл бұрын

    How can I write equation/formula based on that model result?

  • @Vaibik
    @Vaibik11 ай бұрын

    Hi Nachiketa, Thanks for the nice tutorial. While trying to replicate the exact steps, I faced and error while using the VARMAX function at 11:00. { ValueError: Non-stationary starting autoregressive parameters found with `enforce_stationarity` set to True. } What could possibly be wrong? I even tried removing that optional parameter, but, of course, the same output. Another doubt: in the first cell, while importing libraries, we can ignore importing the "tqdm". Right? Thanks again.

  • @subrahmanyamkesani7304
    @subrahmanyamkesani73042 жыл бұрын

    Hii, at 12:48 of the video, what is happening when we did "predictions= predict.predicted_mean" ? Which variables are included in the mean calculation ?? Can anyone explain please..

  • @MC2121995
    @MC21219952 жыл бұрын

    the p-value of independent variables in VAR output seem high, is that a problem? I read some similar examples of VAR but no one actually talk about this issue

  • @agustinmatera9749
    @agustinmatera9749 Жыл бұрын

    TE AMO

  • @Itachi0567
    @Itachi05677 ай бұрын

    what happens if you have one dependent time series with an integration order of 1 and the independent time series has an order of integration of 2?, how do you perform the granger test in that case?, do you have to differentiate the dependent time series one more time ?

  • @gurglingstarfish6240
    @gurglingstarfish62402 жыл бұрын

    Hi! Can you show how to make VAR model in Exel? Pls

  • @akashsoni5697
    @akashsoni5697Ай бұрын

    What If we have Week instead of date column.... Can I use parse_date= 'Week'

  • @meghnareddi4540
    @meghnareddi45406 ай бұрын

    While using Adfuller, my Colab notebook seems to crash due to complete RAM consumption(12GB) in the basic version of Colab. Please suggest me a solution. Data size is 0.3M records, 18 columns.

  • @ishawaghulde-ph6yv
    @ishawaghulde-ph6yv3 ай бұрын

    hii i am facing error while running the select_order thing...... TypeError: loop of ufunc does not support argument 0 of type float which has no callable sqrt method.............please help unable to solve this error

  • @mohmmedshahrukh8450
    @mohmmedshahrukh8450 Жыл бұрын

    bro in prediction my year index column convert into numbers what need. to do please help

  • @SuperReddevil23
    @SuperReddevil23 Жыл бұрын

    RMSE for ULC was at 54. which is high, how do we get that value down.

  • @yukahiguchi2608
    @yukahiguchi2608 Жыл бұрын

    i don't get how he got the date to show up in the predictions column

  • @shadrackdarku8613
    @shadrackdarku86132 жыл бұрын

    hello at 8:28 why did you use the diff()[1:]? and not just the train_df ?

  • @marcosyamasaki

    @marcosyamasaki

    2 жыл бұрын

    I think it's because VAR() model needs stationary data, so when you do train_df.diff()[1:], make it stationary as he has shown in adfuller test. At 11:00 he explains about VARMAX() model, which with the parameter enforce_stationarity = True, make it easier since you don't need to provide the stationary data (which afterwards you'll need to invert the transformation), cause the model already transform your input data for you. You can do the classic way using the train_df.diff() as input of regressor model, but it'll take more lines to do the same thing as he did.

  • @gabrieldeluccavieira6938
    @gabrieldeluccavieira69389 ай бұрын

    5:43 so the dataset is stationary?

  • @issaczhang4209
    @issaczhang4209 Жыл бұрын

    In 7:20, can you explain again, does ulc cause rgnp? I don't get it.

  • @junoli8294

    @junoli8294

    Жыл бұрын

    ulc doesn't cause rgnp at lag 1, but does in lag 2, 3, and 4

  • @agustinmatera9749
    @agustinmatera9749 Жыл бұрын

    Y a ale tambien

  • @leelasaivoonna1728
    @leelasaivoonna17282 жыл бұрын

    Hey if your doing this with non stationary data and it came with good prediction, why doing stationary is necessary??

  • @xeiquespirwilliam2167

    @xeiquespirwilliam2167

    2 жыл бұрын

    Because of consistency. I mean, if your data isn't stationary, you can't build a wide and general model.

  • @leelasaivoonna1728

    @leelasaivoonna1728

    2 жыл бұрын

    @@xeiquespirwilliam2167 hey but what should we do for VARMAX how to know the Q value..

  • @xeiquespirwilliam2167

    @xeiquespirwilliam2167

    2 жыл бұрын

    ​@@leelasaivoonna1728 I'd ensure that the data is stationary before training the model. You can take the first difference and do ADF test to confirm that you're ok to go. And back to "why stationarity", these models like VAR and ARIMA have such a mean reversal behavior. The further your predictions go, the more it will look like a flat line. If your data isn't stationary, let's say it's incresing along time, the true data will take off to the roof while the predictions will stay in the middle, even if the short term perdictions, the generalization is affected.

Келесі