Class ARAutoUnivariate
- All Implemented Interfaces:
Serializable
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 ClassesModifier and TypeClassDescriptionstatic classDeprecated.static classThe input triangular matrix is singular. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intIndicates that least-squares should be used for estimating the coefficients in the time series.static final intIndicates that maximum likelihood should be used for estimating the coefficients in the time series.static final intIndicates the method of moments should be used for estimating the coefficients in the time series. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcompute()Determines the autoregressive model with the minimum AIC by fitting autoregressive models from 0 tomaxlaglags using the method of moments or an estimation method specified by the user throughsetEstimationMethod.double[][]forecast(int nForecast) Returns forecasts and associated confidence interval offsets.doublegetAIC()Returns the final estimate for Akaike's Information Criterion (AIC) at the optimum.double[]getAR()Returns the final auto regressive parameter estimates at the optimum AIC using the estimation method specified insetEstimationMethod.intReturns the maximum backward origin.doubleReturns the confidence level for calculating confidence limit deviations returned fromgetDeviations.doubleReturns the estimate for the constant parameter in the ARMA series.doubleReturns 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.intReturns the estimation method used for estimating the autoregressive coefficients.double[]getForecast(int nForecast) Returns forecastsdoubleReturns the final estimate for the innovation variance.doubleReturns 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.intReturns 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.intReturns the current value used to represent the maximum number of autoregressive lags to achieve the minimum AIC.doublegetMean()Returns the mean used to center the time seriesz.intgetOrder()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).doubleReturns the estimate for the constant parameter in the ARMA series.doubleReturns the final estimate for the innovation variance calculated by the TIMSAC automatic AR modeling routine (UNIMAR).voidsetBackwardOrigin(int backwardOrigin) Sets the maximum backward origin used in calculating the forecasts.voidsetConfidence(double confidence) Sets the confidence level for calculating confidence limit deviations returned fromgetDeviations.voidsetConvergenceTolerance(double convergenceTolerance) Sets the tolerance level used to determine convergence of the nonlinear least-squares and maximum likelihood algorithms.voidsetEstimationMethod(int method) Sets the estimation method used for estimating the final estimates for the autoregressive coefficients.voidsetMaxIterations(int iterations) Sets the maximum number of iterations used for estimating the autoregressive coefficients.voidsetMean(double mean) Sets the estimate of the mean used for centering the time seriesz.
-
Field Details
-
METHOD_OF_MOMENTS
public static final int METHOD_OF_MOMENTSIndicates the method of moments should be used for estimating the coefficients in the time series.- See Also:
-
LEAST_SQUARES
public static final int LEAST_SQUARESIndicates that least-squares should be used for estimating the coefficients in the time series.- See Also:
-
MAX_LIKELIHOOD
public static final int MAX_LIKELIHOODIndicates that maximum likelihood should be used for estimating the coefficients in the time series.- See Also:
-
-
Constructor Details
-
ARAutoUnivariate
public ARAutoUnivariate(int maxlag, double[] z) ARAutoUnivariateconstructor.- Parameters:
maxlag- anintscalar specifying the maximum number of autoregressive lags to evaluatez- adoublearray containing the time series
-
-
Method Details
-
compute
public void compute() throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleExceptionDetermines the autoregressive model with the minimum AIC by fitting autoregressive models from 0 tomaxlaglags using the method of moments or an estimation method specified by the user throughsetEstimationMethod.- Throws:
ARMA.MatrixSingularException- is thrown if the input matrix is singular.ARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1.ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too small.ARMA.NewInitialGuessException- is thrown if the iteration has not made good progress.ARMA.IllConditionedException- is thrown if the problem is ill-conditioned.ARMA.TooManyITNException- is thrown if the maximum number of iterations is exceeded.ARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceeded.ARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceeded.ARMA.ResidualsTooLargeException- is thrown if the residuals computed in one step of the Least Squares estimation of the ARMA coefficients become too large.ARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singular.ARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are non-stationaryARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertible.ARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.
-
getAIC
public double getAIC() throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleExceptionReturns the final estimate for Akaike's Information Criterion (AIC) at the optimum.- Returns:
- a
doublescalar value which is an approximation to \(\mbox{AIC} = -2\ln(L)+2p\), where L is the value of the maximum likelihood function evaluated at the parameter estimates. The approximation uses the calculation $$\mbox{AIC} \approx (\rm{n-maxlag}) \ln({\hat {\sigma}}^2)+2(p+1)+(\rm{n-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, andnis the number of observations in the time series (n=z.length). - Throws:
ARMA.MatrixSingularException- is thrown if the input matrix is singularARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too smallARMA.NewInitialGuessException- is thrown if the iteration has not made good progressARMA.IllConditionedException- is thrown if the problem is ill-conditionedARMA.TooManyITNException- is thrown if the maximum number of iterations is exceededARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceededARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceededARMA.ResidualsTooLargeException- is thrown if the residuals computed in one step of the Least Squares estimation of the ARMA coefficients become too large.ARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singularARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are nonstationaryARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertibleARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.
-
getConfidence
public double getConfidence()Returns the confidence level for calculating confidence limit deviations returned fromgetDeviations.- Returns:
- a
doublescalar value representing the confidence level used in computing forecast confidence intervals.
-
getBackwardOrigin
public int getBackwardOrigin()Returns the maximum backward origin.- Returns:
- an
intscalar specifying the maximum backward origin.
-
getTimsacConstant
public double getTimsacConstant() throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleExceptionReturns the estimate for the constant parameter in the ARMA series.- Returns:
- a
doublescalar equal to the estimate for the constant parameter in the ARMA series. - Throws:
ARMA.MatrixSingularException- is thrown if the input matrix is singular.ARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1.ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too small.ARMA.NewInitialGuessException- is thrown if the iteration has not made good progress.ARMA.IllConditionedException- is thrown if the problem is ill-conditioned.ARMA.TooManyITNException- is thrown if the maximum number of iterations is exceeded.ARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceeded.ARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceeded.ARMA.ResidualsTooLargeException- is thrown if the residuals computed in one step of the Least Squares estimation of the ARMA coefficients become too large.ARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singular.ARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are non-stationary.ARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertible.ARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.
-
getConstant
public double getConstant() throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleExceptionReturns the estimate for the constant parameter in the ARMA series.- Returns:
- a
doublescalar equal to the estimate for the constant parameter in the ARMA series. - Throws:
ARMA.MatrixSingularException- is thrown if the input matrix is singular.ARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1.ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too small.ARMA.NewInitialGuessException- is thrown if the iteration has not made good progress.ARMA.IllConditionedException- is thrown if the problem is ill-conditioned.ARMA.TooManyITNException- is thrown if the maximum number of iterations is exceeded.ARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceeded.ARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceeded.ARMA.ResidualsTooLargeException- is thrown if the residuals computed in one step of the Least Squares estimation of the ARMA coefficients become too large.ARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singular.ARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are non-stationary.ARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertible.ARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.
-
getTimeSeries
public double[] getTimeSeries()Returns the time series used for estimating the minimum AIC and the autoregressive coefficients.- Returns:
- a
doublearray containing the time series values set in the constructor.
-
setBackwardOrigin
public void setBackwardOrigin(int backwardOrigin) Sets the maximum backward origin used in calculating the forecasts.- Parameters:
backwardOrigin- anintscalar specifying the maximum backward origin.backwardOriginmust be greater than or equal to 0 and less than or equal toz.length - p, wherepis the optimum number of AR coeficients determined byARAutoUnivariate. The forecasted values returned will bez.length - backwardOriginthroughz.length. Default:backwardOrigin = 0.
-
forecast
public double[][] forecast(int nForecast) throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleException Returns forecasts and associated confidence interval offsets.- Parameters:
nForecast- an inputintrepresenting the number of requested forecasts- Returns:
- a
doublematrix of dimensionnForecastbybackwardOrigin + 1containing the forecasts. The forecasts are for lead times \(l=1,2,\ldots, \rm{nForecast}\) at originsz.length-backwardOrigin-1+jwhere \(j=1,\ldots, \rm{backwardOrigin}+1\). - Throws:
ARMA.MatrixSingularException- is thrown if the input matrix is singularARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too smallARMA.NewInitialGuessException- is thrown if the iteration has not made good progressARMA.IllConditionedException- is thrown if the problem is ill-conditionedARMA.TooManyITNException- is thrown if the maximum number of iterations is exceededARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceededARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceededARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singularARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are nonstationaryARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertibleARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.ARMA.ResidualsTooLargeException
-
getForecast
public double[] getForecast(int nForecast) throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleException Returns forecasts- Parameters:
nForecast- an inputintrepresenting the number of requested forecasts beyond the last value in the series.- Returns:
- a
doublearray containing thenForecast+backwardOriginforecasts. The firstbackwardOriginforecasts are one-step ahead forecasts for the lastbackwardOriginvalues in the series. The nextnForecastvalues in the returned series are forecasts for the next values beyond the series. - Throws:
NonStationary- is thrown if the final maximum likelihood estimates for the time series are nonstationary.NonInvertible- is thrown if the final maximum likelihood estimates for the time series are noninvertible.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.ARMA.MatrixSingularException- is thrown if the input matrix is singular.ARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1.ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too small.ARMA.NewInitialGuessException- is thrown if the iteration has not made good progress.ARMA.IllConditionedException- is thrown if the problem is ill-conditioned.ARMA.TooManyITNException- is thrown if the maximum number of iterations is exceeded.ARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceeded.ARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceeded.ARMA.ResidualsTooLargeException- is thrown if the residuals computed in one step of the Least Squares estimation of the ARMA coefficients become too large.ARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singular.ARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are non-stationary.ARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertible.ARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.
-
getDeviations
public double[] getDeviations()Returns the deviations used for calculating the forecast confidence limits.- Returns:
- a
doublearray of lengthbackwardOrigin+nForecastcontaining the deviations for calculating forecast confidence intervals. The confidence level is specified inconfidence. By default,confidence= 0.95.
-
getLikelihood
public double getLikelihood() throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleExceptionReturns 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. IfMAX_LIKELIHOODis set in thesetEstimationMethod, the exact likelihood evaluated for the optimum autoregressive model will be returned. Otherwise it is calculated using the approximation to the AIC.- Returns:
- a
doublescalar equal to the maximum of the likelihood function, \(L=e^{-(\mbox{AIC} - 2p)/2} \). - Throws:
ARMA.MatrixSingularException- is thrown if the input matrix is singular.ARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1.ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too small.ARMA.NewInitialGuessException- is thrown if the iteration has not made good progress.ARMA.IllConditionedException- is thrown if the problem is ill-conditioned.ARMA.TooManyITNException- is thrown if the maximum number of iterations is exceeded.ARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceeded.ARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceeded.ARMA.ResidualsTooLargeException- is thrown if the residuals computed in one step of the Least Squares estimation of the ARMA coefficients become too large.ARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singular.ARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are non-stationary.ARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertible.ARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.
-
getTimsacVariance
public double getTimsacVariance() throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleExceptionReturns the final estimate for the innovation variance calculated by the TIMSAC automatic AR modeling routine (UNIMAR). This variance depends upon the value ofmaxlagsince the series length in this computation depends on its value. UsegetInnovationVarianceto return the innovation variance calculated using the maximum series length.- Returns:
- a
doublescalar value equal to the estimate for the innovation variance. - Throws:
ARMA.MatrixSingularException- is thrown if the input matrix is singular.ARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1.ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too small.ARMA.NewInitialGuessException- is thrown if the iteration has not made good progress.ARMA.IllConditionedException- is thrown if the problem is ill-conditioned.ARMA.TooManyITNException- is thrown if the maximum number of iterations is exceeded.ARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceeded.ARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceeded.ARMA.ResidualsTooLargeException- is thrown if the residuals computed in one step of the Least Squares estimation of the ARMA coefficients become too large.ARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singular.ARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are nonstationary.ARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertible.ARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.
-
getInnovationVariance
public double getInnovationVariance() throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleExceptionReturns the final estimate for the innovation variance.- Returns:
- a
doublescalar value equal to the estimate for the innovation variance. - Throws:
ARMA.MatrixSingularException- is thrown if the input matrix is singular.ARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1.ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too small.ARMA.NewInitialGuessException- is thrown if the iteration has not made good progress.ARMA.IllConditionedException- is thrown if the problem is ill-conditioned.ARMA.TooManyITNException- is thrown if the maximum number of iterations is exceeded.ARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceeded.ARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceeded.ARMA.ResidualsTooLargeException- is thrown if the residuals computed in one step of the Least Squares estimation of the ARMA coefficients become too large.ARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singular.ARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are non-stationary.ARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertible.ARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.
-
getMean
public double getMean() throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleExceptionReturns the mean used to center the time seriesz.- Returns:
- a
doublecontaining the value used to center the series before searching for the optimum number of AR lags. This is equal to the mean of the time serieszunless the mean was set in thesetMeanmethod. - Throws:
ARMA.MatrixSingularException- is thrown if the input matrix is singular.ARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1.ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too small.ARMA.NewInitialGuessException- is thrown if the iteration has not made good progress.ARMA.IllConditionedException- is thrown if the problem is ill-conditioned.ARMA.TooManyITNException- is thrown if the maximum number of iterations is exceeded.ARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceeded.ARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceeded.ARMA.ResidualsTooLargeException- is thrown if the residuals computed in one step of the Least Squares estimation of the ARMA coefficients become too large.ARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singular.ARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are nonstationary.ARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertible.ARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.
-
setMean
public void setMean(double mean) Sets the estimate of the mean used for centering the time seriesz.- Parameters:
mean- adoublecontaining the estimate of the mean for the time seriesz. By default, the time serieszis centered about its sample mean.
-
setConvergenceTolerance
public void setConvergenceTolerance(double convergenceTolerance) Sets the tolerance level used to determine convergence of the nonlinear least-squares and maximum likelihood algorithms.- Parameters:
convergenceTolerance- adoublescalar containing the tolerance level used to determine convergence of the nonlinear least-squares and maximum likelihood algorithms.convergenceTolerancerepresents the minimum relative decrease in sum of squares between two iterations required to determine convergence. Hence,convergenceTolerancemust be greater than or equal to 0. By default, convergenceTolerance = \(10^{-10}\).
-
getConvergenceTolerance
public double getConvergenceTolerance()Returns the tolerance level used to determine convergence of the nonlinearleast-squares and maximum likelihood algorithms.- Returns:
- a
doublescalar containing the tolerance level used to determine convergence of the nonlinear least-squares algorithm.convergenceTolerancerepresents the minimum relative decrease in sum of squares between two iterations required to determine convergence.
-
setMaxIterations
public void setMaxIterations(int iterations) Sets the maximum number of iterations used for estimating the autoregressive coefficients.- Parameters:
iterations- anintscalar specifying the maximum number of iterations allowed in the nonlinear equation solver used in both the method of moments and least-squares algorithms. Default:iterations= 300.- Throws:
IllegalArgumentException- is thrown ifiterationsis less than or equal to 0.
-
setConfidence
public void setConfidence(double confidence) Sets the confidence level for calculating confidence limit deviations returned fromgetDeviations.- Parameters:
confidence- adoublescalar specifying the confidence level used in computing forecast confidence intervals. Typical choices forconfidenceare 0.90, 0.95, and 0.99.confidencemust be greater than 0.0 and less than 1.0. Default:confidence = 0.95.
-
getMaxIterations
public int getMaxIterations()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.- Returns:
- an
intcontaining the maximum number of iterations allowed.
-
setEstimationMethod
public void setEstimationMethod(int method) Sets the estimation method used for estimating the final estimates for the autoregressive coefficients.- Parameters:
method- anintscalar specifying the estimation method. Specify for the method of moments,METHOD_OF_MOMENTS for the least squares method, orLEAST_SQUARES for the maximum likelihood estimates. Default:MAX_LIKELIHOODmethod=LEAST_SQUARES.
-
getEstimationMethod
public int getEstimationMethod()Returns the estimation method used for estimating the autoregressive coefficients.- Returns:
- an
intequal to 0, 1, or 2, representing the autoregressive coefficient estimation method, which implies ,METHOD_OF_MOMENTS , orLEAST_SQUARES respectively.MAX_LIKELIHOOD
-
getTimsacAR
public double[] getTimsacAR() throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleExceptionReturns the final auto regressive parameter estimates at the optimum AIC estimated by the original TIMSAC routine (UNIMAR). These estimates vary depending upon the value ofmaxlagsince its value changes the length of the series used to estimate these parameters. Use thegetARmethod to obtain the best estimates from the estimation method specified bysetEstimationMethodcalculated using the maximum number of available observations.- Returns:
- a
doublearray of length p containing the estimates for the autoregressive parameters. - Throws:
ARMA.MatrixSingularException- is thrown if the input matrix is singular.ARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1.ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too small.ARMA.NewInitialGuessException- is thrown if the iteration has not made good progress.ARMA.IllConditionedException- is thrown if the problem is ill-conditioned.ARMA.TooManyITNException- is thrown if the maximum number of iterations is exceeded.ARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceeded.ARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceeded.ARMA.ResidualsTooLargeException- is thrown if the residuals computed in one step of the Least Squares estimation of the ARMA coefficients become too large.ARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singular.ARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are non-stationary.ARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertible.ARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.
-
getAR
public double[] getAR() throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleExceptionReturns the final auto regressive parameter estimates at the optimum AIC using the estimation method specified insetEstimationMethod.- Returns:
- a
doublearray containing the estimates for the autoregressive parameters. - Throws:
ARMA.MatrixSingularException- is thrown if the input matrix is singular.ARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1.ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too small.ARMA.NewInitialGuessException- is thrown if the iteration has not made good progress.ARMA.IllConditionedException- is thrown if the problem is ill-conditioned.ARMA.TooManyITNException- is thrown if the maximum number of iterations is exceeded.ARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceeded.ARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceeded.ARMA.ResidualsTooLargeException- is thrown if the residuals computed in one step of the Least Squares estimation of the ARMA coefficients become too large.ARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singular.ARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are nonstationary.ARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertible.ARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.
-
getResiduals
public double[] getResiduals()Returns the current values of the vector of residuals.- Returns:
- a
doublearray of lengthbackwardOrigincontaining the residuals for the lastbackwardOriginvalues in the time series. This array will be null unlesscomputeand either theforecastorgetForecastmethods are called previously.
-
getOrder
public int getOrder() throws ARMA.MatrixSingularException, ARMA.TooManyCallsException, ARMA.IncreaseErrRelException, ARMA.NewInitialGuessException, ARMA.IllConditionedException, ARMA.TooManyITNException, ARMA.TooManyFcnEvalException, ARMA.TooManyJacobianEvalException, ARMA.ResidualsTooLargeException, ARAutoUnivariate.TriangularMatrixSingularException, ARMAMaxLikelihood.NonStationaryException, ARMAMaxLikelihood.NonInvertibleExceptionReturns the order of the AR model selected with the minimum AIC.- Returns:
- an
intcontaining the optimum AR order selected byARAutoUnivariate's minimum AIC selection. - Throws:
ARMA.MatrixSingularException- is thrown if the input matrix is singular.ARMA.TooManyCallsException- is thrown if the number of calls to the function has exceeded the maximum number of iterations times the number of moving average (MA) parameters + 1.ARMA.IncreaseErrRelException- is thrown if the bound for the relative error is too small.ARMA.NewInitialGuessException- is thrown if the iteration has not made good progress.ARMA.IllConditionedException- is thrown if the problem is ill-conditioned.ARMA.TooManyITNException- is thrown if the maximum number of iterations is exceeded.ARMA.TooManyFcnEvalException- is thrown if the maximum number of function evaluations is exceeded.ARMA.TooManyJacobianEvalException- is thrown if the maximum number of Jacobian evaluations is exceeded.ARMA.ResidualsTooLargeException- is thrown if the residuals computed in one step of the Least Squares estimation of the ARMA coefficients become too large.ARAutoUnivariate.TriangularMatrixSingularException- is thrown if the input triangular matrix is singular.ARMAMaxLikelihood.NonStationaryException- is thrown if the final maximum likelihood estimates for the time series are non-stationary.ARMAMaxLikelihood.NonInvertibleException- is thrown if the final maximum likelihood estimates for the time series are noninvertible.ARMAMaxLikelihood.InitialMAException- is thrown if the initial values provided for the moving average terms usingsetMAare noninvertible. In this case,ARMAMaxLikelihoodterminates and does not compute the time series estimates.
-
getMaxlag
public int getMaxlag()Returns the current value used to represent the maximum number of autoregressive lags to achieve the minimum AIC.- Returns:
- an
intcontaining the maximum number of autoregressive lags evaluated.
-
getLogger
Returns the logger object.- Returns:
- the logger object, if present, or null.
-
IMSLFormatterinstead.