# TIME SERIES ANALYSIS & FORECASTING USING TM1 EMPOWERED BY R (PART 2)

TIME SERIES ANALYSIS & FORECASTING USING TM1 EMPOWERED BY R (PART 2)

# Cognos TM1-R Architecture: ## Contents:

1.Overview of IBM Cognos TM1 (Part 1)
2.Exporting historical data from Cognos TM1 to R (Part 1)
3.Overview of R (Part 2)

4.Importing historical data into R (Part 2)
5.Performing Time series analysis and projecting forecast in R (Part 2)
6.Importing forecast data to Cognos TM1 (Part 2)

### 3.Overview of R

• R has extensive facilities for analyzing time series data.
• R language uses many functions to create, manipulate and plot the time series data.
• It describes the creation of a time series, seasonal decomposition, modeling with Exponential and ARIMA models, and forecasting with the forecast package.
• Time series analysis and forecastingis one of the key fields in statistical programming. It allows you to see patterns in time series data, model this data, and finally make forecasts based on those models
• These are statistical techniques used when several period data for a product or product line are available and when relationships and trends are both clear and relatively stable.
• Now, a time series is a set of chronologically ordered points of raw data for example, a division’s sales of a given product, by month, for several years.

#### Time series analysis helps to identify and explain:

1)Any regularity or systematic variation in the series of data which is due to seasonality.

2)Cyclical patterns that repeat any two or three years or more.

3)Trends in the data.

### 4.Importing historical data into R

• First thing you have to do to analyze time series data is to read it from R and import it.
• Once you have read the time series data into R, the next step is to store the data in a time series object in R, so that you can use R’s many functions for analyzing time series data.
• To store the data in a time series object, we use the ts() function in R. ### 5.Performing Time series analysis and projecting forecast in R

#### a)Plotting Time Series in R:

• Once you have read a time series into R, the next step is usually to make a plot of the time series data, which you can do with the plot.ts () function in R. #### b)Decomposing Time Series in R:

• Decomposing a time series means separating it into its constituent components, which are usually a trend component and an irregular component, and if it is a seasonal time series, a seasonal component.
• You can plot the estimated trend, seasonal, and irregular components of the time series by using the “plot()” function.

#### c)Forecasts using Exponential Smoothing in R:

• Exponential smoothing can be used to make short-term forecasts for time series data.

Simple Exponential Smoothing

• By default HoltWinters () just makes forecasts for the time period covered by the original data.
• You can make forecasts for further time points by using the “forecast. HoltWinters()” function in the R “forecast”
• To make forecasts using simple exponential smoothing in R, you can fit a simple exponential smoothing predictive model using the “HoltWinters ()” function in R.
• To use HoltWinters() for simple exponential smoothing, you need to set the parameters beta=FALSE and gamma=FALSE in the HoltWinters() function (the beta and gamma parameters are used for Holt’s exponential smoothing, or Holt-Winters exponential smoothing)
• The output of HoltWinters() tells us that the estimated value of the alpha parameter value must lie between 0 and 1.
• If the value is very close to zero telling us that the forecasts are based on both recent and less recent observations (although somewhat more weight is placed on recent observations).
• You specify how many further time points you want to make forecasts for by using the “h” parameter in forecast.HoltWinters().
• This is the Process to forecast the values based on historical data. ### 6.Importing forecast data to Cognos TM1 • The action button ‘Data Loading’ loads the generated R-data into cube and same is shown in TM1 web. • This is the Process which you can do forecasting by using R in IBM Cognos TM1.
• For the action button, we can write a TI process to get the data from excel file and import to the model.

#### Note:

The details of TI process not explained here as it is pretty straight forward step.

### Conclusion:

Here is a theoretical base for calculation and application of the exponential smoothing method. The exponential smoothing model is one of the most popular forecasting methods that we use to forecast the next period for a time series.

Categories: TM1