SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 1 Vol 2

ARMA

Name:
    ARMA
Type:
    Analysis Command
Purpose:
    The ARMA command is used to fit an autoregressive/moving average (ARMA) model to a univariate time series.
Description:
    ARMA models are a method for modeling univariate time series.

    Autoregressive models are defined by:

      \( X_t = \bar{X} + \phi_{1} X_{t-1} + \phi_{2} X_{t-2} + ... + \phi{p} X_{t-p} + A_t \)

    where Xt is the series and \(\bar{X}\) is the mean of the series, At represent normally distributed random errors, and the \(\phi_1, ..., \phi_p\) are the parameters of the model. Autoregressive models are simply a linear regression of the current value of the series against one or more prior values of the series. The value of p is called the order of the model.

    Moving average models are defined by:

      \( X_t = \bar{X} + A_{t} - \theta_{1} A_{t-1} - \theta_{2} A_{t-2} - ... - \theta{q} A_{t-q} \)

    where Xt is the series and \(\bar{X}\) is the mean of the series, At-i represent random shocks of one or more prior points of the series, and the \(\theta_1, ..., \theta_q\) are the parameters of the model. The random shocks are assumed to come from a common (typically normal) distribution with common location and scale. The primary idea behind the moving average model is that the random shocks are propogated to future values of the series. Fitting moving average models require iterative, non-linear fitting techniques.

    The power of ARMA models is that they can incorporate both autoregressive terms and moving average terms. The use of ARMA models was popularized by Box and Jenkins. Although both AR and MA models were previously known and used, Box and Jenkins provided a systematic approach for modeling both AR and MA terms in the model. ARMA models are also commonly known as Box-Jenkins models or ARIMA models.

    ARMA models assume that the data are stationary, i.e. the data have constant location and scale. Trend can often be removed from a nonstationary series to achieve stationarity. Differencing is a common approach for removing trend. The first difference is defined as Xt - Xt-1. In most cases, a single differencing is sufficient. However, more than one differencing can be applied if necessary. You can also fit a linear or non-linear model to remove trend.

    ARMA models can also incorporate seasonal terms (and seasonal differencing). See Box and Jenkins for the complete mathematical description of this model.

    ARMA models typically require fairly long series (at least 50 points is recommended by some authors). Also, if the series is dominated by trend and seasonal components, a trend/seasonality/residual decomposition method may be preferred. Dataplot supports a SEASONAL LOWESS command for this type of decomposition.

    The typical components for fitting ARMA models is:

    1. Model Identification
    2. Model Fitting
    3. Model Validation

    The ARMA command addresses (2), model fitting. Model identification for ARMA models can be difficult and require a fair amount of experience. See the various time series texts that describe ARMA modeling for more guidance on ARMA model identification. Model validation is similar to the nonlinear fitting case (i.e., various residual plots). Again, see texts that describe nonlinear model fitting.

Syntax:
    ARMA <y> <diff> <ma> <sar> <sdiff> <sma> <speriod>
                            <SUBSET/EXCEPT/FOR qualification>
    where <y> is the response variable;
                <ar> is the order of the auto-regressive terms;
                <diff> is the number of differences to apply (typically 0, 1, or 2);
                <ma> is the order ot the moving average terms;
                <sar> is the order of seasonal auto-regressive terms;
                <sdiff> is the number of seasonal differences to apply (typically 0, 1, or 2);
                <sma> is the order of seasonal moving average terms;
                <speriod> is the period for seasonal terms (defaults to 12);
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    If there is no seasonal component, the <sar>, <sdiff>, <sma>, and <speriod> terms can be omitted.

Examples:
    ARMA Y 2 0 1
    ARMA Y 2 0 1 1 0 1 12
