Package com.imsl.stat

Class ARAutoUnivariate

java.lang.Object
com.imsl.stat.ARAutoUnivariate
All Implemented Interfaces:
Serializable

public class ARAutoUnivariate extends Object implements Serializable
Automatically determines the best autoregressive time series model using Akaike's Information Criterion.

ARAutoUnivariate automatically selects the order of the AR model that best fits the data and then computes the AR coefficients. The algorithm used in ARAutoUnivariate is derived from the work of Akaike, H., et. al (1979) and Kitagawa and Akaike (1978). This code was adapted from the UNIMAR procedure published as part of the TIMSAC-78 Library.

The best fit AR model is determined by successively fitting AR models with \(0,1,2,\dots,\rm{maxlag}\) autoregressive coefficients. For each model, Akaike's Information Criterion (AIC) is calculated based on the formula $$\mbox{AIC} = -2\ln(likelihood)+2p$$ Class ARAutoUnivariate uses the approximation to this formula developed by Ozaki and Oda (1979), $$\mbox{AIC} = (n-\mbox{maxlag})\ln({\hat {\sigma}}^2)+2(p+1)+(n-\mbox{maxlag})(\ln(2\pi)+ 1)$$ where \({\hat {\sigma}}^2\) is an estimate of the residual variance of the series, commonly known in time series analysis as the innovation variance and n is the number of observations in the time series z, n=z.length. By dropping the constant $$(n-\mbox{maxlag})(\ln(2\pi)+1), $$ the calculation is simplified to $$\mbox{AIC}=(n-\mbox{maxlag})\ln({\hat{\sigma}}^2)+ 2(p+1),$$

The best fit model is the model with minimum AIC. If the number of parameters in this model selected by ARAutoUnivariate is equal to the highest order autoregressive model fitted, i.e., p= maxlag, then a model with smaller AIC might exist for larger values of maxlag. In this case, increasing maxlag to explore AR models with additional autoregressive parameters might be warranted.

Method setEstimationMethod can be used to specify the method used to calculate the AR coefficients. If setEstimationMethod is set to METHOD_OF_MOMENTS, estimates of the autoregressive coefficients for the model with minimum AIC are calculated using method of moments as described in the ARMA class. If LEAST_SQUARES is specified, the coefficients are determined by the method of least squares applied in the form described by Kitagawa and Akaike (1978). If MAX_LIKELIHOOD is specified, the coefficients are estimated using maximum likelihood as described in the ARMAMaxLikelihood class.

The Java Logging API can be used to trace the execution of ARAutoUnivariate. The name of this logger is com.imsl.stat.ARAutoUnivariate. Accumulated levels of detail correspond to Java's FINE, FINER, and FINEST logging levels with FINE yielding the smallest amount of information and FINEST yielding the most. The levels of output yield the following:

Level Output
FINE A message on entering and exiting method compute.
FINER All of the messages in FINE, a message entering and exiting the compute method, plus the final computations.
FINEST All of the messages in FINER, plus the intermediate computations.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Deprecated.
    Use IMSLFormatter instead.
    static class 
    The input triangular matrix is singular.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Indicates that least-squares should be used for estimating the coefficients in the time series.
    static final int
    Indicates that maximum likelihood should be used for estimating the coefficients in the time series.
    static final int
    Indicates the method of moments should be used for estimating the coefficients in the time series.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ARAutoUnivariate(int maxlag, double[] z)
    ARAutoUnivariate constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Determines the autoregressive model with the minimum AIC by fitting autoregressive models from 0 to maxlag lags using the method of moments or an estimation method specified by the user through setEstimationMethod.
    double[][]
    forecast(int nForecast)
    Returns forecasts and associated confidence interval offsets.
    double
    Returns the final estimate for Akaike's Information Criterion (AIC) at the optimum.
    double[]
    Returns the final auto regressive parameter estimates at the optimum AIC using the estimation method specified in setEstimationMethod .
    int
    Returns the maximum backward origin.
    double
    Returns the confidence level for calculating confidence limit deviations returned from getDeviations.
    double
    Returns the estimate for the constant parameter in the ARMA series.
    double
    Returns the tolerance level used to determine convergence of the nonlinearleast-squares and maximum likelihood algorithms.
    double[]
    Returns the deviations used for calculating the forecast confidence limits.
    int
    Returns the estimation method used for estimating the autoregressive coefficients.
    double[]
    getForecast(int nForecast)
    Returns forecasts
    double
    Returns the final estimate for the innovation variance.
    double
    Returns the final estimate for \(L=e^{-(\mbox{AIC} - 2p)/2} \), where p is the AR order, AIC is Akaike's Information Criterion, and L is the likelihood function evaluated for the optimum autoregressive model.
    Returns the logger object.
    int
    Returns the value currently being used as the maximum number of iterations allowed in the nonlinear equation solver used in both the method of moments and least-squares algorithms.
    int
    Returns the current value used to represent the maximum number of autoregressive lags to achieve the minimum AIC.
    double
    Returns the mean used to center the time series z.
    int
    Returns the order of the AR model selected with the minimum AIC.
    double[]
    Returns the current values of the vector of residuals.
    double[]
    Returns the time series used for estimating the minimum AIC and the autoregressive coefficients.
    double[]
    Returns the final auto regressive parameter estimates at the optimum AIC estimated by the original TIMSAC routine (UNIMAR).
    double
    Returns the estimate for the constant parameter in the ARMA series.
    double
    Returns the final estimate for the innovation variance calculated by the TIMSAC automatic AR modeling routine (UNIMAR).
    void
    setBackwardOrigin(int backwardOrigin)
    Sets the maximum backward origin used in calculating the forecasts.
    void
    setConfidence(double confidence)
    Sets the confidence level for calculating confidence limit deviations returned from getDeviations.
    void
    setConvergenceTolerance(double convergenceTolerance)
    Sets the tolerance level used to determine convergence of the nonlinear least-squares and maximum likelihood algorithms.
    void
    setEstimationMethod(int method)
    Sets the estimation method used for estimating the final estimates for the autoregressive coefficients.
    void
    setMaxIterations(int iterations)
    Sets the maximum number of iterations used for estimating the autoregressive coefficients.
    void
    setMean(double mean)
    Sets the estimate of the mean used for centering the time series z .

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait