# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.timeseries.linear.univariate.stationaryprocess.arma

## Class ConditionalSumOfSquares

• java.lang.Object
• com.numericalmethod.suanshu.stats.timeseries.linear.univariate.stationaryprocess.arma.ConditionalSumOfSquares
• All Implemented Interfaces:
ARMAFit

public class ConditionalSumOfSquares
extends Object
implements ARMAFit
The method Conditional Sum of Squares (CSS) fits an ARIMA model by minimizing the conditional sum of squares. The CSS estimates are conditional on the assumption that the past unobserved errors are 0s. The estimation produced by CSS can be used as a starting point for a better algorithm, e.g., the maximum likelihood. Note that the order of integration is taken as an input, not estimated. The R equivalent function is arima.
"P. J. Brockwell and R. A. Davis, "Chapter 8.7, Model Building and Forecasting with ARIMA Processes," Time Series: Theory and Methods, Springer, 2006."
• ### Constructor Summary

Constructors
Constructor and Description
ConditionalSumOfSquares(double[] x, int p, int d, int q)
Fit an ARIMA model for the observations using CSS.
ConditionalSumOfSquares(double[] x, int p, int d, int q, int maxIterations)
Fit an ARIMA model for the observations using CSS.
• ### Method Summary

All Methods
Modifier and Type Method and Description
double AIC()
Compute the AIC, a model selection criterion.
double AICC()
Compute the AICC, a model selection criterion.
Matrix covariance()
Get the asymptotic covariance matrix of the estimated parameters, φ and θ.
ARMAModel getARMAModel()
Get the fitted ARMA model.
ARIMAModel getModel()
Get the fitted ARIMA model.
int nParams()
Get the number of parameters for the estimation/fitting.
ImmutableVector stderr()
Get the asymptotic standard errors of the estimated parameters, φ and θ.
String toString()
double var()
Get the variance of the white noise.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
• ### Constructor Detail

• #### ConditionalSumOfSquares

public ConditionalSumOfSquares(double[] x,
int p,
int d,
int q,
int maxIterations)
Fit an ARIMA model for the observations using CSS. Note that the algorithm fits only an ARMA model. d is taken as an input. If the differenced input time series is not zero-mean, it is first de-mean-ed before running the algorithm as in Brockwell and Davis. When reporting the model, we compute the intercept to match the mean.
Parameters:
x - the time series of observations
p - the number of AR terms
d - the order of integration
q - the number of MA terms
maxIterations - the maximum number of iterations
• #### ConditionalSumOfSquares

public ConditionalSumOfSquares(double[] x,
int p,
int d,
int q)
Fit an ARIMA model for the observations using CSS. Note that the algorithm fits only an ARMA model. d is taken as an input. If the differenced input time series is not zero-mean, it is first de-mean-ed before running the algorithm as in Brockwell and Davis. When reporting the model, we compute the intercept to match the mean.
Parameters:
x - the time series of observations
p - the number of AR terms
d - the order of integration
q - the number of MA terms
• ### Method Detail

• #### nParams

public int nParams()
Get the number of parameters for the estimation/fitting. They are the AR terms, MA terms, and variance (sigma^2).
Returns:
the number of parameters
• #### getModel

public ARIMAModel getModel()
Get the fitted ARIMA model.
Specified by:
getModel in interface ARMAFit
Returns:
the fitted ARIMA model
• #### getARMAModel

public ARMAModel getARMAModel()
Get the fitted ARMA model.
Returns:
the fitted ARMA model
• #### var

public double var()
Description copied from interface: ARMAFit
Get the variance of the white noise.
Specified by:
var in interface ARMAFit
Returns:
σ2
• #### covariance

public Matrix covariance()
Get the asymptotic covariance matrix of the estimated parameters, φ and θ. The estimators are asymptotically normal.
Specified by:
covariance in interface ARMAFit
Returns:
the asymptotic covariance matrix
"P. J. Brockwell and R. A. Davis, "Eq. 10.8.27, Thm. 10.8.2, Chapter 10.8, Model Building and Forecasting with ARIMA Processes," Time Series: Theory and Methods, Springer, 2006."
• #### stderr

public ImmutableVector stderr()
Get the asymptotic standard errors of the estimated parameters, φ and θ. The estimators are asymptotically normal.
Specified by:
stderr in interface ARMAFit
Returns:
the asymptotic errors
"P. J. Brockwell and R. A. Davis, "Eq. 10.8.27, Thm. 10.8.2, Chapter 10.8, Model Building and Forecasting with ARIMA Processes," Time Series: Theory and Methods, Springer, 2006."
• #### AIC

public double AIC()
Compute the AIC, a model selection criterion.
Specified by:
AIC in interface ARMAFit
Returns:
the AIC
Wikipedia: Akaike information criterion
• #### AICC

public double AICC()
Compute the AICC, a model selection criterion.
Specified by:
AICC in interface ARMAFit
Returns:
the AICC
public String toString()
toString in class Object