JMSLTM Numerical Library 7.2.0
com.imsl.stat

Class ARSeasonalFit

• All Implemented Interfaces:
Serializable

public class ARSeasonalFit
extends Object
implements Serializable
Estimates the optimum seasonality parameters for a time series using an autoregressive model, AR(p), to represent the time series.

ARMA time series modeling assumes the time series is stationary. Seasonal trends and cycles violate this assumption, which can lead to inaccurate predictions. However, in many cases the nonstationary series can be transformed into a stationary series by first differencing the series. For example, if the correlation is strong from one period to the next, the series might be differenced by a lag of 1. Instead of fitting a model to the original series , the model is fitted to the transformed series: . Higher order lags or differences are warranted if the series has cycles every 4 or 13 weeks. Class ARSeasonalFit is designed to help identify the optimum differencing for a series with seasonal trends or cycles.

ARSeasonalFit assumes the original series has no missing values, is equally spaced in time and is not centered before computing the optimum differencing. However, by default the transformed series is centered using the mean of that series. Users can change this default using the setCenter method. If setCenter is set to NO_CENTER the series is not centered, if set to CENTER_MEAN the series is centered using the mean of the series, and if set to CENTER_MEDIAN, the series is centered using the median of the series. If setCenter is set to CENTER_MEAN or CENTER_MEDIAN then the differenced series, is centered before determination of minimum AIC and optimum lag.

For every combination of rows in sInitial and dInitial , the series is converted to the seasonally adjusted series using the following computation where , represent specific rows of arrays sInitial and dInitial respectively, and m is the number of differences, or m=sInitial.length.

This transformation of the series to is computed using the Difference class. After this transformation the transformed series is centered, unless NO_CENTER is specified, and the ARAutoUnivariate class is used to automatically determine the optimum lag for an AR(p) representation for .

This procedure is repeated for every possible combination of rows in sInitial and dInitial. The series with the minimum AIC is identified as the optimum representation and returned in the methods getAROrder, getOptimumS, getOptimumD, getAIC, and getAR. The transformed series with the minium AIC can be retrieved from the getTransformedTimeSeries method.

Example, Serialized Form
• Field Summary

Fields
Modifier and Type Field and Description
static int CENTER_MEAN
Indicates the transformed series should be centered using the average of the differenced series.
static int CENTER_MEDIAN
Indicates the transformed series should be centered using the median of the differenced series.
static int NO_CENTER
Indicates the transformed series should not be centered.
• Constructor Summary

Constructors
Constructor and Description
ARSeasonalFit(int maxlag, int[][] sInitial, double[] z)
Constructor for ARSeasonalFit.
• Method Summary

Methods
Modifier and Type Method and Description
void compute()
Computes the minimum AIC and optimum values for s and d based upon the candidates provided in sInitial and dInitial, and computes the values for the transformed series, .
double getAIC()
Returns the final estimate for Akaike's Information Criterion (AIC) at the optimum.
double[] getAR()
Returns the final autoregressive parameter estimates at the optimum in the transformed series .
int getAROrder()
Returns optimum number of lags, p, for the optimum autoregressive AR(p) model.
int getCenter()
Returns the current setting for centering the input time series.
int[][] getDInitial()
Returns the candidate values for d to evaluate.
boolean getExclude()
Returns the current setting for excluding or replacing the inital values in the transformed series.
int getMaxlag()
Returns the maximum lag used to fit the AR(p) model.
int getNLost()
Returns the number of values in the initial part of the series lost to differencing.
int[] getOptimumD()
Returns the optimum values for d selected among the candidates in dInitial.
int[] getOptimumS()
Returns the optimum values for s selected among the candidates in sInitial.
int[][] getSInitial()
Returns the the candidate values for s to evaluate.
double[] getTimeSeries()
Returns the time series.
double[] getTransformedTimeSeries()
Returns the transformed series, .
void setCenter(int center)
Controls centering of the differenced series.
void setDInitial(int[][] dInitial)
Sets the candidate values for selecting the optimum seasonal adjustment prior to calling the compute method.
void setExclude(boolean exclude)
Controls whether to exclude or replace the inital values in the transformed series.
JMSLTM Numerical Library 7.2.0