【发布时间】:2021-12-30 17:10:13
【问题描述】:
我使用 proc ARIMA 来获取我的数据集下一年的预测,并有一个包含这些预测值的输出数据集。
我将原始数据的对数用于预测,因此我需要通过对预测值取指数来获得真实值。
我想要一个图表来显示数据的预测方式以及与原始数据相比的外观,但我不知道如何执行此操作。
代码:
* Open the file;
data intel_stock;
infile 'path' dlm=',' firstobs=2;
input Date anydtdte10. Volume;
format Date date10.;
Timeref=_n_;
logvolume = log(Volume);
run;
* Plot the data ;
proc sgplot data=intel_stock;
series x=Timeref y=Volume/markers;
xaxis values=(1 to 5000 by 1);
run;
* Variation seems to increase greatly over time, hence we take the log of volume ;
proc sgplot data=intel_stock;
series x=Timeref y=logvolume/markers;
xaxis values=(1 to 5000 by 1);
run;
* Plot shows a good amount of variance removed ;
* selecting an ARIMA model ;
proc arima data=intel_stock;
identify var= logvolume(1); * first difference was taken to make the data stationary ;
estimate p = 2 q = 2 ;
forecast lead=12 interval=month id=Date out=forecast;
run;
* ARIMA(2,1,2) model was used;
【问题讨论】:
标签: plot sas time-series forecasting arima