CArima: Fit ARIMA model to univariate time series

View source: R/estimation_validation.R

CArimaR Documentation

Fit ARIMA model to univariate time series

Description

Largely a wrapper for the Arima function in the forecast package. It adds some usefull statistics and tests to validate and compare models.

Usage

CArima(
y,
order = c(0,0,0),
seasonal = list(order = c(0,0,0), period = 1),
plot = T
xreg = NULL,
include.constant = TRUE,
lambda = model$lambda,
biasadj = FALSE,
method = c("CSS-ML", "ML", "CSS"),
model = NULL,
x = y,
...
)

Arguments

y

a univariate time series of class ts or a matrix with the values of the time series.

order

a specification of the non-seasonal part of the ARIMA model: the three integer components (p, d, q) are the AR order, the order of differencing, and the MA order.

seasonal

a specification of the seasonal part of the ARIMA model, plus the period (which defaults to frequency(x) if the y parameter is a ts object). This may be a list with components order and period, or just a numeric vector of length 3 which specifies the seasonal order. In the latter case the default period is used.

plot

if TRUE, it will show all the plots in execution.

include.constant

for undifferenced series it fits the mean of the time series, for differenced series it fits the mean of the differenced time series. Note that if there is more than one difference taken, no constant is included regardless of the value of this argument.

...

additional arguments to be passed to Arima.

Details

See the Arima function in the forecast package.

Value

See the Arima function in the forecast package. The additional objects returned are:

period

The time series period of the seasonal part.

SBC

The SBC value corresponding to the log-likelihood.

cor.coef

Correlation matrix of the parameters of the model.

resid.acf

ACF of the residuals obtained with the Acf function of the forecast package.

resid.pacf

PACF of the residuals obtained with the Pacf function of the forecast package.

lbtests.df

Table of the Ljung-Box tests for some lags of the residuals, obtained with the LB.test function of the TSA package.

lbtests.plot

Barplot of the Ljung-Box pvalues of the residuals.

residRM

Range-mean plot of the residuals obtained with the rmplot function.

residQQp

Qqplot of the residuals.

residDensity

Plot of the residual density compared with the normal density.

residMuTest

T-test for the residual's mean, obtained with t.test function of the stats package.

residShapiro

Shapiro-Wilk normality test for the residuals, obtained with shapiro.test function of the stats package.

See Also

coeftest, grid.arrange

Examples

#Some examples with AirPassengers
model1 <- CArima(as.vector(log(AirPassengers)), order = c(0, 1, 1), 
                 seasonal = list(order=c(0,0,1), period = 12))
model1 
summary(model1, plot=F)

model2 <- CArima(as.vector(log(AirPassengers)), order = c(0, 1, 1), 
                 seasonal = list(order=c(0,1,1), period = 12))
model2 
summary(model2, plot=F) 

danipequelangos/CBJTSA documentation built on Oct. 16, 2022, 7:19 p.m.