arimapred: Automatic ARIMA fitting and prediction

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/arimapred.R

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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
)

Arguments

timeseries

A vector or univariate time series which contains the values used for fitting an ARIMA model.

timeseries.cont

A vector or univariate time series containing a continuation for timeseries with actual values. Ignored if NULL.

n.ahead

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.

na.action

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.

xreg

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.

newxreg

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.

se.fit

If se.fit is TRUE, the standard errors of the predictions are returned.

plot

If plot is TRUE, the function will generate a graphic of the predicted values against the actual ones in timeseries.cont.

range.p

A percentage which defines how much the range of the graphic's y-axis will be increased from the minimum limits imposed by data.

ylab

A title for the graphic's y-axis. Ignored if NULL.

xlab

A title for the graphic's x-axis. Ignored if NULL.

main

An overall title for the graphic. Ignored if NULL.

Details

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.

Value

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.

Author(s)

Rebecca Pontes Salles

References

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.

See Also

auto.arima, predict.Arima, plotarimapred, marimapred

Examples

1
2
3

RebeccaSalles/TSPred documentation built on April 6, 2021, 2:44 a.m.