Time Series Talk : Moving Average Model

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we'll be talking about the moving average model in time series analysis now when I personally first learned about this model it was really confusing for me and I think that's because when they teach it they jump right into stocks and finances and those things which are not so natural to all of us so instead we'll be using a slightly different example throughout the course of this video here's the setup let's say you're a grad student at your University and every month this crazy professor so this guy right here hosts a dinner party for all the grad students and every month you're in charge of bringing cupcakes now let's say on average you always bring ten cupcakes so that's the first parameter in moving average model is this mu so if there was no other changes everything else held constant you would bring ten cupcakes every month to the party now remember this professor is crazy so part of him being crazy is that every month he's gonna say you brought the wrong number of cupcakes by some amount and that amount so being how many cupcakes he said you were wrong by you sub T is normally distributed with mean mu sub e we're gonna say that's zero and standard deviation Sigma sub D we're gonna say that's one so for example he might say you're wrong buy two cupcakes you brought two cupcakes too many or one cupcake too less or you might even say you brought just the right amount the point is he's gonna say that you brought the wrong amount normally distributed mean 0 and standard deviation 1 okay so you know this professor has a reputation for being kind of crazy so you kind of factor that into the amount of cupcakes that you're gonna bring to the party each month so the number of cupcakes are bringing each month is gonna be given by F sub t hat which is your predicted number of cupcakes I called it f for food but you can just think of it as cupcakes and that's gonna be equal to remember your mean mu which is 10 so that's gonna be your baseline that you're always gonna bring plus some coefficient C sub 1 and we're gonna say P sub 1 is 0.5 v sub 1 times the error from the previous month now let's think about let's pause for a second let's think about why this model makes sense so basically this model is telling the story of I'm always gonna bring 10 cupcakes to the party but I'm gonna adjust that by 50 percent of whatever the professor said was my error last month so it's very natural when you think about it because you're basically just taking information about how wrong you were in the previous time period to make a better estimate for the current time period okay and just hit that point home notice this is t minus 1 so that's the previous time period and here we have T so that's the current time period so to just reiterate the four parameters in this moving average model are mu your baseline number of cupcakes V sub 1 which is the multiplying factor of previous month's error mu sub e which is the mean of the error and Sigma sub E which is a standard deviation of the error so now to get an even better understanding of the moving average model let's just work through this table here so in the first month since there's no prior parties you just go ahead and bring your 10 cupcakes that's your mean now in the first month professor says hey you went over by 2 you only needed 8 cupcakes so the next month you say okay I'm gonna bring my 10 cupcakes but I'm gonna take 50% of the error from last month 50% of negative 2 would be negative 1 so you'll be bringing 9 cupcakes in the second month now that month the professor says hey you needed to bring one more you should have brought 10 so quick notation this F sub T hat is your predicted number of cupcakes u sub t is your the error the professor tells you and F sub T is how many cupcakes you should have brought that month ok so in the third month you say I'm gonna bring my 10 cupcakes plus half of what the professor said last month was my hair so 10 plus 0.5 is 10.5 let's pretend you can bring fractional number of cupcakes it just so happens that this month the professor said you were right on point so how many you should have brought is exactly how many you did bring so the next month you say I'm going to bring 10 plus the error from last month plus V times the air from last month which is 0 so that's gonna be 10 professor said you should have brought two more should have brought 12 now in the last month we have on file here you're gonna bring your 10 plus half of 2 which is 11 of course the professor being crazy says you should have brought one more you should have brought 12 okay so now let's go ahead and plot these points and by these points I mean this column which is how many cupcakes you should have brought each month the first month you should have brought eight so that's gonna down here second month we should have brought ten so that's gonna go right here third month you're gonna shoot about ten point five so that's gonna be here then we have twelve here and then we have twelve again okay so now if I just crudely connect the dots between all these points it's gonna look like here here here and then plateaus right there so that's kind of what it looks like and of course we can keep going into future months but something we can already kind of see is that this trend seems to be centered where it seems to sort of be centered at this point ten right here right and this gives us a clue as to why it's called the moving average model because we have our average of 10 but that average it's moving all about that average but it is still staying centered sort of over there right in fact if we continued you might see that it continues like this like this like this but the point is that it's always centered at ten okay so that's why it's called a moving average model now to get into a few more specifics here this is the easiest type of moving average model often called the MA which is moving average one model and you can probably guess why that's why it's called because we took one error term into account which means that in making your estimate of cupcakes for this month you are only using information about the error from last month now you can probably already guess what an MA two model would look like right an MA two model would look like your predicted number of cupcakes that you need this month is going to be mu plus b1 the error from last month and fee to some other coefficient there from two months ago okay now just to give a quick note on what the actual number of cupcakes you needed would be that would be f of T that would be mu plus V sub 1 et minus 1 plus V 2 et minus 2 plus error in the current time period ok so here is your predicted number of cupcakes in the given time period and this is how many you actually need which is basically just your prediction plus the professor's error from that current time period so this is a moving average model and along with the auto regressive model that we talked about in a different video forms kind of the foundation of a lot of the models in time series analysis and in the next video we'll talk about is how to know if some random time series that you're given might or might not be a moving average bottle okay so until next time
Info
Channel: ritvikmath
Views: 77,964
Rating: 4.9451742 out of 5
Keywords: machine learning, time series, data science
Id: voryLhxiPzE
Channel Id: undefined
Length: 7min 10sec (430 seconds)
Published: Mon Apr 22 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.