so things are constantly changing in our world and as statisticians it's our job to understand them this is statistics 479 time series analysis let's go look at the data [Music] all right so in our very first time series lecture what we have to do is discuss different types of noise because when you look at a time series it looks pretty noisy but all of these different types of noise have different properties and that's what we'll be discussing today is trying to understand the very the very fundamental building blocks that will make up our time series
data all right so welcome to time series analysis stat 479 this is the first of our video remote lectures coming directly from my basement to your computer wherever it may be so when we begin with time series we have to kind of set the stage with the idea that time series extends what we've learned previously in statistics about linear regression and stochastic processes so perhaps to start we could just take an example say if you hear some random banging up there that's a toddler who likes to run around a lot all right so let's do
an example just to start off before we start getting into definitions and whatnot um so let's say we want to predict the temperature predict let's say example all right example i want to predict the daily uh let's say average temperature temperature in i don't know let's say edmonton because why not don't really go outside much these days but still might want to know what it's like outside in case i want to open my window say so right let's say we want to predict the daily average temperature well how could we do that um there's lots
of things we could try if we were to take a linear regression example or approach what we may try to do is pick um some predictors some independent variables or predictors like we would do in a regression context so what we might have is something like a city's um elevation you know how high are they above sea level we could have um a latitude if i can spell that correctly latitude a longitude yeah you get the idea a latitude a longitude you could have a time of the year and if we were to try to
do a linear regression model we could plug all of these independent say variables into the model and try to use them to predict what the temperature is in that city in say edmonton in this case we would have say a collection of cities and we'd want to try to predict um but if we're in a time series context perhaps the um best thing we have to predict what the average temperature will be tomorrow is the average temperature today and that of yesterday and the day before so in the time series context we use previous said
temperature measurements to predict the future measurements future measurements but this leads to some complications basically the problem gets harder and the reason is because in linear regression we assume independence between our observations and that's a strong assumption but often a valid assumption um depending on the setting of our data um however when we're in the time series context we no longer have that we're basically doing um statistics with dependency specifically a temporal dependency of course there's also other areas of statistics like spatial statistics where you might have some type of spatial dependency and whatnot but
here we have temporal dependency also i should say temporal dependency or causality i.e the past predicts or dictates the future or maybe it doesn't right we don't actually know we have to try to analyze the data we may have data where there is no temporal dependency the past every day it's just a new random temperature um but in this example that i have that's not the case we know that temperatures change kind of slowly as through the seasons and therefore we know that the temperatures from the last week are going to give us a lot
of evidence to predict what the temperature will be tomorrow and that's what we have to deal with when we're in the time series context so what we'll be doing is we'll be watching measurements over time whether that's say the price of some commodity or stock whether that's climate data like temperature or rainfall whether it's the number of covid cases being reported here in alberta which is follows a very interesting time series and we'll be looking at that in this course hopefully it ages well because uh i'd like to use these videos for more than one
class but uh i think covet will be quite an interesting time series to consider because there are natural fluctuations random effects but also some very nice trends that you can predict based on the trajectory so before we get too ahead of ourselves with looking at real data we have to talk about some mathematical models and that leads to the very first section of my notes which is types of noise because in time series it's all about the noise the stochastic process the random fluctuations and there are many different types of noise processes that we're going
to have to consider so let's take a look at those [Music] all right so the first one that we have to discuss is white noise this is perhaps the um the groundwork in some sense for all time series models um white noise is going to be well we'll say define let wt be a random variable i guess process indexed by time indexed by time t so we can think of time i guess in this case we'll put it on a finite interval between zero and some capital t so time is going to run from the
star to zero to some capital t um and we're going to assume that um with i should say with a couple assumptions so white noise is going to be mean zero which means the expected value at any time is going to be zero this is zero mean [Music] and we also have a constant variance so the variance of wt then it sounds like someone's playing the bass up there um the variance of wt is going to be sigma squared um which is constant variance got a nice beat going there but um right so we have
zero mean and we have a constant variance um and then we have that it has zero covariance for two different time points so for time points t and s we have that the covariance is zero and this is for all t not equal to s so if you have two different time points they are uncorrelated this is not strictly independent this is just the bare bones definition that we need which is that they are uncorrelated um on correlated times so this is the idea that at any given time we just have some random observation it
has the same mean and mean zero and fixed variance throughout the time span um but they will be uncorrelated so there's not going to be any linear relation so maybe we'll point that out and say that note uncorrelated means not linearly related right you can have some strange dependencies that are non-linear and you can still have uncorrelated random variables but this is kind of the bare minimum that we need um of course we can also strengthen this so this is just the um this definition is going to be our weak white noise sometimes it's referred
to that um because it's sort of the weakest definitions there are conditions that we need for our white noise process but we can strengthen that um we can strengthen that to iid white noise and iid white noise is sort of the same as above but replace uncorrelated with independence so we take uncorrelated and we replace with the word independent so this is a stronger white noise setting now we still have mean zero and constant variance but we assume that at any two distinct time points this process is completely independent of each other so that gives
us a stronger groundwork to kind of work build from because a lot of the time series models that we'll look at are all going to build from white noise we're going to start with some white noise and we're going to start to mess around with it and we're going to get different types of behaviors which we'll see shortly but before we get there we have one stronger setting which is gaussian white noise so this is same as above with in addition the condition that our white noise process is now going to have a normal distribution
wt is going to be normal zero um i guess sigma squared for all t in our interval so now we've strengthened this even further to get a nice normal distribution and if you've taken any statistics class which i assume you have you know that statisticians love the normal distribution because it makes everything a lot easier to handle and in practice it's not unreasonable to assume uh the normal distribution of course there's always ways to test for that given actual real real-world data but typically uh the normal distribution well it's called that because it arrives it
arises uh just about everywhere in uh well in data all right so these are the three different types of white noise from the weakest to the stronger to the strongest conditions and then the other question we should probably ask ourselves is why is it white why is it white noise um why call it white noise well the reason is comes from signals processing so from a signals processing setting white noise contains contains uh i cannot write today let's get this right here contains um every frequency so if you have a signal right you might have
a nice smooth wave so let's say let's say um if we have an example here with what we'll call one frequency in a wave it might just look like a sinusoid right we have one nice frequency in our wave if we have all frequencies well then it's going to look something crazy like this which i can't quite draw in its pure stochastic form given my uh stylus here it looks a little bit too regular actually but it's just going to look like complete chaos and noise um so in a sense it contains all possible frequencies
but that's where the term white comes from i guess in a way it's kind of like if you combine all the colors you get white light colors like colored lights you get white light that's um but we want to go a little bit further than just white noise and what we're going to do is we're going to use white noise to build up to more interesting stochastic processes and the first one or time series processes or the first one we're going to consider is the auto regressive process so the word regressive here is kind of
jumping out because in a regression setting right we take our independent variable and we try to use a linear combination of independent variables to predict our dependent or our response variable um in time series we use the same variable in the past to predict itself in the future if that makes sense so let's try to write that down mathematically so the general formula is going to look something like x t is equal to the sum of i from 1 to p so this is going to go back p time steps into the past of x
t or let's say theta i and x t minus i plus w t so let's take a moment to figure out what this equation is telling us i guess what i should say is for fixed theta i in r real numbers so okay what's going on here what we have here is the um present value of whatever x is right x could just be the price of some stock it could be the temperature outside in the city um it could be the number of daily covid cases and what we're going to do is this is
going to be a weighted sum actually what i should say a linear combination i don't want to say weighted because we're going to talk about weights and moving averages so what we'll call this is a linear combination of p past values and then this last bit is just going to be white noise noise at time t so in contrast to say linear regression maybe i'll write that in green here just to recall that if we were to do linear regression trying to use this as a starting point to help with your intuition when you learn
time series for the first time in linear regression we would have some response variable y which would be something like a linear combination of independent variables x1 through say x i'll use p here p plus some noise epsilon right in this case we have the same idea happening it's just that we now have a white noise process for our epsilon our noise we have and instead of having a new y variable a new response we're using the past values to predict the present value but ultimately we still have a linear combination of predictors that's going
to try to tell us what the value of our response variable is um so we have some very specific examples um so we have something called the uh random walk which is well a very special case that we'll be looking at a lot um so let's say special case special case is the random walk which is going to take the it's going to have the formula x t is equal to x t minus 1 plus w t so what this says is that at time t i'm just going to take the previous time step and
add on some random noise and remember wt even in the weakest sense is going to be mean zero with a constant variance so that basically means that well okay we're gonna start at what the previous time step and then we're gonna either go up and down by or down by some random amount and then we go up and down by some new random amount and so on and so on so that's one way to do that but typically we would also have other coefficients theta out front so another thing that we can consider is going
to be the random walk with drift so let's say this is one case we also have the random walk with a drift term this is important because the random walk is kind of just going arbitrarily up and down without any um real pattern in some sense but the random walk with drift is going to be it's going to look a lot like that equation i just wrote down but now we're going to add an a to it so what we do here is we add some constant a this is some fixed a in r and
in this case what it means that at every time point we're adding a so if a is positive that means we're going up by a units but we're also adding in that random white noise so there is a trend either up or down depending on the sign of the value a um but there's still going to be some random fluctuations above and below that um line so this is very important because typically we might want to use a model like this to determine say the trajectory of some random process our temperatures warming for example if
a is positive then we can see that while there are fluctuations from year to year the trend is that temperatures are going up or maybe the price of a stock or commodity is going down again with random fluctuations above and below the mean so perhaps the best way to illustrate this is to actually look at some pictures of auto-regressive processes and rather than me trying to draw them with this you know silly pen here what i can do is copy some graphs that i have already produced in r so here we have four different examples
to look at the um first one let's number them one two three and four so if we look at number if we look at number one here what we have is the white noise process so this is just wt it looks pretty chaotic it's what i tried to draw up above but this is what a white noise process might look like if you simulate it in um r for example which is what i did here and of course we'll look at our code going further into this course but right now we have a lot of
sort of groundwork to lay before we get into looking at actual data and simulations okay so we have our white noise we have our random walk which we talked about before this one is going to look like random fluctuations up and down um notice that any two time points the values are very close to each other so there's almost a somewhat of a continuity that you can imagine here the idea that two adjacent time points are not going to be too far apart from each other but as we move far away in the future um
the time points the values can change quite a lot just to write down the equation again we'll put that here for equation for graph three i have an ar2 process so the process that i use to generate this is going to look like let's see what did i do i used the random walk and then i subtracted 0.2 x t minus 2 and then added on the white noise process so in this case there's actually a random walk but there's also some other second order piece in there that's coming from two time points ago um
dampened a little bit by a coefficient of minus 0.2 and then for number four we actually have a third order auto-regressive process in this case i think i just kept adding terms on so we have the random walk bit we have that second order bit um then i added on a third order bit um 0.18 x t minus 3 plus w t so perhaps one of the takeaways is that looking at the pictures it's not obvious at least not to me not obvious what pros type of process we have what type of ar process auto
regressive process these are hence what we'll be doing is we'll be using statistical methods and methods from probability and statistics to try to um take a good guess based on data as to what type of process we're looking at here so for example in the right column well i have my random walk and i have my ar3 process they both look kind of random walkish stochastic in a way so it's not straightforward to me that one of them is order one and one is order three and similarly in the left hand column just by staring
at that it may not be obvious that the top one is white noise but the bottom one is not a white noise process but an ar2 process so this just to give an idea visually what we're going to be looking at going forward and at least that's for the ar process but there's another big piece so the auto regressive process forms one major cornerstone of what we'll be talking about in this course the other major piece is the moving average process so the second bit that we need to discuss is the moving average process or
the m a process right so how do we look at moving averages well i'm going to take one quick break to reset everything and then we're going to get right into that all right and we're back and we're going to be talking about the moving average process now so the moving average process is a type of smoothing process and this is something that you'll see very common in um the real world i guess when you hear people say ah we have a seven week or seven week seven day average for something let's say for example
if we're looking at covid cases the daily number of cases is quite uh stochastic in the way that it can fluctuate a lot often times when you see the graphs reported you see a seven day moving average which means they averaged a window of the last seven days to get a smoother representation of the process so in a mathematical sense right this is a well what we'll say off to the side here is this is a smoothing of white noise and what i mean by that is that we can write out the formula and the
formula we're going to get is that x t is going to be the sum from j from 1 to q of not theta we need to make sure we have unique greek letters here because we're eventually going to combine these so we have phi j w t minus j plus w t and this is going to be an m a of order q so what does this equation tell us this equation says that the present value is an average or some weighted sum of past white noise values past noise values plus white noise at the
present time so this one is a little bit uh maybe less intuitive i think than the auto regressive the auto regressive is somewhat natural to consider because what it's really saying is okay we're going to use the past p-values to or we're assuming that the past p-values influence the current value of whatever thing we're watching whatever process we're trying to understand for the moving average what we're saying is is that the current value is some sort of average or weighted sum of the past noise values so perhaps the um the easiest way to think about
this is in terms of a uh like a market like a stock market so say that x t is the price of some stock say i don't actually know much about finance math so if i am a little bit uh imprecise with the language um don't get too mad um but the idea is let's say x is uh just the price of some stock the current price and if we model that as x t being something like let's say phi 1 w t minus 1 plus w t then this would be basically saying that w
t minus one is going to be a random um shock or random fluctuation in the market um at t minus 1 and this would be sort of a random shock to the price at t so what this is saying is is that if one time unit ago one day one week one month whatever t is right we didn't actually define specifically what t is but one time unit ago if there's some random fluctuation that goes up or down that affects the price then that fluctuation will still be in some sense present at the next time
point um so it's almost like you get hit with a shock and there's still a reverberation one or two or q time points later if the value of phi here is positive then what that means is that a positive shock will still be kind of present at a later time point if phi is negative then that means a positive shock will come back as a negative shock at a future time point so there's almost like a yo-yoing effect in the sense that it kind of goes up and then down then up and then down so
this again is a little bit harder to intuit i think but um it it does show up a lot um in in modeling time series so it's really another it's the second key piece after the autoregressive process for modeling time series data so very important to spend some time and think about that and similarly i have some pictures where in the world are those pictures pretty sure i have some pictures yes here they are so let's see if we can get this in here all right we have some moving average processes then to look at
and let's see if i can find the um definitions which for some reason i oh that's right these are average white noises that's what it is okay so there's one thing that i um didn't mention yet and that is that um another see if i can move my timer without uh okay good um we'll say another definition of m a is to take x t and write it as the sum j from one to q so we're still averaging i guess over um q time points but um oh sorry what i actually meant to say
was q minus one or they'll say j is going to be minus q over two to plus q over two um and then we're going to have a phi j and a w t plus j and in this case what we're saying is average over a window which is going to run from minus 2q units in the past to plus 2q units in the future um i'll say before and after time point t so this is another way that we can represent a moving average process and what we'll be doing is we'll be taking the
time points in the past and the time points in the future and averaging them um in i should say averaging but summing them in a weighted way um with via the um phi's so typically it doesn't have to be this case but typically the phi values here would say sum up to one and then you'd have some weighted average of the adjacent um white noise process points and that's exactly what we're looking at in this uh in these plots off to the left hand side here so here we have one two three and four again
so again as before number one is just going to be white noise number two is going to be this above um defined process that i put with a little star here um where q is going to equal i believe three if i got that right let me double check yes sorry q is not going to be three i guess q is going to be um two so the window has length three right because we're going from minus q over two to plus q over two so in this case it would be minus one zero and
plus one so i'm taking the current time point and the adjacent minus one and plus one time points and averaging them in this case i'm just assuming that with phi j here just being 1 over 3. so i'm just averaging three time points and what we get in plot number two there is a slightly uh maybe a slightly smoother but still pretty noisy looking thing um compared to the white noise process but when we extend this into plots three and four where the window has length um what nine and twenty-one then suddenly we start to
get a much smoother representation of our white noise process because we're averaging over a lo a wider and a wider window when we look at the ma21 process down there in the bottom right what we see is something that actually kind of looks a little bit like that random walk we saw up above or an ar process so again it's not always straightforward when looking at some data or looking at a picture like this what the type of stochastic process or time series process is that we'll be working with so it's always good to remember
that and we will also see later in the course that sometimes one process can actually be represented as the other type of process so there's a bit of a duality here that will just make things a little bit even more complicated but i'm getting ahead of myself um we should just stick with the uh the basics right now as we sort of enter into this course right so when we talk about um time series processes uh well there's a couple things i wanted to point out so some things to note we could consider time as
continuous ie or eg or ie or whatever the right one is um we could consider x t for t in some interval like zero to capital t like i said before for the white noise but uh in this course we're going to look at discrete time i say we consider discrete and unif uh discrete uniform time steps uniform time steps because time series data is actually quite messy or can be quite messy so in this case we'll consider t is going to be 0 1 2 all the way up to some capital t and we're
going to assume that all of the observations are exactly the same unit of time apart so a process is measured every day it's measured every week it's measured every month it's measured every second but it's always measured at a uniform time step because you can have time series data which you can imagine in in practice is going to be measured at irregular time steps maybe there's going to be a big chunk of time missing maybe it's just going to be a bit chaotic when it's measured we can handle such data but it becomes a lot
harder and this is an introductory course for time series analysis so for this moment we're going to assume that whatever we're looking at is going to happen at sort of equally spaced time steps and it's going to be discrete so we don't have to worry about all the headaches that come around when you think about a continuous time index stochastic process now there are two definitions that i think are worth discussing before we go forward and that's the idea of markov process and the martingale so let's consider very quickly what is a markov process so
the markov process is a way of again it's a it's a way of describing the dependency in some type of in this case discrete time stochastic process um so cutting to the um to the to the end will basically say xt is markov if the expected value at time t given all of the past measurements and we'll start this at time 1 i guess is going to be equal to the expected value at um given just the previous time measurement so the point is is that we're here conditioning functioning on the whole past and here
just the previous value so this notion of a markov process is important because if we have a process xt that is markov then that means that the present value is only influenced in some sense by the previous value in the idea that if i'm going to take the expectation which is what i what the average what we think is going to happen at time t given the entire history well it's the same as trying to predict or estimate what's happening at time t given just the previous time point um so i'll say for example and
a r 1 process is markov because an ar1 process as we noted before is going to look something like xt is equal to theta x t minus one plus some white noise so it only depends on the previous time point um for what the current time point is going to do and if we know the value at the previous time point then we don't really care about the history that preceded it and it's also worth noting note we can consider higher order markov processes processes there we are um so the markov process is just a
nice thing to keep in mind um both from a probabilistic modeling perspective but also statistically because ultimately what we want to do is we want to use the press data to understand and predict trajectories that's called forecasting to forecast into the future and if we have a process that's um markov then in some sense we just need to know what the previous value is to predict the future value i also want to briefly mention the idea of a martingale so the martingale in some sense is referred to as a is a kind of like a
generalized random walk um or sometimes you'll hear people refer to it as a fair game in a gambling sense and the idea of a martingale is that if x t or forget the if xt is a martingale if the expected value at time t given the past values is just going to be the previous value that was observed xt minus one so this is very much like the random walk um if we uh you know if we want to know where do we expect to be at time t well we just look to the previous
time point and we say well it's what we saw one time unit ago so very often this does occur with things like um temperatures or um stock prices where if they follow this random walk or this martingale type setting this more generalized random walk setting then what we might expect is that well the best guess for what we think the value of the process is today is what the process was yesterday and there's a ton of nice probabilistic theory that goes into the idea of studying martingales and things like sub and super martingales that's well
beyond anything we're actually going to talk about in this course but it is it is very important to at least mention these ideas just so they're in your head as we move forward and now what i want to also mention is the idea of a gaussian process so we know what the normal distribution is we know what the multivariate normal distribution is the gaussian process is in some sense a generalization of the multivariate normal or the multivariate gaussian so for the moment i'll say assuming continuous time time t in say 0 to capital t then
i'm going to write gt for is uh a capital g gaussian process if um for any finite collection of time points collection of time points t 1 through t i don't know p or k what do we like k i guess because p was our auto regressive order and q was our moving average order so we'll do k so the idea is that for any collection of k time points then the vector g t 1 through g t k is multivariate distributed as a multi-variate gaussian distribution so the gaussian process is super important well almost
everywhere but especially in stochastic processes and time series again we're not going to be dealing with continuous time processes in this course we'll just be looking at discrete time in the discrete time setting well a gaussian process just becomes i should say in the discrete and finite span time setting the multi the gaussian process just becomes a multivariate uh normal distribution but most importantly we want to say that a like i'll say like a multi-ver gaussian the gaussian process is going to be uniquely defined is defined or characterized by its mean and covariance so if
we know what the mean of the process is and we know what the covariance is and it's gaussian in some sense we know everything there's nothing else to to know about that process um and the other thing i wanted to point out is that recall that any linear combination of i guess a multi-variate gaussian is uh also gaussian or normal so the normal distribution i should say the multivariate the joint normal or the multivariate normal is a very nice distribution because if i take my the pieces of that and if i combine them linearly in
any way in some sort of sum um or linear combination then what i get out is also going to have a normal distribution so that's really nice in a lot of reasons but specifically for time series um because therefore if our wt is gaussian white noise white noise then what's neat is that every process that derives not every process every um process that we've talked about like the auto regressive or the moving average process that is derived from that white noise will also be a gaussian process so right if wt is gaussian white noise then
any ar or m a process based on it is a gaussian process which is quite neat because that means that all we really need to do then is understand what the mean and the covariances is of our gaussian process and we can understand the entire thing in some mathematical statistical sense all right so we have all of that what else do we need to do okay yeah we have one more process that we need to define um which is the idea of a linear process all right so a linear process also is a general idea
that encompasses and compasses much most time series models so the linear process is going to be something much like the gaussian process that's going to show up all throughout the time series models that we'll be looking at in this course so how do we define that well we define it simply saying if wt is white noise not necessarily gaussian or strong in the independent sense it could just be uncorrelated weak white noise if wt is white noise and i think we're going to need four t and this is always a little bit of a of
an intuitive stretch but we're going to run t from uh minus infinity to plus infinity um so the idea is this is for all time all present all past all future time we have some white noise process we're going to still consider to be discrete but we're going to allow the index to go all the way to infinity and all the way back to minus infinity again there's two sides to when we this when we deal with time series in practice we have the mathematical framework of sort of infinite time horizons and then we have
the real world setting where okay we not we're not going to have infinite data certainly not into the future but not into the past either eventually our data has to start somewhere and then stop somewhere else but mathematically we can think of a linear process as if we have white noise that exists in some sense for all time then x t um defined by mu plus the sum where we take j from minus infinity to plus infinity of the theta j w t minus j is a linear process so what we're saying is it's kind
of looks a lot like that moving average process that we talked about before um and it's going to turn out that it is actually closely related to both the moving average and the auto regressive process but here what we're saying is we're just taking our infinite white noise process and we're doing some type of weighted sum linear combination of the terms um and then there's going to be a constant mu which is going to be the mean term because we always assume that white noise is mean zero so then the first question uh if you
want to be a good mathematician is does this does this even make sense to write down so we'll say math check does this infinite infinite i should say doubly infinite if i spell doubly right infinite sum make sense right because now i'm summing up uh in two directions i'm summing up to infinity of a bunch of random variables so then the question is does this actually make sense and the answer which we'll do in green the answer is yes long as the sum of over all j from minus infinity to plus infinity of the theta
j squared is finite so this is ah there goes my camera again uh okay so why would that be the case is because if we want to compute the um the variance right so the answer is yes uh this sum does make sense as long as um the sum of the squared thetas is finite and the reason for that is so that we know that the um this is because we want the variance at time x t is going to be um by independence the sum of the minus infinity to infinity of the variances of
the w t minus j which is just going to be something like sigma squared um times the sum of these theta squareds from minus infinity to plus infinity so we want the theta squared to be square summable i guess if we want to make sure that this actually makes sense um i'll we'll say one other note note the above definition is not causal so we didn't strictly define what that means um we have an intuitive sense of causality the past dictates the future the future doesn't dictate the past right we have um this notion of
temporal causality um but strictly speaking um the above definition is not causal because xt relies relies on future w t's right the present value xt is a function of the past and the future so what we often will do is restrict the definition to get um a causal linear process the restricted definition which is going to be a causal linear process is going to be that x t is going to be we're still going to have mu which is our constant mean term here um and then what we're going to do is we're going to
take j from zero to infinity so now we're not going into the minus to minus infinity we're just going from zero to infinity of theta j w t minus j now one other thing i wanted to note here note we typically index w t back minus j um backwards right so as j goes from zero to infinity wt minus j is going to go from wt to wt minus one minus two minus three all the way back to minus infinity it's it's kind of the convention of writing these things down in a time series context
so again it's just something to be aware of um that by writing j from zero to infinity i'm actually considering the past not the future because of the way we define this okay so i have one a little bit of time for an example before we shut down this lecture for today and move on to the next lecture which i'll probably record in about you know five minutes from now um five minutes after i end this lecture but let's do an example of the ar1 process the ar1 process which is going to be kind of
our standard place to go for an example because it's the simplest perhaps one of the simplest processes we can work with in time series so we're going to consider the ar1 process which is x t is going to be theta x t minus 1 plus some w t okay so is this actually a linear process well it kind of is it just isn't straightforward right if we think back to those moving average processes they were just um weighted sums of white noise so they fall right into that context of a linear process but it turns
out that the autoregressive process also is a linear process uh and we can see that by using this recursive this definition recursively so what i'll say is then proceed recursively and what we get is that x t is going to be theta but if we apply the same definition to x t minus one what we get is we get theta x t minus 2 plus w t minus 1 plus w t and if i write that out i'm going to get a theta squared x t minus 2 plus theta w t minus one plus wt
ah so now we can actually think of this as having a wt minus one piece and an x t minus two piece to it so that's kind of interesting and we can actually continue this i guess somewhere i need to assume that theta is less than one in magnitude for this to make sense but um what we can do is we can continue this whole thing to basically get the write this as the sum um j from zero to infinity of theta j w t minus j um and what we do here is we assume
that theta in absolute value is less than one um so that our term we're going to have some term which is going to look like theta to the k x t minus k we'll say vanishes as k goes to infinity so what we're doing is we're going kind of taking our process into the infinite past but we keep multiplying by some theta which is a value that in magnitude is less than one so geometrically this thing is going to shrink shrink shrink and kind of vanish in a hand-wavy intuitive sense um yeah so that's that's
roughly the idea and now what we have is we have our ar1 process written it as a linear process but again we have to um wonder does this actually make sense and how do we actually understand an infinite sum because up above i think yeah it still didn't run off the top of the screen i was just saying ah well you know we can take the variance of this infinite sum uh but when you're taking a variance of an infinite sum you're actually um flipping orders of integration and you actually you have to be a
little bit careful um so up here i should have actually should say be careful to make sure that this makes sense mathematically and we're going to look down here to figure out how we can do this in a more precise way so what we'll say is to be more precise let what we want to do is we want to consider the finite sum because the finite sum will give us something that we can work with mathematically without um running into trouble so if we define s n capital n theta um to be the sum the
finite sum j from zero to capital n of theta j w t minus j well okay now we have to consider what happens as we take capital n to infinity um so first of all for n finite and fixed well we have some interesting things to note the first thing to note is that the expected value of sn at theta is just going to be zero i guess if we wanted to we could include the x t in there but we'll just leave it like this so the first thing is is that we can take
the expected value now we're taking the expected value of a finite sum so this is perfectly fine just use the linearity of x the expected value operator uh take the expected value of each piece they're all zero because white noise is mean zero and we get that um and furthermore we can also compute the variance of s and theta uh again using the fact that we have a finite number of terms being added together and even for weak white noise the wt's are uncorrelated so we don't have to worry about any covariance terms um and
what we end up with is just going to be sigma squared out front and we're going to get the sum j from 0 to capital n of theta to the 2 j because when i take the variance of each piece i square the coefficient right and if you have more questions about this please contact me and ask me and we can go through this in more detail i want to make sure that it all makes sense but right when i take the variance then the theta the coefficient out front gets squared so it becomes to
the 2j and then if i use well what i know about summing geometric series um i guess i haven't well yeah we don't even need strictly um theta to be less than one at this point we just need to note that if we sum up a geometric series like this we get something that's going to look like this and this course is going to be a lot of summing of series specifically geometric series so it's probably good to refresh your memory on that if you need some help we can definitely talk about that in discussion
time um and office hours but okay so we sum up the first j from zero to n terms and we get something that looks like that so now mathematically we can note that therefore if the absolute value of theta is less than one as we kind of assumed in that green box off to the um off to the top right here then well what happens well then if we take um taking n to infinity we get that the variance of s n theta will tend to be what it's going to be sigma squared divided by
1 minus theta squared excellent and furthermore furthermore if wt is gaussian then we know that s n theta is going to converge um in the limit in i guess in distribution to a normal zero sigma squared over one minus theta squared normal random variable because again if we know what the mean is we know what the variance is for a normal then we know everything that we want so if we consider one other point of note is that note that for theta greater than one in absolute value we do not have convergence so typically we
don't want our coefficient to be big like that if theta is greater than one in magnitude then this thing will not converge the variance will be infinite in some sense which is uh not good so we don't want that um and also note that for theta equal to one well now what we have is we have this random walk setting we have a random walk but also but also by the central limit theorem if i take my um my uh let's say my s and theta and i divide by the square root of n then
the central limit theorem i guess i should probably change well no yeah that's fine i guess in this case if i just need to normalize i guess but um oh well theta is equal to one yeah of course so if we replace this with a one then we get that then in this case this will converge to a normal zero sigma squared random variable in the limit so that's kind of neat so what we end up with is the idea that our random walk will actually follow the central limit theorem so it really lies on
the boundary between different behaviors for our stochastic process when theta is less than one in magnitude our ar1 process uh i guess converges in a mean squared sense and actually makes some sense as a linear process when it's equal to one we don't have a convergent linear process but we have something that satisfies the central limit theorem when theta is greater than one in magnitude then everything kind of falls apart and we'd end up with some kind of infinite variance and that's bad and this type of intuition and these boundary points are going to be
very important as we go further into this course so i think that's all i'm going to talk about in this lecture going forward what we'll talk about are more properties of time series processes things like well if we have a covariance now we're going to have an auto covariance just like we had a regression now we have an auto-regressive process um and we're going to talk about lots of other properties from covariance auto covariance cross-covariance stationarity and so on so uh tune in to the next lecture which i'll probably record um not much longer after
this one so see you there