WHT

Arima Forecast | Time Series Talk : Arima Model

Ritvikmath

Subscribe Here

Likes

1,888

Views

106,843

Time Series Talk : Arima Model

Transcript:

All right, in this video, We’ll be talking about a model in time. Series analysis called the Arima model. Now you probably recognize most of these letters. Specifically, the AR and the MA as the autoregressive moving average model. The only question is, what is this? I doing here and we’ll see what it stands for and why you would use it and when you would use it, okay, so first, let’s set up the situation. Let’s say you are a salesman of anchors. So the anchors you put on boats to keep them stationary at some point in the ocean, okay, and the number of anchors you sell every month is given by some variable a sub T so T being the month or the time period you’re in, and I’ll say it’s in thousands, for example, so let’s say you want to do a prediction of how many anchors you’re gonna be expected to sell next month Because it’ll help you with your business needs, so you make a chart of all the data you have so far. The x-axi’s being time in months and the Y axis being anchors sold in thousands and you notice. This trend here. Now you realize that you can’t just straight up, Use an AR or MA or even ARMA model here because those models all require the time series to be stationary, and we have made a whole video on stationarity and what that means. But in a nutshell, it basically means that the time series needs to have a constant mean constant variance over time has no seasonality and so on so this seems like it satisfies most of those conditions, except, of course, it doesn’t have a constant mean over time. The mean is, of course, shifting upward, it seems in a linear fashion, So we can’t use this straight. Arma model, which is a shame. Because if we were to somehow eliminate this trend, then we probably could use it because the rest of the conditions would be satisfied. That’s where the ARIMA model comes in. So you use the ARIMA model in situations like this, where things seem like they’re stationary, except for a pesky moving average moving mean. I should say, okay, so that comes in here. So a Rima stands for autoregressive moving average and the I stands for integrated. So I’m gonna try to write that in two great too. Before you freak out thinking that we’re talking about Integrals here integrated in this context just means that instead of predicting the time series itself, you’re going to be predicting differences of the times from one timestamp to the previous timestamp. Okay, so what that basically means is that instead of predicting this series we’re going to do a transformation we’re gonna create a new time Series called Z Sub T, which is simply simply going to be defined as a sub T plus 1 minus a sub T. So basically, it’s taking your number of anchors sold in thousands At some month. Let’s say February minus. The number of anchors sold in thousands from the previous month, say January, So you The February anchors minus the January anchors. And that gives you one time point of this new series Z Sub T. Now, why might you want to do this? We don’t get too much into the theory theory of stuff here, but just thinking about it at a pretty high level. This seems to be pretty much linear, right, and then there’s, of course this noise or signal around this linear trend, but there’s, of course, a linear trend in the original series. Now, what do we know about linear functions? We know that to get from one point of a linear function to the next. You just add some constant value, whether that’s 5 or 10 or whatever it is when you’re going from one unit to the next unit of linear function in the X, you go up in the Y by a constant value every time. So if we were to take the differences between a linear function from one timestamp to the next, it’s always going to be constant, so we also expect a similar behavior from our time series if we take the difference between a sub T at one time stamp and the previous time stamp, we expect it to hover around some constant, and that’s exactly what we see when we do that transformation. So this plot down here is plotting the Z sub T values instead of the a sub T values, and we see that now they nicely. Let me use a different color right here. We see that here. They nicely hover around some mean, so we’ve solved the problem of our time series, not being stationary. Now it has a constant mean over time. It has the same constant standard deviation over time, and, of course, has no seasonality, so we’re we’re free to use the ARMA models with more confidence. So that’s basically what in our remo model is here. We’re gonna define it. Mathematically, so the basic form of Arima model is Arima 1 1 1 notice that Arma had two parameters P and Q the P being the AR order and the to being the MA order. ARIMA has three parameters A P of D the Q the P and Q are the same. The P applies to the worker of the AR part. The Q is the order of the Ma part and the D as you might have guessed is the order of the integrated part in this case. What we did was a. D equals 1 a difference 1 Because we just took the first difference. Now you can get more complicated. You can say instead. I want the second difference. Which is you take your Z of T series and you transform it again, which, basically what that means as you create a new series like W Sub T, which is Z sub T plus 1 minus Z sub T. So you do a second difference. We can do a third difference, usually it’s the Feist is just to do a first one, but of course it depends on the exact task you have at hand. So the simplest form of Arima is 1 1 1 and that’s going to be given by the mathematical model, which is going to be Z Sub T. That’s the thing we’re trying to predict right no longer we’re trying to predict your anchors, but rather the difference between your anchor sails from one time point to the last is equal to V 1 Z Sub T minus 1 This is the autoregressive bit right because we’re doing Z Sub T as a function of Z sub T minus 1 plus theta 1 which is the coefficient times Epsilon T minus 1 This is, of course, the moving average bit as always and then we, of course, have our error in the current time period. So looking at this equation, The AR bit is here. The Ma bit is here and the I bit. The integrated bit is taken care of by the fact that Z Sub T is a difference between consecutive time points of the series. We originally started with ok. Hopefully that makes sense now. The last question, of course, is, let’s say we form a amazing model for Z Sub T. It’s very accurate, We’re happy with it. Of course we don’t really want in the end to predict the difference, but we want to predict how many anchors are expected to sell next month, so the actual series. So how do we get back from? Z Sub T to a sub T in order to make predictions in that series. Well, it’s not too tough. So how do we recover a sub? K let’s suppose we have a sub 0 a sub 1 all the way to a sub. L So let’s say this last point time point right here is 2 equals help, and, of course, the Y value here would be a sub and let’s say after that we don’t have any information. That’s what we want to predict, right, so what we want is a sub K which is at some point K in the future, and of course we want to figure out What’s the y-value, which is gonna be a sub K. How many anchors did I sell at that time point? So we want a sub K. Now if we just transform this equation right here, A sub K. Let’s say T plus 1 is K you shift this a sub T over to this side and these Ts are, of course, K minus once because it’s one less than the subscript here, So that means a sub K is equal to C Sub K plus Z sub K minus 1 plus a sub K minus 1 We just keep going. A sub k. Minus 1 is equal to Z Sub K minus 2 Plus a sub K My say a sub K minus 2 and, of course we still had the Z Sub K minus 1 here, and we keep going on and on and on and on until what we eventually get is the sum of all Z Sub K minus. I where I goes from 1 to K minus. L plus a sub L. Why did we stop at E sub L? Because that’s the last a value that we actually had data for so since we actually know that we don’t need to go any further. Okay, so I know that was a little bit mathy, and if you want, please pause here and convince yourself of this before going forward, but once you convince yourself of that, you see that this is going to give us our prediction for a sub K because we have a sub. L that’s the last recorded value of anchor anchor sold, and we have all these Z sub K. S because we use this model to predict them. So if we just do all that addition, we get our best guess for a sub. K number of anchors sold in time period. K okay, so just to recap the ARIMA model is not that much crazier than just an ARMA model. It’s really just used when the time series you’re trying to predict, has an obvious linear trend upward or downward, even for that for that matter, and then you would go ahead and take first differences if you’re using an aroma with a 1 in the center for the deep second difference is if you’re doing a 2 here, and if you want to figure out, you know which differencing should. I use well, it’s basically when your time series become stationary, so if we did first differences and we figure out the plot still does not stationary. We could try a second difference and a third difference, but typically you want to stick with as low of an order as possible to keep your model simple, okay, and then, of course, changing this. P or Q would be the same thing as an ARMA model. You would have more of these lags in the AR. You would have more of these air lags and May. And that’s what that would mean, okay, and to recover your original time series. You would just do this reverse transformation right here. So that is an ARIMA model and I hope you’re learning at this point that a lot of time series is just. How fancy can we make this acronym? We started with a RMA. We did our ma now. There’s an I in the middle. Believe it or not, we are not nearly done with this acronym. We’re going to be adding letters to this side and this side because time series people love awesome. Acronym’s okay. So until next time.

0.3.0 | Wor Build 0.3.0 Installation Guide

Transcript: [MUSIC] Okay, so in this video? I want to take a look at the new windows on Raspberry Pi build 0.3.0 and this is the latest version. It's just been released today and this version you have to build by yourself. You have to get your own whim, and then you...

read more