The function predicts and returns the next n consecutive values of a time
series using an automatically fitted ARIMA model. It may also plot the
predicted values against the actual ones using the function
plotarimapred
.
arimapred(
timeseries,
timeseries.cont = NULL,
n.ahead = NULL,
na.action = stats::na.omit,
xreg = NULL,
newxreg = NULL,
se.fit = FALSE,
plot = FALSE,
range.p = 0.2,
ylab = NULL,
xlab = NULL,
main = NULL
)
A vector or univariate time series which contains the values used for fitting an ARIMA model.
A vector or univariate time series containing a
continuation for timeseries
with actual values. Ignored if
NULL
.
Number of consecutive values of the time series, which are to
be predicted. If n.ahead
is NULL
, the number of consecutive
values to be predicted is assumed to be equal to the length of
timeseries.cont
. Required when timeseries.cont
is NULL
.
A function for treating missing values in timeseries
and timeseries.cont
. The default function is na.omit
,
which omits any missing values found in timeseries
or
timeseries.cont
.
A vector, matrix, data frame or times series of external
regressors used for fitting the ARIMA model. It must have the same number
of rows as timeseries
. Ignored if NULL
.
A vector, matrix, data frame or times series with new values
of xreg
to be used for prediction. Must have at least n.ahead
rows or the number of rows in timeseries.cont
. Ignored if
NULL
.
If se.fit
is TRUE
, the standard errors of the
predictions are returned.
If plot
is TRUE
, the function will generate a
graphic of the predicted values against the actual ones in
timeseries.cont
.
A percentage which defines how much the range of the graphic's y-axis will be increased from the minimum limits imposed by data.
A title for the graphic's y-axis. Ignored if NULL
.
A title for the graphic's x-axis. Ignored if NULL
.
An overall title for the graphic. Ignored if NULL
.
A time series of predictions, or if se.fit
is TRUE
, a
list with the components pred
, the predictions, and se
, the
estimated standard errors. Both components are time series. See the
predict.Arima
function in the stats package.
The ARIMA model used for time series prediction is automatically fitted by
the auto.arima
function in the forecast
package. In
order to avoid drift errors, the function introduces an auxiliary regressor
whose values are a sequence of consecutive integer numbers starting from 1.
The fitted ARIMA model is used for prediction by the
predict.Arima
function in the stats
package. For more
details, see the auto.arima
function in the forecast
package and the predict.Arima
function in the stats package.
R.J. Hyndman and G. Athanasopoulos, 2013, Forecasting: principles and practice. OTexts.
R.H. Shumway and D.S. Stoffer, 2010, Time Series Analysis and Its Applications: With R Examples. 3rd ed. 2011 edition ed. New York, Springer.
# NOT RUN {
data(SantaFe.A,SantaFe.A.cont)
arimapred(SantaFe.A[,1],SantaFe.A.cont[,1])
arimapred(SantaFe.A[,1],n.ahead=100)
# }
Run the code above in your browser using DataLab