You are here:


Calculates or predicts a future value based on historical data by fitting A Linear Model With Time Series Components including trend and seasonality components. The main advantage of this model is its simple approach which is a linear regression with additional terms of trend and seasonality. The predicted value is a continuation of historical values. You can use this function to predict sales, revenue, inventory, or consumer trends.

This function requires the data to be organized as a series of data observed at each point of time with a constant step between the different points such as monthly, weekly, or daily.


AXCEL.FORECAST.TSLM(data, frequency, start, forecast, [deployment], [plot])

The AXCEL.FORECAST.TSLM function syntax has the following arguments:

data Required. The historical values, for which you want to forecast. You may add external predictors as additional columns. In this case, your external predictor should extend until the end of the forecast horizon. If data has a header, data starts from the second row. Otherwise, the entire vector is considered for the input.

frequency Required. Frequency of your data. 365 for daily, 52 for weekly, 12 for monthly, and 4 for quarterly data. If you do not know the frequency, you can set it as 0. In this case, Axcel automatically identifies the frequency of your data.

start Required. start date of your data in “yyyy-mm-dd” format.

forecast Required. This is the number of periods which we would like to run the forecast.

deployment Optional. You can define a deployment name to deploy your model. After deployment, you can use the deployed function in AXCEL.FORECAST.RUN function. Please note that the deployment name is case sensitive and should include alphabets, numbers, and non-repeating underline. You cannot use underline at the beginning or end of the filename. For instance “abc-123” or “a-b-c-123” are allowed but “abc–123”, “abc-123-“, “-abc-123” or “abc-$123” are not allowed. Depending on your subscription, you can view and restrict access to the deployed model through the Axcel web application.

plot Optional. default is FALSE. When it is TRUE, Axcel produces the plot inside the sidebar. You can expand the plot and show it in your browser. Please note that no plot is produced when deployment is requested. Here is an example of the plot:

when you type =AXCEL.FORECAST.TSLM in an Excel cell, the IntelliSense guides you through required and optional (shown in [] brackets) inputs:

In the example above, we have:

=AXCEL.FORECAST.TSLM(B1:C350, 12, “1992-1-1”,6,,TRUE)

This means that our data is located at cell B1 through C350, it is monthly, i.e. frequency is 12, it starts from January 1, 1992 (1992-01-01), we would like to forecast for 6 months, we skip the deployment and request for plots. After running this command we have:

Please note that TSLM function returns dates in Excel format. As a result you may see numbers instead of dates in data_index column. In this case, you need to change the type of column to “Date” from Excel Home menu.

As shown, fitted values and forecasts are reported in the workbook. The first column is the date index, the second column is the actual values used for training of the model, and the next column is the forecast. Axcel also reports the forecast with 80% and 95% confidence to help the process of decision making.

In the console section in the sidebar, model performance, structure, and statistical indicators are reported for validation and transparency in the process. Here is an example:

-------- TIME SERIES Summary --------- 
Call: tslm(formula = equation) 
    Min     1Q Median    3Q    Max 
-1682.2 -683.3 -275.4 461.7 3010.4 

                 Estimate  Std. Error    t value     Pr(>|t|) 
(Intercept)     6888.3798    282.0309     24.424      < 2e-16 *** 
Unemployment    -387.1169     32.9233    -11.758      < 2e-16 *** 
season2         -216.3344    262.4223     -0.824      0.41033 
season3         1337.2375    262.4142      5.096     5.92e-07 *** 
season4          714.1357    262.4095      2.721      0.00685 ** 
season5         1440.3250    262.4044      5.489     8.19e-08 *** 
season6          897.0797    262.4055      3.419      0.00071 *** 
season7         1155.5699    262.4033      4.404     1.45e-05 *** 
season8         1213.8513    262.4019      4.626     5.40e-06 *** 
season9          -92.9539    262.4048     -0.354      0.72339 
season10         413.8069    262.4101      1.577      0.11579 
season11        -230.2235    262.4149     -0.877      0.38096 
season12        1187.5064    262.4215      4.525     8.49e-06 *** 
trend             59.6121      0.5549    107.432      < 2e-16 *** 
--- Signif. codes: 0 "***" 0.001 "**" 0.01 "*" 0.05 "." 0.1 " " 1 
Residual standard error: 990.4 on 323 degrees of freedom 
Multiple R-squared: 0.9735, Adjusted R-squared: 0.9724 
F-statistic: 911.3 on 13 and 323 DF, p-value: < 2.2e-16

A template for this function is available here:

Sales TSLM Example