BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
stat_sas
Ammonite | Level 13

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,

   
 
 
 
 
 
 
 
 
 
 
 





1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

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

6 REPLIES 6
PaigeMiller
Diamond | Level 26

Hard to say, without more VERY BASIC information

What is x?

What is y?

--
Paige Miller
stat_sas
Ammonite | Level 13

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
PaigeMiller
Diamond | Level 26

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)

--
Paige Miller
udo_sas
SAS Employee

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

PGStats
Opal | Level 21

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
stat_sas
Ammonite | Level 13

Thanks PG for suggesting a solution.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

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