Note:
    To minimize the amount of screen output, but to also to keep the maximum amount of information, Dataplot writes most of the output to files. Speficially,

    • dpst1f.dat - the parameters and the standard deviations of the parameters from the ARMA fit. The order is:
      1. Autoregressive terms
      2. Seasonal autoregressive terms
      3. Mean term
      4. Moving average terms
      5. Seasonal moving average terms
    • dpst2f.dat - this file contains:
      1. Row number
      2. Original series (i.e., Y)
      3. Predicted values
      4. Standard deviation of predicted values
      5. Residuals
      6. Standardized residuals
    • dpst3f.dat - Intermediate outut from iterations before convergence. This is generally useful if the ARMA fit does not converge.
    • dpst4f.dat - The parameter variance-covariance matrix.
    • dpst5f.dat - The forecast values for (N/10)+1 observations ahead. Specifically,
      1. The forecasted values
      2. The standard deviation of the forecasted values.
      3. The lower 95% confidence band for the forecast.
      4. The upper 95% confidence band for the forecast.
Note:
    Dataplot allows you to define the starting values by defining the variable ARPAR. The order of the parameters is as given for the file dpst1f.dat above. By default, all parameters are set to 0.5 except for the mean term which is set to 0.

    In addition, you can define the variable ARFIXED to fix certain parameters to their start values. That is, you define ARPAR to specify the start values. If the corresponding element of ARFIXED is zero, the parameter is estimated as usual. If ARFIXED is one, then the parameter is fixed at the start value. The most common use of this is to set certain parameters to zero. For example, if you fit an AR(2) model and you want the AR(1) term to be zero, you could enter the following:

      LET ARPAR = DATA 0 1
      LET ARFIXED = DATA 1 0
Note:
    Dataplot uses the STARPAC library (developed by Janet Rogers and Peter Tyrone of NIST) to compute the ARIMA estimates.
Default:
    None
Synonyms:
    None
Related Commands: Reference:
    Box and Jenkins (1976), "Time Series Analysis: Forecasting and Control," Holden-Day,

    Chatfield (1989), "The Analysis of Time Series: An Introduction," Fourth Edition, Chapman & Hall.

Applications:
    Time Series Analysis
Implementation Date:
    2000/1
