Forecasting using SAS Forecast Server, SAS/ETS, and more

Polynomial equation for sales forecast

Accepted Solution Solved
Reply
Trusted Advisor
Posts: 1,228
Accepted Solution

Polynomial equation for sales forecast

Hi Experts,

I've 12 months data (Number of orders) and trying to explore a model which can be used for forecasting. I found 2nd degree polynomial model which seems to represent pattern in a better way.  Value of R²=0.70. Please see below the equation.

y = 308.77x2 - 2662.8x + 31837

Can we use polynomial equation for sales forecast? My concern is when we go further into fututre orders per month will soon be doubled which business people will not accept. Any suggestions on this one please. I've attached chart for your review please.

Regards,

   
 
 
 
 
 
 
 
 
 
 
 






Accepted Solutions
Solution
‎04-09-2014 05:12 PM
Respected Advisor
Posts: 4,919

Re: Polynomial equation for sales forecast

I agree with Paige Miller. Fitting a quadratic curve to a time series is perilous. With twelve points, you will necessarily have to make many assumptions to build any kind of predictive model. For example

1) There is a trend that will go on next year

2) There is a seasonal pattern that will repeat next year

Those could lead to the following additive model:

data test;

infile datalines missover;

input month Orders;

yearMonth = mod(month,12);

actual= not missing(orders);

datalines;

1 26156

2 32396

3 27415

4 24129

5 30350

6 21992

7 24705

8 36434

9 28858

10 37353

11 43137

12 42119

13

14

15

16

17

18

19

20

21

22

23

24

;

title;

proc gam data=test;

model orders = param(month) spline(yearmonth);

output out=gamout predicted;

run;

proc sgplot data=gamout;

series x=month y=p_orders/ group=actual;

scatter x=month y=orders;

yaxis min=0;

run;

SGPlot7.png

PG

View solution in original post


All Replies
Trusted Advisor
Posts: 1,909

Re: Polynomial equation for sales forecast

Hard to say, without more VERY BASIC information

What is x?

What is y?

Trusted Advisor
Posts: 1,228

Re: Polynomial equation for sales forecast

Posted in reply to PaigeMiller

Hi Paige,

x is month (From 1 to 12)

y is number of orders

Please see below table that contains month, orders and predicted orders. At month 20 predicted orders become almost 100,000.

Regards,

y = 308.77x2 - 2662.8x + 31837
monthOrdersPredicted Orders
12615629482.97
23239627746.48
32741526627.53
42412926126.12
53035026242.25
62199226975.92
72470528327.13
83643430295.88
92885832882.17
103735336086
114313739907.37
124211944346.28
1349402.73
1455076.72
1561368.25
1668277.32
1775803.93
1883948.08
1992709.77
20102089
Trusted Advisor
Posts: 1,909

Re: Polynomial equation for sales forecast

The idea that month number has a quadratic relationship with orders ... well, let me just say that this is bizarre ... I wouldn't use such a model, even if the R-squared was 0.7. You have discovered a coincidence, not a predictive model.

Normally, forecasts of economic activity ... in this case orders ... are based upon time series models, perhaps with some seasonality built in, with X being some measures of customer's economic well being, or the economic well being of the economy as whole (or both)

SAS Employee
Posts: 416

Re: Polynomial equation for sales forecast

Hello -

This might be a little bit off topic, but R square should not be used for time series forecasts. For one thing, it overlooks bias in forecasts. A model can have a perfect R square, yet the values of the forecasts could be substantially different from the values for all forecasts. Also, a model could have an R square of zero but provide perfect forecasts if the mean were forecasted correctly and no variation occurred in the data.

See: http://repository.upenn.edu/cgi/viewcontent.cgi?article=1182&context=marketing_papers for more details.

Thanks,

Udo

Solution
‎04-09-2014 05:12 PM
Respected Advisor
Posts: 4,919

Re: Polynomial equation for sales forecast

I agree with Paige Miller. Fitting a quadratic curve to a time series is perilous. With twelve points, you will necessarily have to make many assumptions to build any kind of predictive model. For example

1) There is a trend that will go on next year

2) There is a seasonal pattern that will repeat next year

Those could lead to the following additive model:

data test;

infile datalines missover;

input month Orders;

yearMonth = mod(month,12);

actual= not missing(orders);

datalines;

1 26156

2 32396

3 27415

4 24129

5 30350

6 21992

7 24705

8 36434

9 28858

10 37353

11 43137

12 42119

13

14

15

16

17

18

19

20

21

22

23

24

;

title;

proc gam data=test;

model orders = param(month) spline(yearmonth);

output out=gamout predicted;

run;

proc sgplot data=gamout;

series x=month y=p_orders/ group=actual;

scatter x=month y=orders;

yaxis min=0;

run;

SGPlot7.png

PG
Trusted Advisor
Posts: 1,228

Re: Polynomial equation for sales forecast

Thanks PG for suggesting a solution.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 1961 views
  • 9 likes
  • 4 in conversation