Times series diagnostic plots for a structured set of ARIMA models.
tsdiagplot(x,
p.max=2, q.max=p.max,
model=c(p.max, 0, q.max), ## S-Plus
order=c(p.max, 0, q.max), ## R
lag.max=36, gof.lag=lag.max,
armas=arma.loop(x, order=order,
series=deparse(substitute(x)), ...),
diags=diag.arma.loop(armas, x,
lag.max=lag.max,
gof.lag=gof.lag),
ts.diag=rearrange.diag.arma.loop(diags),
lag.units=ts.diag$tspar["frequency"],
lag.lim=range(pretty(ts.diag$acf$lag))*lag.units,
lag.x.at=pretty(ts.diag$acf$lag)*lag.units,
lag.x.labels={tmp <- lag.x.at
tmp[as.integer(tmp)!=tmp] <- ""
tmp},
lag.0=TRUE,
main, lwd=0,
...)acfplot(rdal, type="acf",
main=paste("ACF of std.resid:", rdal$series,
" model:", rdal$model),
lag.units=rdal$tspar["frequency"],
lag.lim=range(pretty(rdal[[type]]$lag)*lag.units),
lag.x.at=pretty(rdal[[type]]$lag)*lag.units,
lag.x.labels={tmp <- lag.x.at
tmp[as.integer(tmp)!=tmp] <- ""
tmp},
lag.0=TRUE,
xlim=xlim.function(lag.lim/lag.units),
...)
aicsigplot(z, z.name=deparse(substitute(z)), series.name="ts",
model=NULL,
xlab="", ylab=z.name,
main=paste(z.name, series.name, model),
layout=c(1,2), between=list(x=1,y=1), ...)
residplot(rdal,
main=paste("std.resid:", rdal$series,
" model:", rdal$model),
...)
gofplot(rdal,
main=paste("P-value for gof:", rdal$series,
" model:", rdal$model),
lag.units=rdal$tspar["frequency"],
lag.lim=range(pretty(rdal$gof$lag)*lag.units),
lag.x.at=pretty(rdal$gof$lag)*lag.units,
lag.x.labels={tmp <- lag.x.at
tmp[as.integer(tmp)!=tmp] <- ""
tmp},
xlim=xlim.function(lag.lim/lag.units),
pch=16, ...)
Time series vector.
Maximum number of AR and MA arguments to use in the series of ARIMA models.
A valid S-Plus model for
A valid R order for
Maximum lag for the acf and pacf plots.
Maximum lag for the gof plots.
An arma.loop object.
An diag.arma.loop object.
A list constructed as a rearranged diag.arma.loop object.
Units for time series, defaults to frequency(x)
scaling for xlim in acf and pacf plots.
Location of ticks and labels for the acf and pacf plots.
Logical. If TRUE, then plot the correlation (identically 1)
at lag=0.
If FALSE, do not plot the correlation at lag=0.
"acf" or "pacf"
A matrix constructed as the aic or sigma2 component of the
sumamry of a arma.loop object.
"aic" or "sigma2"
Character string describing the time series.
Standard trellis arguments.
Additional arguments. tsdiagplot sends them to
arima or arima.mle. acfplot,
aicsigplot residplot, and gofplot send them to xyplot.
tsdiagplot returns a "tsdiagplot" object which is
a list of "trellis" objects. It is printed with its own
print method.
The other functions return "trellis" objects.
"Displays for Direct Comparison of ARIMA Models" The American Statistician, May 2002, Vol. 56, No. 2, pp. 131-138. Richard M. Heiberger, Temple University, and Paulo Teles, Faculdade de Economia do Porto.
Richard M. Heiberger and Burt Holland (2004), Statistical Analysis and Data Display, Springer, ISBN 0-387-40270-5
# NOT RUN {
data(tser.mystery.X)
X <- tser.mystery.X
X.dataplot <- tsacfplots(X, lwd=1, pch.seq=16, cex=.7)
X.dataplot
X.loop <- if.R(
s=
arma.loop(X, model=list(order=c(2,0,2)))
,r=
arma.loop(X, order=c(2,0,2))
)
X.dal <- diag.arma.loop(X.loop, x=X)
X.diag <- rearrange.diag.arma.loop(X.dal)
X.diagplot <- tsdiagplot(armas=X.loop, ts.diag=X.diag, lwd=1)
X.diagplot
X.loop
X.loop[["1","1"]]
# }
Run the code above in your browser using DataLab