Program:
     
    skip 0
    set read format 3e16.4
    read negiz4.dat junk1 junk2 y
    set read format
    delete junk1 junk2
    let arpar = data 0.1 0.1 0.1
    arma y 3 0 0
        
    This program generates the following output.
           ************************************
           **  let arpar = data 0.1 0.1 0.1  **
           ************************************
      
      
     THE NUMBER OF VALUES GENERATED FOR THE VARIABLE ARPAR    =        3
      
     THE FIRST           COMPUTED VALUE OF ARPAR    =   0.1000000E+00   (ROW      1)
     THE LAST (    3-TH) COMPUTED VALUE OF ARPAR    =   0.1000000E+00   (ROW      3)
      
     THE CURRENT COLUMN FOR THE VARIABLE ARPAR    =        2
     THE CURRENT LENGTH OF  THE VARIABLE ARPAR    =        3
      
      
           ********************
           **  arma y 3 0 0  **
           ********************
      
      
     #############################################################
     #  NONLINEAR LEAST SQUARES ESTIMATION FOR THE PARAMETERS OF #
     #  AN ARIMA MODEL USING BACKFORECASTS                       #
     #############################################################
      
      SUMMARY OF INITIAL CONDITIONS
      ------------------------------
      
         MODEL SPECIFICATION
      
            FACTOR          (P     D     Q)    S
                 1           3     0     0     1
      
      
      
     DEFAULT SCALING USED FOR ALL PARAMETERS.
      
                                                               ##STEP SIZE FOR
                                              ######PARAMETER  ##APPROXIMATING
      #################PARAMETER DESCRIPTION  STARTING VALUES  #####DERIVATIVE
      INDEX  #########TYPE  ##ORDER  ##FIXED  ##########(PAR)  ##########(STP)
      
          1  AR (FACTOR 1)        1       NO   0.10000000E+00   0.22896898E-05
          2  AR (FACTOR 1)        2       NO   0.10000000E+00   0.22688602E-05
          3  AR (FACTOR 1)        3       NO   0.10000000E+00   0.22438846E-05
          4             MU      ###       NO   0.10000000E+01   0.25174593E-05
      
      NUMBER OF OBSERVATIONS                  (N)   559
      MAXIMUM NUMBER OF ITERATIONS ALLOWED                      (MIT)   500
      MAXIMUM NUMBER OF MODEL SUBROUTINE CALLS ALLOWED                 1000
      
      CONVERGENCE CRITERION FOR TEST BASED ON THE
         FORECASTED RELATIVE CHANGE IN RESIDUAL SUM OF SQUARES (STOPSS)  0.1000E-09
         MAXIMUM SCALED RELATIVE CHANGE IN THE PARAMETERS       (STOPP)  0.1489E-07
      
      MAXIMUM CHANGE ALLOWED IN THE PARAMETERS AT FIRST ITERATION (DELTA)   100.0
      RESIDUAL SUM OF SQUARES FOR INPUT PARAMETER VALUES                   0.3537E+07
           (BACKFORECASTS INCLUDED)
      RESIDUAL STANDARD DEVIATION FOR INPUT PARAMETER VALUES    (RSD)       79.84
      BASED ON DEGREES OF FREEDOM       559 -   0 -   4 =  555
      
      NONDEFAULT VALUES....
      
      AFCTOL.... V(31) =  0.2225074-307
      
      
      
      
      ##### RESIDUAL SUM OF SQUARES CONVERGENCE #####
      
      
      
      
      
      ESTIMATES FROM LEAST SQUARES FIT (* FOR FIXED PARAMETER)
      ########################################################
      
                    PARAMETER     STD DEV OF ###PAR/   ##################APPROXIMATE
                    ESTIMATES  ####PARAMETER ####(SD    95 PERCENT CONFIDENCE LIMITS
      TYPE ORD    ###(OF PAR)  ####ESTIMATES ##(PAR)    #######LOWER     ######UPPER
      
      FACTOR 1
        AR  1  0.58969407E+00 0.41925732E-01   14.07  0.52061708E+00  0.65877107E+00
        AR  2  0.23795137E+00 0.47746327E-01    4.98  0.15928434E+00  0.31661840E+00
        AR  3  0.15884704E+00 0.41922036E-01    3.79  0.89776135E-01  0.22791795E+00
        MU ##  0.11472145E+03 0.78615948E+00  145.93  0.11342617E+03  0.11601673E+03
      
      NUMBER OF OBSERVATIONS                  (N)   559
      RESIDUAL SUM OF SQUARES                  108.9505
          (BACKFORECASTS INCLUDED)
      RESIDUAL STANDARD DEVIATION             0.4430657
      BASED ON DEGREES OF FREEDOM  559 -   0 -   4 =  555
      APPROXIMATE CONDITION NUMBER             89.28687
      
           PARAMETERS,  SD(PARAMETERS), 1/SD(PAR), LOWER AND UPPER
           95% CONFIDENCE INTERVAL WRITTEN OUT TO FILE DPST1F.DAT
           ORDER IS:
              1. AUTO_REGRESSIVE TERMS
              2. SEASONAL AUTO_REGRESSIVE TERMS
              3. MU (MEAN TERM)
              4. MOVING AVERAGE TERMS
              5. SEASONAL MOVING AVERAGE TERMS
           FOLLOWING WRITTEN OUT TO FILE DPST2F.DAT
              1. ROW NUMBER
              2. PREDICTED VALUES
              3. STANDARD DEVIATION OF PREDICTED VALUES
              4. RESIDUALS
              5. STANDARDIZED RESIDUALS
           RESULTS OF ITERATIONS WRITTEN OUT TO FILE DPST3F.DAT
           PARAMETER VARIANCE-COVARIANCE MATRIX  WRITTEN OUT TO FILE DPST4F.DAT
           FORECAST, STANDARD DEVIATION OF FORECASTS, AND
           95% CONFIDENCE INTERVAL FOR FORECAST WRITTEN TO FILE DPST5F.DAT
        

Privacy Policy/Security Notice
Disclaimer | FOIA

NIST is an agency of the U.S. Commerce Department.

Date created: 6/5/2001
Last updated: 12/15/2013

Please email comments on this WWW page to alan.heckert@nist.gov.