uniTimeSeries arima

Edge Case: Electricity Demand Forecast with Missing Data and Transformation

Scénario de test & Cas d'usage

Business Context

A utility provider needs to forecast hourly electricity demand. The data is collected from sensors which are prone to intermittent failures, leading to gaps in the time series. Furthermore, the demand's volatility increases during peak hours, suggesting a non-constant variance that requires a data transformation for model stability.
About the Set : uniTimeSeries

Analysis and forecasting of univariate time series.

Discover all actions of uniTimeSeries
Data Preparation

Creation of an hourly time series for one month. We intentionally introduce missing values for the 'demand' variable to simulate sensor outages. The data's variance is also made to increase over time to justify a transformation.

Copied!
1DATA mycas.hourly_demand;
2 FORMAT timestamp datetime20.;
3 DO i = 0 to 720;
4 timestamp = intnx('hour', '01jan2024:00:00:00'dt, i);
5 base_demand = 500 + 100 * sin(2 * 3.14159 * (hour(timestamp) / 24));
6 demand = base_demand + (i/10) * rannor(54321);
7 IF ranuni(1) > 0.95 THEN call missing(demand); /* Introduce 5% missing values */
8 OUTPUT;
9 END;
10RUN;

Étapes de réalisation

1
Execute the arima action, specifying a Box-Cox transformation to stabilize variance. The 'trimId' parameter is set to 'BOTH' to handle potential leading/trailing missing values, and Maximum Likelihood ('ML') is chosen as the estimation method.
Copied!
1PROC CAS;
2 uniTimeSeries.arima /
3 TABLE={name='hourly_demand', caslib='mycas'},
4 timeId={name='timestamp'},
5 interval='hour',
6 trimId='BOTH',
7 series={name='demand', model={estimate={transform='BOXCOX', p=1, diff=1, method='ML'}, forecast={lead=24}}},
8 outFor={name='demand_forecast', caslib='mycas', replace=true},
9 outStat={name='demand_stats', caslib='mycas', replace=true};
10RUN;
11QUIT;

Expected Result


The action must complete without errors, demonstrating its ability to handle embedded missing values. The 'demand_stats' output table should show the fit statistics for the model applied to the Box-Cox transformed series, and it should also report the selected lambda for the transformation. The 'demand_forecast' table will contain 24 hours of forecasted demand, correctly back-transformed to the original scale.