How autocorrelation works

Поділитися
Вставка
  • Опубліковано 15 січ 2025

КОМЕНТАРІ • 130

  • @ranitdey7369
    @ranitdey7369 3 роки тому +5

    This is simply excellent. I haven't seen a better explanation of this concept.

  • @anighosh920
    @anighosh920 4 роки тому +9

    This is the best video ever on autocorrelation! Thank You!

  • @RashmiBanthia29
    @RashmiBanthia29 5 років тому +10

    Autocorrelation 7:02
    Partial Autocorrelation 9:45

  • @daesoolee1083
    @daesoolee1083 4 роки тому +1

    Woah, thank you, Sir. This short tutorial gets me to understand this entire auto-correlation thing than 10 page pdf explaining with all kinds of formulas .

  • @visualdad9453
    @visualdad9453 5 років тому +4

    One of the best videos about acf

  • @MrVishyG
    @MrVishyG 5 років тому +13

    Well explained! Very natural transition from topic to topic until I accidentally learned autocorrelation.

  • @joeaustinathimalamaria624
    @joeaustinathimalamaria624 5 років тому +2

    Came to revise Autocorrelation. Ended up revising regression too. Great video.

  • @moesaleh12
    @moesaleh12 6 років тому +1

    Nice and clear explanation. I will add at 4:30. That the points can fit the line very well but there is no correlation. It is the case when the fitted line is parallel to the x-axis or y-axis. It is the case of near zero variance variables.

  • @VictorGoncharov-ln1dp
    @VictorGoncharov-ln1dp 10 місяців тому +3

    Nice video, the best one I've seen yet about the concept of partial autocorrelation!

  • @bazoozoo1186
    @bazoozoo1186 6 років тому +1

    Brandon's videos deserve a lot more likes and views. Very underrated.

  • @Ikarus2985
    @Ikarus2985 3 роки тому +16

    And this is where the info on autocorrelation starts: 6:57

  • @valerianmp
    @valerianmp 6 років тому +4

    Thank you very much. This give the insight for ACF, not just mindlessly calculating them

  • @antuirno
    @antuirno 5 років тому +4

    The kind of explanation I was looking for! Thanks!!!

  • @yungrabobank4691
    @yungrabobank4691 4 роки тому +11

    Where you use the word "shift", when describing autocorrelations, wouldn't it be better to use the word "lag", as I've seen this appear in literature more often and am now wondering whether they're the same thing

    • @kapricun
      @kapricun 2 роки тому

      they are used interchangeably, as well as the word "delay"

  • @AbrahamSalazar210
    @AbrahamSalazar210 4 роки тому +1

    Excellent explanation with an easy-to-follow example!

  • @kshanepaswett261
    @kshanepaswett261 2 роки тому +4

    Thank you for existing.

  • @wexwexexort
    @wexwexexort 4 роки тому +4

    I watched this 2 years ago. Didn't understand the concept. I watch again in quarantine days.

  • @oliverbalbuenahernandez43
    @oliverbalbuenahernandez43 4 роки тому +3

    Best video on this topic. Thank you!

  • @checkpeck
    @checkpeck 6 років тому +2

    best explanation found till now

  • @1Bugatti1
    @1Bugatti1 3 роки тому +2

    Hello Brandon,
    thank you for the explanation. Especially the code helped to understand whats happening.

  • @RagibShahariar
    @RagibShahariar 4 роки тому +2

    I really liked the autocorrelation part!

  • @AONomad
    @AONomad 2 роки тому +2

    You covered regression better than videos on regression 👏

  • @S4KDK
    @S4KDK 6 років тому +1

    Great explanation with such a good example.
    Easy to understand too.
    Thanks!

  • @stephanie_ong
    @stephanie_ong 4 роки тому +2

    Great video! I liked how you presented the python code that would perform what you're explaining.

  • @mohammedalmarakby1221
    @mohammedalmarakby1221 Рік тому +3

    thanks for the great video, @4:57 should the greater than and smaller than signs be flipped in the moderate correlation plot ?

    • @BrandonRohrer
      @BrandonRohrer  Рік тому +1

      Thanks mohammed, you're exactly right :)

  • @DebatingDog
    @DebatingDog 5 років тому +2

    Instead of using list slicing it is a bit easier to use the "shift" method from the pandas library. The video in general is great :)

  • @m.raedallulu4166
    @m.raedallulu4166 2 роки тому +4

    Very nice demonstration!

  • @whenmathsmeetcoding1836
    @whenmathsmeetcoding1836 6 років тому +1

    this is best available in you tube thanks it was very helpful

  • @rodrigocarvalho6426
    @rodrigocarvalho6426 5 років тому +1

    Very good video. In Numerical Methods it always helps to visualise what you are doing

  • @alexeykokh8240
    @alexeykokh8240 6 років тому +1

    Cool description, very detailed, with lots of graphs

  • @syd_rawat
    @syd_rawat 4 роки тому +2

    Brendon, I would so love to learn ML from you. teaching code along with concept would definitely decrease the MSE between ignorance and knowledge. Thanks

    • @BrandonRohrer
      @BrandonRohrer  4 роки тому +1

      Thanks Siddarth! In case you're interested, there's a whole collection of concept-with-code courses at e2eml.school/catalog

  • @AnkitGupta-zk6pz
    @AnkitGupta-zk6pz Рік тому +4

    Great explanation, Thank you.

  • @niveyoga3242
    @niveyoga3242 4 роки тому +1

    This was explained excellently!

  • @carlosnavarro9588
    @carlosnavarro9588 3 роки тому +3

    Amazing explanation, subscribed!

  • @ruthgerrighart1669
    @ruthgerrighart1669 6 років тому +2

    Very nice and clear video!

  • @leonsponzoni
    @leonsponzoni 6 років тому

    Auto correlation sounds useful for finding data cycles. Like every year temperature correlation, around ~365 days shift~, there is probably a max again. You can find cycles in shifts where correlations peak.
    Also thanks for showing how it can be refined the same way as tailor series. Didn't cross-concept that correlation can give differentials weight for interpolation.

  • @mohammedsaeed7241
    @mohammedsaeed7241 2 роки тому +2

    Amazing video, but the autocorrelation loop contains a bug. for shift in range(10) will start from zero, and when you temp[ : -0] you will get an empty array, and your code won't work, because you will do a corrcoef of an empty matrix with another that contains data, thus, the correct loop will be something like: for shift in range(1,10)...thanks a lot for the vid

  • @alteshaus3149
    @alteshaus3149 3 роки тому +1

    Very clearly explained!
    Great video

  • @Patapom3
    @Patapom3 6 років тому

    Another great and super clear explanation! Thanks.

  • @bulletkip
    @bulletkip 6 років тому +3

    fantastic explanation

  • @everything_is_on_fire3155
    @everything_is_on_fire3155 5 років тому +1

    Really helpfull
    And straight forward
    U r genius man

  • @yungrabobank4691
    @yungrabobank4691 4 роки тому +2

    Excellent explanation, thank you!

  • @pv1234567890pv
    @pv1234567890pv 3 роки тому +1

    Amazing video! Very useful. Thanks!

  • @silentsnooc
    @silentsnooc 6 років тому +3

    Hi! Great video but there is an error at 5:24 - The correlation is not negative if just the slope of the line is negative. Correlation is negative if the data points and the line have converse slopes.
    %matplotlib inline # JuPyter Notebooks
    import matplotlib.pyplot as plt
    import numpy as np
    n = 10
    x = -np.linspace(0, 1, n)
    y = x + (0.3 * np.random.rand(n)) - 0.3/2
    neg = np.corrcoef(x, y)[0, 1]
    plt.plot(y, marker='o', markersize=4, ls='None', c='k')
    plt.plot(x, label='negative ({:.2f})'.format(neg), c='r')
    plt.legend(); plt.show()

    • @mankindh9183
      @mankindh9183 6 років тому +1

      No error there, video is correct. you are plotting x and y independently on the same plot, not y against x. correct code should be:
      plt.plot(x,y)

  • @cypherecon5989
    @cypherecon5989 2 роки тому +2

    temp_change is not defined in your code is it? Something is missing there.

  • @Tom-qk4jq
    @Tom-qk4jq 3 роки тому +2

    really helpful video, thank you for this

  • @IslandRai
    @IslandRai 5 років тому +1

    Good job on this video!
    I wish it would have showed up when I searched for information on ARIMA, all the ones that did were pretty poor.

  • @nirjhorchakraborty1861
    @nirjhorchakraborty1861 3 роки тому +1

    Stellar explanation!

  • @armitosmt5753
    @armitosmt5753 5 років тому +9

    Sounds like George Clooney explains it

  • @carbon273
    @carbon273 4 роки тому +1

    Intuitively, how does one gather the data for the temperature scatter plot for autocorrelation? This is my only stumbling block.

    • @BrandonRohrer
      @BrandonRohrer  4 роки тому

      To see a detailed example in practice (including step-by-step data collection and organization), check out e2eML course 212: e2eml.school/212

  • @romellfudi
    @romellfudi 6 років тому +3

    Thanks a lot, view the code helpful to understand quickly

  • @brandonp3991
    @brandonp3991 3 роки тому +1

    This is amazing, thank you

  • @ferozshahquriashi3021
    @ferozshahquriashi3021 4 роки тому +8

    Close your eyes and you can hear Matthew McConaughey explaining autocorrelation. The only thing missing in here "Alright, alright, alright"

    • @xenonmob
      @xenonmob 10 місяців тому +3

      he literally sounds nothing like him

    • @mikel27180
      @mikel27180 3 місяці тому

      No

  • @Considerationhhh
    @Considerationhhh 5 років тому +1

    nice and concise video!!

  • @stepover12
    @stepover12 5 років тому

    I think you might be conflating 2 different concepts: 1. de-trending the timeseries before forecasting with AR, 2. partial auto-correlation.
    For example the first de-trending step may not be just fitting a straight line, it could be non-linear or have seasonality etc. This is unrelated to PACF which teases out what marginally new information are gained with each auto-correlation step

  • @sohailhosseini2266
    @sohailhosseini2266 2 роки тому +1

    Thanks for the video!

  • @Alexander-pk1tu
    @Alexander-pk1tu 3 роки тому +1

    very good video!! Thank you

  • @tariqahassan5692
    @tariqahassan5692 Рік тому +1

    Very very nice explain .. many thanks

  • @TheAmolchavan
    @TheAmolchavan 4 роки тому

    I was looking for good video to understand the concepts and this video has done that. I have the following questions:
    - Can we do correlation to compare stock market bottoms or tops? If we compare the market price by its 1 day 1 week prior price then will this help in prediction of top or bottom?
    - How can we compare two asset prices? I am thinking of below methods
    - Do a ratio of two asset prices and run the n-1 vs n comparison of the ratio
    - Do a ratio of two asset prices and compare the ratio vs one of the asset prices
    - Compare the % return of each assets against each other on X and Y axis
    Let me know what do you think

  • @Mark_Isaiah
    @Mark_Isaiah 4 роки тому

    do you know how to do a white noise time series to test for seasonality?

  • @KAUSHALRMODI
    @KAUSHALRMODI 2 роки тому

    In partial autocorrelation, the graph for shift 2 is incorrect, it has to show the points tilted along the 1st fit.

  • @matthiasrichter9264
    @matthiasrichter9264 6 років тому

    Very nice and explanatory video! Thanks! One thing that you could also do is mention real-world applications. A toy model is always very helpful for me to *understand* a topic but real-world application helps me to also *motivate* it.
    Besides that keep it up your videos are super nice! :)

    • @dribblersmy
      @dribblersmy 6 років тому

      I am also currently learning so I'm not sure if my idea is entirely correct, you could use this for any data set, to see how it changes. You could use the auto-correlation on gas prices to see how it changes with time, on flight tickets to see how it changes on a day to day basis or even on the price of a big mac to see how it has changed over the years.

  • @neelabhchoudhary2063
    @neelabhchoudhary2063 7 місяців тому +1

    this was super helpful

  • @PikesCore24
    @PikesCore24 4 роки тому +1

    What is the payoff of all this autocorrelation stuff? Once you have fit the data to the line and calculated the correlation, it seems like that is the all the useful information. I can't see where the autocorrelation ads information that would be useful.

    • @sebastianliendo6579
      @sebastianliendo6579 4 роки тому

      Autocorrelation helps understand seasonality/periodicity in time series data, which can determine when will a value repeat itself in the future. A high autocorrelation means the selected shift/lag is likely to be the period; and instead of guessing which lag value will yield a high autocorrelation, we can checkout something called the correlogram. This can be useful, as sometimes the time series has both a trend and seasonality, and the correlogram decomposes it (sort of).

  • @Arthur-nf9dm
    @Arthur-nf9dm 4 роки тому +1

    Is the autocorrelation with zero lag always 1? Because I've read that Gauss-Markov processes have the following equation for autocorrelation:
    autocorrelation(lag) = variance*exp(-constant*lag)
    In the case of this formula, autocorrelation(0)=variance (!!!) why is it different in this case?

    • @eloboa5355
      @eloboa5355 4 роки тому +2

      no question about this. with no lag, you're basically computing the correlation of a variable with itself. Any algorithm that gives you something different than 1 in this case simply fallacious.

  • @BM-uf4pp
    @BM-uf4pp 3 роки тому +1

    great video man

  • @Hank-ry9bz
    @Hank-ry9bz 4 місяці тому +1

    7:00 autocorr

  • @anindadatta164
    @anindadatta164 4 роки тому

    It is not clear in the video how much residual of the previous periods to be added to the time series equation of the present period.

  • @JagoBridgland
    @JagoBridgland 4 роки тому +1

    im confused! So when you talk about correlating the shifted (lagged) dataset. Lets say in an AR(1) process you shift the Y values by 1 day, does that mean the Y-1 dataset will have 1 less data point than the original Y dataset? And by extension if you specify an AR(10) process are you then knocking off 10 data points and hence correlating two datasets where one dataset has 10 less data points than the other?
    Sorry if i explained that like a moron, maybe this will help:
    let's say
    y = [1,2,3,4,5,6,7,8,9,10]
    y-1 = [1,2,3,4,5,6,7,8,9]
    y-2 = [1,2,3,4,5,6,7,8]
    y-3 = [1,2,3,4,5,6,7]
    y-n = [.........]
    so for example if i'm interested in specifying an AR(3) process, to determine the autocorrelation would i just find the correlation coefficient between y & y-3:
    y = [1,2,3,4,5,6,7,8,9,10]
    y-3 = [1,2,3,4,5,6,7]
    i am confused as to whether the fact you are correlating a [1,10) with a [1,7] is correct? or an issue? or what!
    sorry this was really long!

    • @dhirendrasingh7379
      @dhirendrasingh7379 4 роки тому +1

      yes .
      Think of it like this , when you are using a lag of 1 , you are comparing every day value to its previous day value therefore automatically for day 1 you won't have anything to compare it to. But it doesn't matter , the data points left are enough to give an accurate correlation value.

    • @JagoBridgland
      @JagoBridgland 4 роки тому +1

      Dhirendra Singh amazing, thanks so much for the response. I have since experimented with some data and it makes much more sense now! Cheers mate

  • @alimahmood4158
    @alimahmood4158 5 років тому

    can i have the data sample sir on the basis of which you are calculating thanks

  • @pypypy4228
    @pypypy4228 5 місяців тому

    I like it! Thank you!

  • @gagnon124
    @gagnon124 3 роки тому +1

    great video

  • @rezaulkarimmamun6211
    @rezaulkarimmamun6211 5 років тому +1

    How to compare two voice signal similarity in python?

  • @anaskhan4841
    @anaskhan4841 2 роки тому +1

    Great Video

  • @darmstadtvideo
    @darmstadtvideo 5 років тому +1

    nice and clear explanation for this useful concept! for me its just not clear how to determine whether or not a value is still whithin the 95% confidence interval? R is giving some limits but there it remains unclear as well how to calculate those boundaries..

    • @BrandonRohrer
      @BrandonRohrer  5 років тому

      Thanks darmastadvideo! This is important, but unfortunately didn't make it into this video. I'll have to save it for a future one.

  • @totochandelier
    @totochandelier 6 років тому +1

    Thanks a lot!

  • @ishan7975
    @ishan7975 4 роки тому +1

    wonderful!

  • @zagwask78
    @zagwask78 2 роки тому +2

    The graph at 10:46 and the graph at 10:52 are the same but the x-axis is labeled differently. Which is accurate?

    • @zagwask78
      @zagwask78 2 роки тому

      And does the correlation coefficient, r, from the regression performed on the graph at 11:02 give you the point on the PACF (2, r)? And the graph at the right I'm confused by. If you are regressing the series with lag 2 against itself it would be a perfect fit. Why are there residuals at all?

    • @keek1337
      @keek1337 Рік тому

      @@zagwask78 doesn’t answer questions, sad :(

  • @thechhavibansal
    @thechhavibansal 3 роки тому +1

    Thank you :)

  • @dnyanadaarjunwadkar7441
    @dnyanadaarjunwadkar7441 6 років тому

    This is great. Thanks

  • @anindadatta164
    @anindadatta164 4 роки тому

    If in the time series , the residuals on temperatures day i after fiting temp(i-1) are correlated with actual temperatures of day i , then can it be said the there is partial auto correlation with lag beyond (i-1). If that method holds good ,then it could be much easier method of detecting PACF.
    But I have liked your video also.

  • @dribblersmy
    @dribblersmy 6 років тому +1

    Thank you! :D

  • @bilalkarsl671
    @bilalkarsl671 4 роки тому +1

    THANK YOU

  • @alirezafarhadizadeh5674
    @alirezafarhadizadeh5674 3 роки тому

    Excellent

  • @marlonzapata5429
    @marlonzapata5429 3 роки тому +2

    Damn. So mf nice!!! 10 stars

    • @BrandonRohrer
      @BrandonRohrer  3 роки тому +1

      Aw, thanks Marlon. I'm really happy it clicked.

  • @Lyndanet
    @Lyndanet 3 роки тому +1

    Appreciated

  • @pigrebanto
    @pigrebanto 6 років тому +1

    good but i think the way you represent the days shift in the code using [1:] and [:-1] is wrong (i do not get the meaning) or please explain what you meant. tks

    • @cetrusbr
      @cetrusbr 6 років тому +2

      It isn't wrong, its just python notation to slice a array. Just google it :)

  • @VY-zt3ph
    @VY-zt3ph 5 років тому +3

    Give this video a like

  • @zeracyb3318
    @zeracyb3318 6 років тому

    Thanks !

  • @ShiyanAkalankaJayanath
    @ShiyanAkalankaJayanath Рік тому +1

    Nice

  • @zoozolplexOne
    @zoozolplexOne 3 роки тому +1

    cool !!!

  • @Machinesh
    @Machinesh 2 роки тому +1

    👏

  • @astherphoenix9648
    @astherphoenix9648 2 роки тому

    6:48 you'll pull off??

  • @typicalidealist9138
    @typicalidealist9138 Рік тому

    🤓

  • @chrisidema
    @chrisidema 11 місяців тому

    "degrees" is not a unit

    • @nexyboye5111
      @nexyboye5111 7 місяців тому +1

      a degree is a dimensionless unit of measurement

  • @charbelhamouche8016
    @charbelhamouche8016 6 років тому

    Bad

  • @parthagarwal4592
    @parthagarwal4592 3 роки тому

    Poor Explanation

  • @timetraveller3647
    @timetraveller3647 6 років тому +1

    Thank you!

  • @omaramil5103
    @omaramil5103 Рік тому +2

    Wow thank you

  • @andrewluo6598
    @andrewluo6598 5 місяців тому

    Thanks!