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

Sdílet
Vložit
  • čas přidán 10. 07. 2021
  • 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 CZcams 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
  • Věda a technologie

Komentáře • 65

  • @maaleem90
    @maaleem90 Před rokem +1

    Ah brother again. I don't know why but I think though there are many turtorials on CZcams 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

  • @junoli8294
    @junoli8294 Před rokem +1

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

  • @rawoofmohammed6377
    @rawoofmohammed6377 Před 2 lety +1

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

  • @pawankulkarni7634
    @pawankulkarni7634 Před rokem +10

    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.

  • @shadrackdarku8613
    @shadrackdarku8613 Před 2 lety +1

    great content. very helpful

  • @user-zs5cv4kk7h
    @user-zs5cv4kk7h Před 2 lety

    Fantastic Video. Have a fantastic day Nachiketa

  • @mihirnaik3383
    @mihirnaik3383 Před 2 lety

    Thanks Buddy, great content!

  • @SannidhiPHebbar
    @SannidhiPHebbar Před rokem

    This is very helpful. thanks for sharing the video

  • @ajayrao4226
    @ajayrao4226 Před 3 lety +2

    Helpful, thanks for explaining each line

  • @harshraj.a134
    @harshraj.a134 Před 24 dny

    this playlist is gonna be a great help for my interview today amazing content brother

  • @kokoaphool
    @kokoaphool Před 2 lety

    Excellent content !!

  • @brandyhorne1997
    @brandyhorne1997 Před rokem +2

    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 Před rokem

      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.

  • @chandrahasminajigi7160
    @chandrahasminajigi7160 Před 2 lety +1

    Helpful video 🎉

  • @hanooltari
    @hanooltari Před 2 lety +1

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

  • @ars007bond
    @ars007bond Před 2 lety

    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.

  • @vengspachava1866
    @vengspachava1866 Před 3 lety

    Good....Informative

  • @bhavinmoriya9216
    @bhavinmoriya9216 Před 2 lety +3

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

  • @user-rr6dq3lg7k
    @user-rr6dq3lg7k Před rokem

    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?

  • @amansharma-hx3vv
    @amansharma-hx3vv Před 2 lety

    Really helpful 👍

  • @jamesscott3045
    @jamesscott3045 Před 2 lety +1

    Great job man

  • @tagoreji2143
    @tagoreji2143 Před 6 měsíci

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

  • @Alfonso00MA
    @Alfonso00MA Před rokem

    Great work

  • @umairnazir5579
    @umairnazir5579 Před rokem

    good work

  • @gjayadevan2
    @gjayadevan2 Před 3 lety +1

    brilliant!

  • @tanmaychess
    @tanmaychess Před 2 lety

    Brilliant bro!

  • @subrahmanyamkesani7304

    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..

  • @subrahmanyamkesani7304
    @subrahmanyamkesani7304 Před 2 lety +2

    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 ?

  • @SusmitaMelodies
    @SusmitaMelodies Před 2 lety +1

    Is it helpful for forecasting sales with multiple dependent variable?

  • @carlosequihua839
    @carlosequihua839 Před 2 lety

    Excelentes videos nuevo seguidor :)

  • @khaqim4148
    @khaqim4148 Před 2 lety +2

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

  • @MC2121995
    @MC2121995 Před 2 lety

    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

  • @thalesferraz
    @thalesferraz Před rokem

    Thanks for sharing

  • @rolind4717
    @rolind4717 Před 2 lety

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

  • @mohmmedshahrukh8450
    @mohmmedshahrukh8450 Před rokem

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

  • @khanm276
    @khanm276 Před 2 lety

    Thanks, great stuff!

  • @Itachi0567
    @Itachi0567 Před 8 měsíci

    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 ?

  • @4h03min
    @4h03min Před rokem

    감사합니다

  • @Vaibik
    @Vaibik Před rokem

    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.

  • @chaitrabellur8743
    @chaitrabellur8743 Před 2 lety

    Thanks dude

  • @vidhyaa9169
    @vidhyaa9169 Před rokem +1

    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.

  • @shrutiiyyer2783
    @shrutiiyyer2783 Před 3 měsíci

    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.

  • @SuperReddevil23
    @SuperReddevil23 Před rokem

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

  • @meghnareddi4540
    @meghnareddi4540 Před 8 měsíci

    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.

  • @akashsoni5697
    @akashsoni5697 Před 2 měsíci

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

  • @ravi2438
    @ravi2438 Před rokem +1

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

  • @gabrieldeluccavieira6938
    @gabrieldeluccavieira6938 Před 11 měsíci

    5:43 so the dataset is stationary?

  • @abhirajarora7631
    @abhirajarora7631 Před 3 dny

    You checked for stationarity but you didn't use it during Granger Testing? Aren't you supposed to use the differenced series in the testing?

  • @ishawaghulde-ph6yv
    @ishawaghulde-ph6yv Před 4 měsíci

    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

  • @shadrackdarku8613
    @shadrackdarku8613 Před 2 lety

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

    • @marcosyamasaki
      @marcosyamasaki Před 2 lety

      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.

  • @yukahiguchi2608
    @yukahiguchi2608 Před rokem

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

  • @gurglingstarfish6240
    @gurglingstarfish6240 Před 3 lety

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

  • @agustinmatera9749
    @agustinmatera9749 Před rokem

    TE AMO

  • @issaczhang4209
    @issaczhang4209 Před 2 lety

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

    • @junoli8294
      @junoli8294 Před rokem

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

  • @leelasaivoonna1728
    @leelasaivoonna1728 Před 3 lety

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

    • @xeiquespirwilliam2167
      @xeiquespirwilliam2167 Před 3 lety +1

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

    • @leelasaivoonna1728
      @leelasaivoonna1728 Před 3 lety

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

    • @xeiquespirwilliam2167
      @xeiquespirwilliam2167 Před 3 lety

      ​@@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.

  • @agustinmatera9749
    @agustinmatera9749 Před rokem

    Y a ale tambien

  • @abhirajarora7631
    @abhirajarora7631 Před 4 dny

    Not 'cause', it's 'granger cause', please correct yourself