glarma
Objectwhich
) are currently available: a
time series plot with observed values of the dependent variable, fixed
effects fit, and GLARMA fit; an ACF plot of residuals; a plot
of residuals against time; a normal Q-Q plot; the PIT histogram;
a uniform Q-Q plot for the PIT; a histogram of the normal randomized
residuals; a Q-Q plot of the normal randomized residuals; a plot of
the autocorrelation of the normal randomized residuals; and a plot of
the partial autocorrelation of the normal randomized residuals. By
default, six plots are provided, numbers 1, 3, 5, 7, 8 and 9 from this
list of plots.
"plot"(x, which = c(1L,3L,5L,7L,8L,9L), fits = 1L:3L, ask = prod(par("mfcol")) < length(which) && dev.interactive(), lwdObs = 1, lwdFixed = 1, lwdGLARMA = 1, colObs = "black", colFixed = "blue", colGLARMA = "red", ltyObs = 2, ltyFixed = 1, ltyGLARMA = 1, pchObs = 1, legend = TRUE, residPlotType = "h", bins = 10, line = TRUE, colLine = "red", colHist = "royal blue", lwdLine = 2, colPIT1 = "red", colPIT2 = "black", ltyPIT1 = 1, ltyPIT2 = 2, typePIT = "l", ltyQQ = 2, colQQ = "black", titles, ...)
"glarma"
, obtained from a call to
glarma
.TRUE
, the user is asked before each
plot, see par(ask = .)
.par(lty = .)
.par(lty = .)
.par(lty = .)
.TRUE
, the legend for the fits in the
time series plot would be shown. By default, it would be shown.plot
: "p
" for points, "l
" for lines,
"b
" for both points and lines, "c
" for empty points
joined by lines, "o
" for overplotted points and lines,
"s
" and "S
" for stair steps and "h
" for
histogram-like vertical lines. Finally, "n
" does not produce
any points or lines.TRUE
, the line for displaying the
standard uniform distribution will be shown for the purpose of
comparison. The default is TRUE
.par(lty = .)
.par(lty = .)
.par(lty = .)
.which
. For any
elements which are NULL
, useful titles will be created for the
corresponding plot.plot.default
and
plot.ts
. plot.glarma
is an S3 generic function for objects of class
glarma
.
The plots in this method display the fixed effects fit, GLARMA fit and
various types of residuals for the GLARMA fit under the Poisson
distribution, the binomial distribution or the negative binomial
distribution, plus a number of plots of the randomized residuals (see
normRandPIT
for details of the randomized residuals). In
all, ten plots can be produced. The observed values of the dependent
variable shown in the time series plot are mainly used to compare with
the two fits.
The fixed effects fit is calculated from $eta$, the
multiplication of the data matrix X
and $beta$
coefficients in GLARMA model. In contrast, the GLARMA fit is
calculated from $W$, the product of the data matrix X
and $delta$ in the GLARMA model, which is the combination
of both the $beta$ and ARMA coefficients, and is also
called the state variable of the series.
There are some major differences for computing the fixed effects fit from $eta$ and the GLARMA fit from $W$ under different distributions.
Under the Poisson distribution and negative binomial distribution, $$\mathsf{fit}_{\mathsf{fixed}} = \exp{\eta}$$ and $$\mathsf{fit}_{\mathsf{glarma}} = \exp{W}.$$
Under the binomial distribution, $$\mathsf{fit}_{\mathsf{fixed}} = \frac{1}{(1+e^{-\eta})}$$ and $$\mathsf{fit}_{\mathsf{glarma}} = \frac{1}{(1+e^{-W})}.$$
The residuals are calculated from the observed data and GLARMA
fit. The exact computation for the residuals depends on the type
of residuals used. The details are given in
glarma
. The ACF plot, the residuals against time and
the normal Q-Q plot are all based on these residuals. Further details
about those three plots are passed to acf
and
qqnorm
.
There are four plots based on the randomized residuals calculated
using normRandPIT
. These are a histogram, a Q-Q plot,
an autocorrelation plot and a partial autocorrelation plot.
The number of plots to be shown in the window depends on the value of
the graphical parameter mfrow
(or mfcol
). If the
displayed window is set to be large enough to show all ten plots,
they will be shown at one time. Otherwise, the required number of
plots will appear each time in the displayed window, and the user
will need to enter return
to see subsequent plots. By default,
six plots are produced.
For the time series plot in the function, the fit displayed is
specified by the argument fits
. The legend will be shown if
legend
is TRUE
. It will appear under the title
of the time series plot. Also the legend and the title will alter
automatically according to the fits shown in the plot.
plot.ts
, qqnorm
, acf
,
plot.default
, normRandPIT
.
### A example from Davis, Dunsmuir Wang (1999)
## MA(1,2,5), Pearson Residuals, Fisher Scoring
data(Polio)
y <- Polio[, 2]
X <- as.matrix(Polio[, 3:8])
glarmamod <- glarma(y, X, thetaLags = c(1, 2, 5), type = "Poi",method = "FS",
residuals = "Pearson", maxit = 100 , grad = 1e-6)
## The default plots are shown
plot(glarmamod)
## The plots used only to compared GLARMA fit and the observed data
plot(glarmamod, which = 1L, fits = c(1, 3))
Run the code above in your browser using DataLab