 Now, let us discuss the ARMA process that means auto regressive and moving average process put together. So, we understood the AR model, we understood the MMA model, now we will add both of them and we will forecast the ARMA process or we will understand the ARMA model. Remember in AR process we select the actual past lakh or time series data, we will forecast the regression model through auto data. In MMA process, we consider the past error terms right, with your mean data and you forecast the average of or weighted average of your error terms, so these two are two different concepts. Now, in case sometimes what happens the data pattern will be so complicated that you not be able to select the AR model or MMA model through your correlogram or say order, in that case you select the MA process, in case we are confused or you know both are having same lakh and cut off, in that case I will discuss that in that case you can select the ARMA model. Now, the question is that how the ARMA model works, what is the mechanism? It is very easy like moving average process it is also simple, it is a linear combination of past actual periods and the error terms that means you can see the model, past actual periods up to say if your model is of ARMA say ARMA say P and Q say P and Q in that case P is your order of AR process, past P terms you are considering of actual data of time series and past error term Q error term you are considering in your MA process. If you add both with some coefficient you will get the forecast of MA process, this is what the ARMA process, this is what the ARMA that means if you have a data say y 1, y 2, y 3, y 4, y 5 like this and say you got the error, error 1, error 2, error 3, error 4, error 5. So, these they are combination you have to take, they are weighted combinations say beta 1 and say gamma 1, this weighted combination we say phi 0, this weighted combinations will be your MA ARMA process. Now, the question is that how many term we will have to consider of past actual data lacks and how many error time you have to consider that we will discuss later, but for the timing let us understand the steps of ARMA process right. Generally more than 1 period 1, 1 or 2, 2 or 1, 2, 2 or like 1, 1, 1, 2 or 2, 1 do not take more than this or maximum 2, 2. The restrictions of ARMA process of the lacks are been calculated through this only, but the understanding of how the ARMA model works that is very important. Look at here if you select a ARMA model of 1 order 1, 1, 1, p equals to 1, q equals to 1, then it will be a coefficient part plus 1 lack, look at from here 1 lack and 1 error term like the way MA process error and the actual data of your time series past data. If you consider error say MA cross ARMA of order 2 and 1, then p equals to 2 and q equals to 1 right. So, in that case 2 past lack you have considered or past data you have considered only 1 error term. If you take other way, so only 1 actual data past data and 2 error term you consider this combination and drag it, but in that case also since it is a linear combination neither regression nor the you know weights to some extent weights you have to optimize this weights also right, this weights also you have to optimize like the MA process just now we have discussed. Similarly, here also you have to calculate the linear combination and the corresponding weight and the coefficient part this is not intercept this is a coefficient. How this calculation are done? Let us understand through illustration. So, first step you need to understand the mechanism of ARMA process. Let us restrict our discussions to ARMA 1 on process for the timing. If you understand that then you know using python or you know regalmade software you can extend to ARMA 2, 2, 3, 3 or a pq process. Just understand the 1 on process. Now as I mentioned first you need to consider the model will be a linear combination come back to the previous model look at the model is a linear combination right. Here you can see one different type of illustration I have given here the linear combination of your past data and the error terms. A air process and MA process both coming together in ARMA. Now suppose this is your final model of linear combination. Now the question is the how that has been developed? Let us understand. All this calculation phi 0, beta 1, gamma 1 will calculate through excel. Now first understand how this formula been derived? First you do like you calculated the PSCF similarly here, here you calculate the center of data. You subtract all data from that to mean and then you calculate the mean and then calculate the center of all this data. Once you get it let us assume a linear combination of your y t this new y t this is the center of data right. You have the y and then you know y mean then you can calculate say y minus y mean bar this is your small y t say this is your capital y t say and this is your small y t small y t. So, this your small y t y 1, y 2, y 3, y 4 small y t these are your your center data. So, this center data we will use to predict the ARMA process. Later you can adjust with your actual data though it is actual data actual data, but you can adjust later. First let us assume that linear combinations of new center data will consider through older data of center data one period older data because one one model we have considered in the discussion and one error term we are assuming linear combination the beta 1 and gamma 1 will optimize and we will assume that center is in center is your mean y mean we are not considering right. Now, if you consider this is your assumption right that you have considered your new center data is a combination of previous center data not the actual y not the actual y these are center data small small y you are considering the center data you are considering and then the error term. So, here you can see now if this is your assumption then this should be look at y t capital y t minus y mean should be beta 1 or like this combination this combination just rearrangement we have done like this right same. Now, what you do if y t minus y t bar bar y t minus y t bar at some stage is combination of one center data and the error term then y t minus 1 this y t minus 1 is a combination of another center data say another older data say one period older data now. So, this we have put there look at this we have put here like this this we have replaced this. Now, if you readjust that bring y t here in this side and you will get y bar this side you will get to some extent y mean equals y t forecast equals to y mean of say 1 minus beta 1 plus beta 1 into gamma 1 you can readjust and gamma 1 of beta 1 into y t minus 1 and gamma 1 of error 1 this we will consider as phi 0 look at this. If you consider that then this forecast is nothing but phi 0 this forecast is nothing but phi 0 plus beta 1 capital y t minus 1 plus gamma 1 into error 2 minus 1 like power error this is the same formula look at this same formula clear. So, this is the steps of ARMA process now let us execute it and this is what in every book we will find this formula you would not find the procedure how they have been calculated here I have illustrated the calculation process how the formula are been derived now the question is that you have to find the weights right the weights and the coefficient part let us see one illustration we have taken the same TCS data of 3 months then first step you calculate the average then calculate the center data look at the center data center the data. So, this we have done by subtracting the average from the actual stock price. Now, this center data will use as say small y t small y t and residual we will calculate here say error term residuals then we will take the weighted combination of them because 1 1 model we are illustrating weighted combination of these 2 we will consider then we will make the forecast done right with the previous formula here is the formula here is the formula let us see and but you have to optimize the data right because you have to calculate the coefficient best coefficient now let us see one part. So, this is your center data and this is your residual initially we will assume that initial residual is 0 right initially we are assuming same way the moving average process we have done. If it is 0 look at here 2 coefficients we required beta 1 and gamma 1 look at the formula look at the formula beta 1 and gamma 1 let me erase this part little bit of so that you know you will able to understand in a better manner. So, here look at this beta 1 and gamma 1 or here you can see this beta 1 and gamma 1 we will take this formula in our calculation then later we will add this at the end finally. So, look at here so initially if you do if you consider residual equals to 0 then you have the center data you have the residual center data and residuals. So, what will be the combination weighted combination this is the weights we will finalize right we will optimize that in solver later initially we have taken 50 50, but we do not know what is the best we will calculate that. So, in that case your first this forecast will be 50 percent of center data say small y 1 plus 50 percent of first error say this is your forecast say y t small y t right this will be forecast through ARMA model in terms of this formula this particular formula look at my center formula this formula, but later we will adjust with this and we will get the final forecast. Now, if this is your next forecast through this forecast you will get the error again you will get the error again this minus this like the way in moving average we have done. Now, you got a new error and the center data corresponding center data also we will get for forecast minus actual you will get the center data you already have from the beginning you have calculated this center data you keep it and now you are getting new error and the forecast new error and the forecast with the combination of this like for here what we will get this data plus this data weighted combinations will be your forecast here and you drag it you will get the forecast through ARMA model, but remember this is for with center data not the actual forecast. Now, what you have to do you have to add this phi 0 and you have to make the final adjustment to make your final forecast in terms of actual stock price. One more part here you need to optimize this beta 1 beta and gamma 1 that will decide in excel same way. Now, look at the final stage what you have to do how you optimize them you have to minimize your error right you minimize your RMSE you minimize the RMSE and calculate your the square error and the corresponding RMSE you take the way of RMSE you calculate and the error RMSE and the corresponding optimization process here we found the final beta 1 and beta 2 for this particular data 97 percent and 12 percent. Take them and make the final forecast here is the final forecast you can see here look at that. Final forecast here it is a intermediate data small y t hat equals to say you know beta 1 beta 1 into say small y t plus gamma 1 into say error error t. So, this formula we have used right and we have calculated this forecast this is not the final forecast you have to adjust with gamma say phi 0. So, that we have this part so that we are being now with the forecast. So, this you can calculate with this error 3541 is your final average data and then if you put this in your formula this will be your final forecast model. Now, if you put any t and any epsilon this is actual capital T and the epsilon or error you put that you will get the forecast you drag it for any period you can you can use you can make the forecast through ARMA process of 1 1. Let us understand that in excel now we have come to the normal scheme of our excel here you can see first step center the data we are discussing the ARMA model we are discussing the ARMA model 1 1 right. First step you calculate your average of the data actual data second stage center the data now your model formula will start center the data and look at the center the data right. Now, these data will use these are small y right small y t in your formula and these are your residual initial residual we have assumed 0. So, you know the center first center data and the residual you take the weighted combination of them you will get the forecast here look at the weighted combination of them and you get the forecast here you can change them you just put say 0.6 and say 0.4 whatever you can put just put them you will get the and RMSE we are calculating here as it is and we will optimize that now this is your first forecast using this forecast you can calculate again your residual here look at here again your residual center minus forecast ARMA forecast your residual now you get new forecast here center data and the forecast you take their combination with this beta 1 and gamma 1 you will get the forecast for the next ARMA model you drag it now suppose here suppose you are here how will we will get this 100 you have the center data and you have the error now from the previous datasets you get the error look at the error and if you take these two with your this weight weights you will get the weighted combination here look at here you drag it that is it this is what your MA process ARMA process and here the final forecast I will discuss here later but we need to optimize the weights right because which weights will give you the best ARMA model that you need to find go to data go to solver look at you need to minimize your RMSE same way you need to optimize your RMSE and it is not a maximization problem it is a minimization problem you have to minimize your error and two term who are them this beta 1 gamma 1 gamma 1 or you can drag both there is no conditions you can put condition you can consider as a unconstrained optimization also it is a nonlinear model same way you have to consider nonlinear model just solve it look at we found the best combination of beta 1 and gamma 1 whatever initial value we give system will optimize to minimize the RMSE the optimization process refer to the RMSE session or the error calculation session measure of goodness models so here you need this value to make your final forecast like the way we have discussed in the PPT now here you get the final automatically even finalize now you see the last period the weighted combination of center and the weights the residual you get this forecast this is your intermediate forecast right with the center data now you need this with your the weightage value like you know center plus this value you will get the forecast you can go back to the PPT and you may get use this particular formula and you can put the data and you will get the forecast of your next model through ARMA this is what the ARMA process you can execute it with more example and you can get to know how this calculation process are been done enter recording are been done you can illustrate at home now we have one more part to wind up this ARMA process that how many order of ARMA model you should select because here it is nothing but P for AR process and Q for MA process so you have to select the ARMA order also the P and Q of ARMA 1 1 1 2 1 2 2 etc so how big you will consider remember for AR process the PSF AR is the actual AR process right the actual regression auto regression so you have to select the PSF graph to select your order right we have discussed detail and SCF will be exponential decay for MA process since the error term they are already independent unit you do not need to go to PSF from ESF SCF graph you can select that will be clear cutoff and PSA will be in a other way but for ARMA model in case you are confused say your graph is like this say your graph let me draw here suppose your graph are like say this AR also have a cutoff and SCF and PSA we also have a cutoff so in that case you can select AR from here PSA this is PSF and this is suppose SCF suppose after 2 period there is a cutoff and here after 1 period suppose there is a cutoff so in that case you can select AR1 and MA2 so it will be ARMA12 done but suppose in case there is a model both have exponential decay in that case you select the AR1 ARMA11 that is it just so or you are confused to select so in that case you select you know ARMA model if you are not able to select the or read the graph of for AR model and MA model then in this case you go the combination of them ARMA with 1 on or maybe 2 to maximum that is it here you can see on the final conclusions for AR process you know right PSA will have a cutoff SCF will have a exponential decay for MA model it is other way SCF will have a cutoff PSA will have exponential decay but for ARMA model look at the decay both will have a exponential decay both will have exponential decay or both will have a cutoff both will have a cutoff clear cutoff clear cutoff so in that case you can select ARMA11 or 22 or 1222 you will be able to you will be able to select the order of the model so this is what the summary of ARMA process we have discussed AR model we have discussed MA model now we have concluded discussed and concluded the ARMA process in the next class we will enter into ARMA model that means auto regressive integrated moving average process where your data will be non-stationary so far we have discussed AR process MA process and ARMA process keeping the assumptions on that data are stationary data are stationary right data are stationary so mean variance etc are not changing much from one block to another block so therefore you will be able to select the AR model and MA model through SCF and PSA graph and you can draw the model as it is but if the data are non-stationary if the data are non-stationary like zigzag model in that case you cannot use this direct data directly to your ARMA model AR MA or ARMA you need to convert this data into a stationary data and then that data you need to use for SCF draw PSA draw as well as the your AR MA or ARMA model in the next class we will discuss detail of auto regressive integrated moving average process that is called ARMA with differencing and decoupler test and then we conclude the session of our module of ARMA. Thank you.