?> arima - WeAreCAS
uniTimeSeries

arima

Description

The `arima` action provides a comprehensive set of tools for univariate time series analysis, focusing on Autoregressive Integrated Moving Average (ARIMA) models. This action allows for the identification, estimation, and forecasting of time series data. It supports a wide range of model specifications, including simple and seasonal ARIMA models, as well as the inclusion of transfer functions for modeling the impact of explanatory variables. The action also provides options for handling missing values, specifying time intervals, and controlling the output tables for detailed analysis of results.

uniTimeSeries.arima <result=results> <status=rc> / alignId="BEGIN" | "END" | "MIDDLE", auxData={{castable-1} <, {castable-2}, ...>}, boundaryAlign="BOTH" | "END" | "NONE" | "START", casOut={casouttable}, display={displayTables}, interval="string", nlFormat=TRUE | FALSE, nThreads=integer, outEst={casouttable}, outFor={casouttable}, outputTables={outputTables}, outStat={casouttable}, seasonality=integer, series={{arimaSeriesStmt-1} <, {arimaSeriesStmt-2}, ...>}, sumOut={casouttable}, table={castable}, tEnd=double | date | datetime, timeId={casinvardesc}, trimId="BOTH" | "LEFT" | "NONE" | "RIGHT", tStart=double | date | datetime ;
Settings
ParameterDescription
alignIdspecifies the time ID alignment.
auxDataspecifies the auxiliary time series data tables.
boundaryAlignspecifies the starting and ending timestamp alignment.
casOutnames the output data table to contain the forecasts of the variables.
displayspecifies the list of display tables that you want the action to create. If this parameter is not specified, all tables are created.
intervalspecifies the time interval (or frequency).
nlFormatwhen set to True, chooses the best international format for the timestamp variable on the basis of the accumulation time interval. When set to False, it chooses the best English-language-based format for the timestamp variable. This option is ignored if you specify the format of the timestamp variable directly.
nThreadsspecifies the number of threads that are used per worker node in a CAS session. Threads are used to both preprocess and analyze input data in parallel. You must specify a value greater than or equal to 0. If you specify 0, which is the default, the number of threads is set to the maximum number of licensed cores.
outEstnames the output data table to contain the model parameter estimates and the associated test statistics and probability values.
outFornames the output data table to contain the forecast time series components (actual, predicted, lower confidence limit, upper confidence limit, prediction error, prediction standard error).
outputTablesspecifies the list of display tables that you want to output as CAS tables. If this parameter is not specified, no tables are output as CAS tables.
outStatnames the output data table to contain the fit statistics.
seasonalityspecifies the number of time periods per seasonal cycle (the default is based on the time interval).
seriesspecifies the name of the series to be modeled and the modeling options.
sumOutnames the output data table to contain the summary statistics and the forecast summation.
tablespecifies the input data table.
tEndspecifies the end of the time window.
timeIdspecifies the timestamp variable.
trimIdspecifies how to trim the time series. None means that no missing values are trimmed. LEFT trims missing values at the beginning of the time series. RIGHT trims missing values at the end of the time series. BOTH trims missing values at both the beginning and end of the time series.
tStartspecifies the start of the time window.
Data Preparation
Data Creation for ARIMA Analysis

This example creates a sample time series dataset named 'series' with a date and a value 'y'. This data will be used in subsequent examples to demonstrate the 'arima' action.

data mycas.series; 
   format date date9.; 
   do date = '01jan2020'd to '31dec2024'd; 
      y = ranuni(1)*100; 
      output; 
   end; 
run;

Examples

This example performs a simple ARIMA model estimation on the 'y' variable from the 'series' table. It specifies a simple autoregressive model of order 1 (p=1) and a simple differencing of order 1 (diff=1).

SAS® / CAS Code
Copied!
1PROC CAS;
2 uniTimeSeries.arima /
3 TABLE={name='series', caslib='mycas'},
4 timeId={name='date'},
5 interval='day',
6 series={name='y', model={estimate={p=1, diff=1}}};
7RUN;
8QUIT;
Result :
The action will produce several output tables, including parameter estimates for the AR(1) model, fit statistics, and model information. The 'ParameterEstimates' table will show the estimated value for the AR1,1 parameter.

This example demonstrates a more complex seasonal ARIMA model. It includes a non-seasonal AR component (p=1), a seasonal AR component (p={factor={12}}), differencing (diff=1), and a seasonal moving average component (q={factor={12}}). It also applies a log transformation to the series. The action will estimate the model and then generate a 12-period forecast, storing the results in 'arima_forecast' and parameter estimates in 'arima_estimates'.

SAS® / CAS Code
Copied!
1PROC CAS;
2 uniTimeSeries.arima /
3 TABLE={name='series', caslib='mycas'},
4 timeId={name='date'},
5 interval='month',
6 seasonality=12,
7 series={name='y', model={estimate={transform='log', p={1, {factor=12}}, q={{factor=12}}, diff=1}, forecast={lead=12}}},
8 outFor={name='arima_forecast', caslib='mycas', replace=true},
9 outEst={name='arima_estimates', caslib='mycas', replace=true};
10RUN;
11QUIT;
Result :
The results will include tables for parameter estimates of the specified seasonal ARIMA model, fit statistics (such as AIC and SBC), and forecast results. The 'arima_forecast' table will contain the 12 forecasted values for 'y' along with their confidence intervals. The 'arima_estimates' table will contain the detailed parameter estimates for the model.

FAQ

What is the purpose of the arima action in the Univariate Time Series Analysis action set?
How do you specify the autoregressive part of an ARIMA model in this action?
What does the 'q' parameter control in the arima action?
Which estimation methods can be used for an ARIMA model?
How can I apply differencing to my time series using the arima action?
What kind of data transformations are available with the 'transform' parameter?
How do I generate forecasts with the arima action?