I need an equation for a forecast for a simple regression problem(SLR). Please note I am not asking for a prediction value but a forecast. I could not find this in the ETS documentation. Thank you.
Hello,
I have NOT downloaded your *.sas file.
But I want to correct something :
SAS/ETS is not suitable for a single | simple linear regression (SLR), you should do that with SAS/STAT (PROC REG for example).
Moreover, every forecast is a prediction, but not every prediction is a forecast. A forecast looks into the future (generally) and is a time series prediction. A "prediction" as a term is much broader and is any kind of prediction.
I am not sure what your question is for the rest.
Will that become clear when I open the programme?
Can you copy / paste the programme into a reply?
Click on the running man in the toolbar when writing your reply. You can then paste your SAS-code into the window that opens.
Thanks,
Koen
Hello,
I have NOT downloaded your *.sas file.
But I want to correct something :
SAS/ETS is not suitable for a single | simple linear regression (SLR), you should do that with SAS/STAT (PROC REG for example).
Moreover, every forecast is a prediction, but not every prediction is a forecast. A forecast looks into the future (generally) and is a time series prediction. A "prediction" as a term is much broader and is any kind of prediction.
I am not sure what your question is for the rest.
Will that become clear when I open the programme?
Can you copy / paste the programme into a reply?
Click on the running man in the toolbar when writing your reply. You can then paste your SAS-code into the window that opens.
Thanks,
Koen
DATA sixtyEight;
input t y;
cards;
1 47
2 46
3 51
4 44
5 54
6 47
7 52
8 45
9 50
10 51
11 49
12 41
13 48
14 50
15 51
16 55
17 52
18 53
19 48
20 52
;
proc print; run;
proc reg;
model y=t / r p;
run;
So if your x-variable is a sequence number, then in some sense predicting when the sequence number goes beyond the range of the data could be considered a forecast.
In your case, if you got a predicted value for t=21, is that what you want? (I'll bet there are a lot of people trained in statistics who would not call that a forecast ... nevertheless ... is that what you want?)
If so, you don't really need the equation (although if you want it, that's fine), but this trick here allows you to get a predicted value for t=21.
I do want the predicted value for t=21. I am working with the equation
forecast for time t from time t-1 = yhat(t-1)
=y(t)-e_t(1) where
e_t(1) = step 1 ahead error
Thank you for your reply. MM
Now you give us an equation that is not linear regression. It involves time series data. So PROC REG is not appropriate, and just plain wrong.
You do want to use SAS/ETS to fit this model and obtain forecasts. And so I will step aside and allow someone who is more familiar with Time Series modeling to recommend a specific model here.
Hello,
Is it this that you want?
data work.sixtyEight;
set work.sixtyEight end=lastobs;
output;
if lastobs then do;
t=21; y=.; output;
end;
run;
proc autoreg data=sixtyEight;
model y=t / NLAG=(1) method=ML;
output out=p p=yhat pm=ytrend
lcl=lcl ucl=ucl;
run;
QUIT;
proc sgplot data=p;
band x=t upper=ucl lower=lcl;
scatter x=t y=y;
series x=t y=yhat;
series x=t y=ytrend / lineattrs=(color=black);
run;
/* end of program */
Koen
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.