Jump to content

Holt Winters Forecasting Data Function Question


Tyler Kendle

Recommended Posts

I'm using the downloaded data function Holt Winters Forecasting to help forecast future sales. My date column contains a monthly dataset of 08/01/2020 - 04/01/2023.

Examples:

08/01/2020

09/01/2020

10/01/2020

11/01/2020

.......

04/01/2023

When I use the data function to predict future n.dates ahead the data table "Forecasted Columns" contains my last date in my input table. In this example, 04/01/2023.

Is that really supposed to be 05/01/2023, as in it's off by one month?

I included two pictures, the first are actual sales through 04/01/2023. The second picture is forecasted through the data function. However, it returned a row with a date of 04/01/2023 as well. Has anyone had a similar issue? Perhaps I'm inputting my data incorrectly, I'm not sure. But I assume my problem is with the n.ahead part of the data function but not 100% sure.

Also, does anyone know if it's possible to change the first input "Data Values" from a column to a Document property where I can give the end user the ability to select a different metric to forecast?

Thank you for your help!

Link to comment
Share on other sites

I tried it with a sample dataset and I did get the last day included in the predictions as well.

To change the Data Values value, you go to the data function 'Edit Parameters...' option, click on Data Values, change the Input handler from Column to Expression, and in the Expression editor type:

[your table].[${your document property}]

where 'your table' will be the name of your table, and 'your document property' will be the name of your document property containing the desired metric to forecast.

Link to comment
Share on other sites

Thank you Gaia.

That custom expression worked. I was an idiot, I was missing the [ ] around my document property. I had it as [table1].${MyStat}

Forgot the brackets around the document property.

Thanks for catching that.

In your opinion should that last day be included in the predictions, as in do you think that is actually one month ahead? Right now, I set up a transformation of DateAdd to adjust the month of that forecasted column by one month. So instead of 04/01/2023 that first date is now switched to 05/01/2023. Or do you think that 04/01/2023 should be ignored?

Link to comment
Share on other sites

This is what I think should fix it.

The predictions are calculated then merged with the sequence of new time steps, and the sequence should not include the last existing time step. So the fix would be to shift the time forward one step.

Edit the data function script (top menu > Data > Data function properties > Edit Script...)

Comment out the line below by prefixing it with # : 

#Timesteps <- as.POSIXct(seq(max(t),by=unit,length.out=n.ahead))

and add these two lines instead:

Timesteps <- as.POSIXct(seq(max(t),by=unit,length.out=n.ahead+1))Timesteps <- Timesteps[-1]

Press Save then Close.

This would generate the time steps ahead starting with one step after the last one.

Link to comment
Share on other sites

  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...