# Time Series Analysis

Time series data is obtained by observing a phenomenon over time. Examples of time series data are the daily rainfall patterns of a place, the daily or monthly stock prices, and the daily sales of a supermarket. In time series analysis, we are often interested in the fact that the changes in time could possess a structure such as trend or seasonality, which should be analyzed. These types of data can be described as being univariate or multivariate. A time series data is Univariate if it accounts for a single phenomenon. An example is the daily sales of a supermarket. Multivariate time series accounts for more than two phenomena. Despite the differences in the univariate and multivariate time series data, we analyze the two using the same methodology.

Seasonality, stationarity and autocorrelation

These are the key components that come into play at the start of any time series analysis. Seasonality implies the periodic fluctuations of a phenomenon. For instance, in measuring the rainfall of a place, we expect that the highest rainfall should be during the winter and the lowest rainfall accounted for during the summer. Seasonality can be derived by plotting the ACF plot in r.

The main requirement here is that the statistical properties of the data set should not vary over time. In other words, the variance and the mean of the data should not change, and the covariance should be independent of time .such a time series data is said to be stationary. This property is so essential in time series analysis. If the data isn’t stationary, the analyst has to make the data stationary.

Autocorrelation is the similarity of the data points over time as a function of the lag time.It is a requirement in time series analysis, that the data should exhibit stationary characteristics. If it is not, we make it stationary using some statistical means. There are statistical tests that you can run other than visualization to test for stationarity. Dickey-Fuller test is the most commonly used. In this test, it runs a hypothesis test to test the stationarity characteristics in the data under analysis. The null hypothesis for the Dickey-fuller test is that the data has attained stationarity, and the alternative hypothesis is the data hasn’t. We check for the p-value under a significance level. If the p-value is greater than the significance level, we conclude that the null hypothesis is correct. Otherwise, we reject the null hypothesis.

Modelling time series data.

There are a lot of models that can be used for time-series data modelling. Once you have fitted the model into the data, you can start forecasting. Here, we only focus on four of them.

Moving average.

Moving average model state that the current value of the data is as a result of the mean of the past variables. It is an important model that can help us identify the trends in the data. A moving average can be of order n, where n is a real number. By order of moving average, we mean that the current value is as a result of averaging the past n values.

Exponential smoothing

More similar to the moving average. In the moving average, the weights were awarded equally to the past observation, but here they are awarded a decreasing weight.The farther away from the central observation a point is, the lesser weight it gets.

Autoregressive model

This model applies a regression analysis on the past data points. Here, the response variable from the previous point becomes the explanatory variable for the current point. The assumptions of regression analysis on the errors are applicable in this model.

Autoregressive integrated moving average

This is a superior model that combines the characteristic of an autoregressive model and the moving average model. The method of fitting this model is referred to as box-Jenkins approach.

Time series analysis using R

R is one of the most used statistical software that is freely available. R is well equipped with all the packages that you could need for any form of analysis. For time series analysis, you can use packages such as zoo, tseries and forecast. In case, you find anything challenging or want clarification. You can contact our online time series analysis (univariate and multivariate) assignment, tutors. We also provide time series (univariate and multivariate) assignment help to students around the world.