public class ARMA
extends java.lang.Object
implements java.io.Serializable
Given a time series of data, the ARMA model is a tool for understanding and, perhaps, predicting future values in this series. The AR part involves regressing the variable on its own lagged values. The MA part involves modeling the error term as a linear combination of error terms occurring contemporaneously and at various times in the past. The model is usually referred to as the ARMA(p,q) model where p is the order of the AR part and q is the order of the MA part.
Constructor and Description |
---|
ARMA(double[] x,
double[] ar,
double[] ma,
double b,
double[] fittedValues,
double[] residuals)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
adjustedRSquared()
Returns adjusted R2 statistic.
|
double[] |
ar()
Returns the linear coefficients of AR(p).
|
int |
df()
Returns the degree-of-freedom of residual standard error.
|
static ARMA |
fit(double[] x,
int p,
int q)
Fits an ARMA model with Hannan-Rissanen algorithm.
|
double[] |
fittedValues()
Returns the fitted values.
|
double |
forecast()
Returns 1-step ahead forecast.
|
double[] |
forecast(int l)
Returns l-step ahead forecast.
|
double |
intercept()
Returns the intercept.
|
double[] |
ma()
Returns the linear coefficients of MA(q).
|
double |
mean()
Returns the mean of time series.
|
int |
p()
Returns the order of AR.
|
int |
q()
Returns the order of MA.
|
double[] |
residuals()
Returns the residuals, that is response minus fitted values.
|
double |
RSquared()
Returns R2 statistic.
|
double |
RSS()
Returns the residual sum of squares.
|
java.lang.String |
toString() |
double[][] |
ttest()
Returns the t-test of the coefficients (including intercept).
|
double |
variance()
Returns the residual variance.
|
double[] |
x()
Returns the time series.
|
public ARMA(double[] x, double[] ar, double[] ma, double b, double[] fittedValues, double[] residuals)
x
- the time seriesar
- the estimated weight parameters of AR(p).ma
- the estimated weight parameters of MA(q).b
- the intercept.public double[] x()
public double mean()
public int p()
public int q()
public double[][] ttest()
public double[] ar()
public double[] ma()
public double intercept()
public double[] residuals()
public double[] fittedValues()
public double RSS()
public double variance()
public int df()
public double RSquared()
In the case of ordinary least-squares regression, R2 increases as we increase the number of variables in the model (R2 will not decrease). This illustrates a drawback to one possible use of R2, where one might try to include more variables in the model until "there is no more improvement". This leads to the alternative approach of looking at the adjusted R2.
public double adjustedRSquared()
public static ARMA fit(double[] x, int p, int q)
x
- the time series.p
- the order of AR.q
- the order of MA.public double forecast()
public double[] forecast(int l)
public java.lang.String toString()
toString
in class java.lang.Object