tsdiagplot {HH} | R Documentation |
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=if.R( s=arma.loop(x, model=model, series=deparse(substitute(x)), ...), r=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, ...)
x |
Time series vector. |
p.max, q.max |
Maximum number of AR and MA arguments to use in the series of ARIMA models. |
model |
A valid S-Plus model for
arima.mle . |
order |
A valid R order for
arima . The additional argument seasonal may also be used. |
lag.max |
Maximum lag for the acf and pacf plots. |
gof.lag |
Maximum lag for the gof plots. |
armas |
An arma.loop object. |
diags |
An diag.arma.loop object. |
ts.diag, rdal |
A list constructed as a rearranged diag.arma.loop object. |
lag.units |
Units for time series, defaults to frequency(x) |
lag.lim |
scaling for xlim in acf and pacf plots. |
lag.x.at, lag.x.labels |
Location of ticks and labels for the acf and pacf plots. |
lag.0 |
Logical. If TRUE , then plot the correlation (identically 1)
at lag=0.
If FALSE , do not plot the correlation at lag=0. |
type |
"acf" or "pacf" |
z |
A matrix constructed as the aic or sigma2 component of the
sumamry of a arma.loop object. |
z.name |
"aic" or "sigma2" |
series.name |
Character string describing the time series. |
xlab, ylab, layout, between, pch, xlim, main, lwd |
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.
Richard M. Heiberger (rmh@temple.edu)
"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
X <- as.rts(scan(hh("datasets/tser.mystery.X.dat"))) 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"]]