.

Friday, March 8, 2019

Time Series

IntroductionA season serial publication is a set of manifestations, xi severally one being preserve at a specific beat t. After being recorded, these information argon rigorously studied to explicate a pretence. This model allow then be employ to construct future(a) tense take to be, in different words, to shape a forecast. When looking at a sentence serial publication, several(prenominal) questions must be askedDoes the sequence serial have a sheer or seasonal workerity?Are their tabooliers?Is in that respect constant fluctuation everywhere m?Essential of Good eon serialThe selective information must be dour enough.There must be equal fourth dimension gap.There must be a normal full point. pillow slip1The pursuance eyepatch is a duration serial plot of the annual figure of earthquakes in the world with seismic magnitude everyplace 7.0, for 99 succeeding(prenominal) divisions.By a clock series plot, we solely recall that the covariant is plotted against time.Some features of the plotThere is no vogue.The mean of the series is 20.2.There is no seasonality as the data atomic crook 18 annual data.There be no outliers.Example 2 This shows a time series of quarterly achievement of beer in Australia for 18 years.Some features argonThere is an change magnitude trend.There is seasonality.There atomic number 18 no outliers.The Components of epoch serialThe components of time series are factors that stool accept changes to the time seriesTrend component, TtWhen in that location is an increase or a decrease over a long stay of time in the data, then we think that there is a trend. Sometimes, a trend is say to be changing direction when it goes from an increasing trend to a diminish one. It is the result of events much(prenominal)(prenominal) as price inflation, population growth or economic changes.Seasonal component, StA seasonal pattern exists when the time series exhibits rhythmical variations at specif ic time. It arises from influences such as natural conditions or favorable and cultural carriages. For example, the sales of ice-cream are relatively high in summer. So, the salesman expects great profit in summer than in winter.Cyclic component, CtIf the time series shows an up and down style around a haltn period of time, it is said to have a cyclical pattern.Irregular component, ItIrregular components consist of changes that are supposed(prenominal) to be repeated in a time series. Examples are floods, fires, earthquakes or cyclones.Combining the time series components cadence series is a combination of the components which were discussed above.These components piece of tail be either combined additively or increasingly.Additive modelIt is unidimensional, and the changes are made by the akin amount over time.Yt = Tt + Ct + St + ItMultiplicative modelIt is non-linear such as quadratic polynomial or exponential, and the changes increase or decrease over time.Yt = Tt Ct St ItUsesTime series evict be useful in the following palmStatisticsSignal military operationingEconometricsMathematical financeAstronomyEarthquake predictionsWeather forecastingImportance of Time series for occupationesThere are many benefits of time series for business purposes implemental for content of by yesteryear behaviorBusinessmen use time series to study the past behaviors and to catch out the trend of the sales or profit of their businesses.Helpful in forecastingTime series is a great tool for forecasting. Businesses skunk situate a time series of the past strategies of their competitors and perplex an estimate of their future strategies. In this way, they do work laughingstock built a better dodging and create more profits.Helpful in comparisonTime series force out be used to calculate the trend of devil or more branches of the akin high society and compare their performance. On their performances, rewards washbowl be given.However, time series can ha ve some limitations for a business. Sales forecasting relies on the past results to predict future expectations. But, if a company is new, there is a cease amount of data to wee-wee predictions. Even so, past results do non always indicate what the future sales pull up stakes be.To fully take this topic, we get out work out this example.Example 2We depart consider the real(a) arrival of passengers from an airport over the year 1949 to 1960. From these data, we go forth make a forecast.The fore more or less step is to plot the data and obtain descriptive whole tones such as trends or seasonal fluctuations.The sec step is to micro chip for the stationarity of the time series.StationarityA time series is said to be nonmoving if its mean and variance does non change over time. Obviously, non all the time series that we encounter are nonmoving.It is momentous because, most of the models we work on, pretends that the time series is stationary. If the time series has t he same behavior over time, there entrust be a high luck that it will follow the same trend in the future.How to check for stationarity?For the represent that was plotted, we can see that it has an increasing trend with some seasonal pattern.But, it is not always evident to see whether a plot is increasing or has a seasonal trend. We can check for stationarity using the followingPlotting roster statisticsWe plot the moving come or variance and see whether it changes with time. But, as it is a visual technique, we will take more consideration for the side by side(p) canvas.Dickey-Fuller quizIt is one of the statistical methods to check for stationarity. The deceitful hypothesis is that the time series is non-stationary, and the alternative hypothesis is the converse.As shown below, the block out consists of the test statistics and unfavourable set at different significant levels. If the test statistics is less than the critical value, we reject the null hypothesis.Results o f Dickey-Fuller Test Test Statistic 0.815369p-value 0.991880Lags utilize 13.000000Number of Observations Used 130.000000Critical survey (1%) -3.481682Critical Value (5%) -2.884042Critical Value (10%) -2.578770According to the Dickey-Fuller test, the test statistics is less than the critical value.Therefore, the time series is not stationary. However, there are various methods to make a time series stationary.How to make a time series stationary?The assumption of stationarity is very primary(prenominal) when modelling a time series, but most of the practical time series are not stationary. Eventually, we cannot make a time series one hundred part stationary, most of the time, it will be with a confidence of 99%.Before termination into detail, we will discuss on the reasons why the time series is not stationary.There are twain study reasons to that, trend and seasonality.Having discuss the reasons, we will now talk about the techniques to make the time series stationaryTransfor mationLog transformation is probably the most commonly used form of transformation.DifferencingDifferencing is a widely used method to make the time series stationary. It is performed by subtracting the anterior observation from the current one. When making the forecast, the process of differencing must be inverted to convert the data hindquarters to its reliable scale. This can be do by adding the difference value to the previous value.Using the Dickey-Fuller test we can see that the test statistic is -2.717131 and that the critical value at 1%, 5% and 10% are -3.482501, -2.884398 and -2.578960 respectivelyThe time series is stationary with 90% confidence. The endorse or third come in differencing can be done to get better results.DecompositionIn decomposition, the time series is shared into several components in the first place trend, cyclical, seasonal and irregular components.The time series can sometimes be broken down into an additive or multiplicative model.We will a ssume a multiplicative model for our example.Since the trend and seasonality were stray from the residues, we can check the stationarity of the residuals.Results of Dickey-Fuller Test is test statistic is -6.332387e+00 and the critical determine at 1%, 5% and 10% are -3.485122e+00, -2.885538e+00 and -2.579569e+00 respectively.We can conclude that the time series is stationary at 99% confidence.Now, we can go previous with the forecasting. soothsaying the time seriesWe will fit this time series using the ARIMA model, ARIMA is an acronym that stands for Autoregressive integrate Moving Average. It is a linear equation similar to a linear regression.The first design is to find the value of the predictors (p, d, q), but before conclusion these values, two situations in stationarity must be discussed.A strictly stationary series without any dependance among the values. In this case, we can model the residual as white noise.The second case is a series with significant dependency a mong the values.The predictors mainly depend on the parameters (p, d, q) of the ARIMA modelNumber of AR(Auto-Regressive) basis (p)It is the number of lag observation that were included in the model. This term helps to stop the effect of the past values into the model.Number of MA (Moving Average) terms (q)It is the surface of the moving average window, that is, this term sets the faulting of the model as a linear combination of the error values observed at previous time points in the past.Number of differences(d)The number of times that the raw observations are differenced.In order to obtain the values of p and q, we will use the following two plotsAutocorrelation Function, ACFThis function will measure the correlation of the time series with its lagged sport. overtone Autocorrelation Function, PACFThis function measures the correlation amid the time series with a lagged version of itself, controlling the values of the time series at all shorter lagsIn the ACF and PACF plots, the extend lines are the confidence interval, these values are p and q. The value of p is obtained from the PACF plot and the value of q is obtained from the ACF plot. We can see that both p and q are 2.Now, that we have obtained p and q, we will make three different ARIMA model AR, MA and the combined model. The RSS of each of the model will be given.AR modelMA modelCombined modelFrom the plots, it is distinctly shown that the RSS of AR and MA are the same and that of the combined is much better. As the combined model give a better result, the following step will take the values back to its original scale.The predicted results are stored.The differencing is converted the log scale. This can be done by adding the differences consecutively to the al-Qaida numbers.The exponent is taken and is compared to the original scale.Therefore, we have the final result.ReferencesAarshay Jain(2016) A all-embracing beginners guide to create a Time series Forecast (with Codes in Python) WWW in stock(predicate) from https//www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/ Accessed 14/04/18Maxime Phillot (2017)How do I interpret the results in an augmented Dickey-Fuller test? WWW Available from https//www.quora.com/How-do-I-interpret-the-results-in-an-augmented-Dickey-Fuller-test Accessed 23/04/18Jason Brownlee (2016)What Is Time Series Forecasting? WWW Available from https//machinelearningmastery.com/time-series-forecasting/ Accessed 23/04/18Chris St.Jeor and Sean Ankenbruck (2018)Time Series for dummies- The 3 step process WWW Available from https//www.kdnuggets.com/2018/03/time-series-dummies-3-step-process.html Accessed 22/04/18Pennsylvania state university (n. d) Overview of Time Series Characteristics WWW Available from https//onlinecourses.science.psu.edu/stat510/lymph gland/47 Accessed 22/04/18Time SeriesA time series is a set of observations, xi each one being recorded at a specific time t. After being recorded, these data are rigorously studied to develop a model. This model will then be used to realise future values, in new(prenominal) words, to make a forecast.Important Characteristics to Consider FirstWhen first looking at a time series, some questions must be askedDoes the time series has a trend or seasonality over time?Are their outliers? With time series data, the outliers are far away from the other data.Is there a long-run cycle or period?Is there constant variance over time?Essential of Good time series Data must be for a sufficient period Equal time ga Constant or normal period.Example1The following plot is a time series plot of the annual number of earthquakes in the world with seismic magnitude over 7.0, for 99 consecutive years. By a time series plot, we simply mean that the variable is plotted against time.Some features of the plotThere is no trend.The mean of the series is 20.2There is no seasonality as the data are annual data.There are no outliers.Example 2 The plot at the top of the next page shows a time series of quarterly production of beer in Australia for 18 years.Some important features areThere is an increasing trend.There is seasonality.There are no obvious outliers.The Components of Time SeriesThe components of time series are factors that can bring changes to the time seriesTrend component, TtWhen there is an increase or a decrease over a long period of time in the data, then we say that there is a trend.Sometimes, a trend is said to be changing direction when it goes from an increasing trend to a decreasing one. It is the result of events such as price inflation, population growth or economic changes.Seasonal component, StA seasonal pattern exists when the time series exhibits regular fluctuations at specific time. It arises from influences such as natural conditions or social and cultural behaviors. For example, the sales of ice-cream are relatively high in summer.So, the salesman expects greater profit in summer than in winter. Cyclic component, CtIf the tim e series shows an up and down movement around a given period of time, it is said to have a cyclical pattern.Irregular component, ItIrregular components consist of changes that are unlikely to be repeated in a time series. Examples are floods, fires, earthquakes or cyclones.Combining the time series componentsTime series is a combination of the components which were discussed above.These components can be either combined additively or multiplicatively.Additive modelIt is linear, and the changes are made by the same amount over time.Yt = Tt + Ct + St + ItMultiplicative modelIt is non-linear such as quadratic or exponential, and the changes increase or decrease over time.Yt = Tt Ct St ItUsesTime series can be useful in the following fieldsStatisticsSignal processingEconometricsMathematical financeAstronomyEarthquake predictionsWeather forecastingImportance of Time series for businessesThere are many benefits of time series for business purposesHelpful for study of past behaviorBusine ssmen use time series to study the past behaviors and to see the trend of the sales or profit of their businesses.Helpful in forecastingTime series is a great tool for forecasting. Businesses can make a time series of the past strategies of their competitors and make an estimate of their future strategies. In this way, they make can built a better strategy and make more profits.Helpful in comparisonTime series can be used to calculate the trend of two or more branches of the same company and compare their performance. On their performances, rewards can be given.However, time series can have some limitations for a business. Sales forecasting relies on the past results to predict future expectations. But, if a company is new, there is a limited amount of data to make predictions. Even so, past results do not always indicate what the future sales will be.To fully understand this topic, we will work out this example.Example 2We will consider the actual arrival of passengers from an airp ort over the year 1949 to 1960. From these data, we will make a forecast.The first step is to plot the data and obtain descriptive measures such as trends or seasonal fluctuations.The second step is to check for the stationarity of the time series.StationarityA time series is said to be stationary if its mean and variance does not change over time. Obviously, not all the time series that we encounter are stationary. It is important because, most of the models we work on, assumes that the time series is stationary.If the time series has the same behavior over time, there will be a high probability that it will follow the same trend in the future.How to check for stationarity?For the graph that was plotted, we can see that it has an increasing trend with some seasonal pattern. But, it is not always evident to see whether a plot is increasing or has a seasonal trend. We can check for stationarity using the followingPlotting rolling statisticsWe plot the moving average or variance and s ee whether it changes with time.But, as it is a visual technique, we will take more consideration for the next test.Dickey-Fuller testIt is one of the statistical methods to check for stationarity. The null hypothesis is that the time series is non-stationary, and the alternative hypothesis is the converse.As shown below, the test consists of the test statistics and critical values at different significant levels. If the test statistics is less than the critical value, we reject the null hypothesis.Results of Dickey-Fuller Test Test Statistic 0.815369p-value 0.991880Lags Used 13.000000Number of Observations Used 130.000000Critical Value (1%) -3.481682Critical Value (5%) -2.884042Critical Value (10%) -2.578770According to the Dickey-Fuller test, the test statistics is less than the critical value. Therefore, the time series is not stationary.However, there are various methods to make a time series stationary.How to make a time series stationary?The assumption of stationarity is very important when modelling a time series, but most of the practical time series are not stationary. Eventually, we cannot make a time series one hundred percent stationary, most of the time, it will be with a confidence of 99%.Before going into detail, we will discuss on the reasons why the time series is not stationary.There are two major reasons to that, trend and seasonality.Having discuss the reasons, we will now talk about the techniques to make the time series stationaryTransformationLog transformation is probably the most commonly used form of transformation.DifferencingDifferencing is a widely used method to make the time series stationary. It is performed by subtracting the previous observation from the current one.When making the forecast, the process of differencing must be inverted to convert the data back to its original scale. This can be done by adding the difference value to the previous value.Using the Dickey-Fuller test we can see that the test statistic is -2.717131 and that the critical values at 1%, 5% and 10% are -3.482501, -2.884398 and -2.578960 respectivelyThe time series is stationary with 90% confidence. The second or third order differencing can be done to get better results.DecompositionIn decomposition, the time series is divided into several components mainly trend, cyclical, seasonal and irregular components.The time series can sometimes be broken down into an additive or multiplicative model.We will assume a multiplicative model for our example.Since the trend and seasonality were separated from the residuals, we can check the stationarity of the residuals.Results of Dickey-Fuller Test is test statistic is -6.332387e+00 and the critical values at 1%, 5% and 10% are -3.485122e+00, -2.885538e+00 and -2.579569e+00 respectively.We can conclude that the time series is stationary at 99% confidence.Now, we can go forward with the forecasting.Forecasting the time seriesWe will fit this time series using the ARIMA model, ARIMA is an acron ym that stands for Autoregressive Integrated Moving Average. It is a linear equation similar to a linear regression. The first goal is to find the values of the predictors (p, d, q), but before finding these values, two situations in stationarity must be discussed.A strictly stationary series without any dependence among the values. In this case, we can model the residual as white noise.The second case is a series with significant dependency among the values.The predictors mainly depend on the parameters (p, d, q) of the ARIMA modelNumber of AR(Auto-Regressive) terms (p)It is the number of lag observation that were included in the model. This term helps to incorporate the effect of the past values into the model.Number of MA (Moving Average) terms (q)It is the size of the moving average window, that is, this term sets the error of the model as a linear combination of the error values observed at previous time points in the past.Number of differences(d)The number of times that the ra w observations are differenced.In order to obtain the values of p and q, we will use the following two plotsAutocorrelation Function, ACFThis function will measure the correlation of the time series with its lagged version.Partial Autocorrelation Function, PACFThis function measures the correlation between the time series with a lagged version of itself, controlling the values of the time series at all shorter lagsIn the ACF and PACF plots, the dotted lines are the confidence interval, these values are p and q. The value of p is obtained from the PACF plot and the value of q is obtained from the ACF plot. We can see that both p and q are 2.Now, that we have obtained p and q, we will make three different ARIMA model AR, MA and the combined model.The RSS of each of the model will be given.AR modelMA modelCombined modelFrom the plots, it is clearly shown that the RSS of AR and MA are the same and that of the combined is much better. As the combined model give a better result, the follo wing steps will take the values back to its original scale.The predicted results are stored.The differencing is converted the log scale. This can be done by adding the differences consecutively to the base numbers.The exponent is taken and is compared to the original scale.Therefore, we have the final result.ReferencesAarshay Jain(2016) A comprehensive beginners guide to create a Time Series Forecast (with Codes in Python) WWW Available from https//www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/ Accessed 14/04/18Maxime Phillot (2017) How do I interpret the results in an augmented Dickey-Fuller test? WWW Available from https//www.quora.com/How-do-I-interpret-the-results-in-an-augmented-Dickey-Fuller-test Accessed 23/04/18Jason Brownlee (2016) What Is Time Series Forecasting? WWW Available from https//machinelearningmastery.com/time-series-forecasting/ Accessed 23/04/18Chris St.Jeor and Sean Ankenbruck (2018) Time Series for dummies- The 3 step process WWW A vailable from https//www.kdnuggets.com/2018/03/time-series-dummies-3-step-process.html Accessed 22/04/18Pennsylvania state university (n. d) Overview of Time Series Characteristics WWW Available from https//onlinecourses.science.psu.edu/stat510/node/47 Accessed 22/04/18

No comments:

Post a Comment