Learn R Programming

astsa (version 1.1)

sarima: Fit ARIMA Models

Description

Fits ARIMA models including diagnostics in a short command. This is a front end to R's arima().

Usage

sarima(xdata, p, d, q, P = 0, D = 0, Q = 0, S = -1, details = TRUE, 
        tol = sqrt(.Machine$double.eps), no.constant = FALSE)

Arguments

xdata
univariate time series
p
AR order
d
difference order
q
MA order
P
SAR order; use only for seasonal models
D
seasonal difference; use only for seasonal models
Q
SMA order; use only for seasonal models
S
seasonal period; use only for seasonal models
details
turns on or off the output from the nonlinear optimization routine, which is optim. The default is TRUE, use details=FALSE to turn off the output.
tol
controls the relative tolerance (reltol) used to assess convergence. The default is sqrt(.Machine$double.eps), the R default.
no.constant
controls whether or not sarima includes a constant in the model. In particular, if there is no differencing (d = 0 and D = 0) you get the mean estimate. If there is differencing of order one (either d = 1 or D = 1, but not both), a constant term is includ

Value

  • fitestimation results
  • AICvalue of the AIC
  • AICcvalue of the AICc
  • BICvalue of the BIC

Details

If your time series is in x and you want to fit an ARIMA(p,d,q) model to the data, the basic call is sarima(x,p,d,q). The results are the parameter estimates, standard errors, AIC, AICc, BIC (as defined in Chapter 2) and diagnostics. To fit a seasonal ARIMA model, the basic call is sarima(x,p,d,q,P,D,Q,S). For example, sarima(x,2,1,0) will fit an ARIMA(2,1,0) model to the series in x, and sarima(x,2,1,0,0,1,1,12) will fit a seasonal ARIMA$(2,1,0)*(0,1,1)_{12}$ model to the series in x.

References

http://www.stat.pitt.edu/stoffer/tsa3/

See Also

sarima.for

Examples

Run this code
sarima(log(AirPassengers),0,1,1,0,1,1,12)
(dog <- sarima(log(AirPassengers),0,1,1,0,1,1,12))
summary(dog$fit)  # fit has all the returned arima() values
plot(resid(dog$fit))  # plot the innovations (residuals)

Run the code above in your browser using DataLab