Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot

Plot methods for objects in vars


Description

Plot method for objects with class attribute varest, vec2var, varcheck, varfevd, varirf, varprd, varstabil.

Usage

## S3 method for class 'varcheck'
plot(x, names = NULL, main.resid = NULL, main.hist =
NULL, main.acf = NULL, main.pacf = NULL, main.acf2 = NULL, main.pacf2 =
NULL, ylim.resid = NULL, ylim.hist = NULL, ylab.resid = NULL, xlab.resid
= NULL, xlab.acf = NULL, lty.resid = NULL, lwd.resid = NULL, col.resid =
NULL, col.edf = NULL, lag.acf = NULL, lag.pacf = NULL, lag.acf2 = NULL,
lag.pacf2 = NULL, mar = par("mar"), oma = par("oma"), ...)
## S3 method for class 'varest'
plot(x, names = NULL, main.fit = NULL, main.acf = NULL,
main.pacf = NULL, ylim.fit = NULL, ylim.resid = NULL, lty.fit = NULL,
lty.resid = NULL, lwd.fit = NULL, lwd.resid = NULL, lag.acf = NULL,
lag.pacf = NULL, col.fit = NULL, col.resid = NULL, ylab.fit = NULL,
ylab.resid = NULL, ylab.acf = NULL, ylab.pacf = NULL, xlab.fit = NULL,
xlab.resid = NULL, nc, mar = par("mar"), oma = par("oma"), adj.mtext =
NA, padj.mtext = NA, col.mtext = NA, ...)
## S3 method for class 'vec2var'
plot(x, ...)
## S3 method for class 'varfevd'
plot(x, plot.type = c("multiple", "single"),
names = NULL, main = NULL, col = NULL, ylim = NULL, ylab = NULL,
xlab = NULL, legend = NULL, names.arg = NULL, nc,
mar = par("mar"), oma = par("oma"), addbars = 1, ...)
## S3 method for class 'varirf'
plot(x, plot.type = c("multiple", "single"), names =
NULL, main = NULL, sub = NULL, lty = NULL, lwd = NULL, col = NULL, ylim
= NULL, ylab = NULL, xlab = NULL, nc, mar.multi = c(0, 4, 0, 4),
oma.multi = c(6, 4, 6, 4), adj.mtext = NA, padj.mtext = NA, col.mtext =
NA, ...)  
## S3 method for class 'varprd'
plot(x, plot.type = c("multiple", "single"),
names = NULL, main = NULL, col = NULL, lty = NULL, lwd = NULL,
ylim = NULL, ylab = NULL, xlab = NULL, nc, mar = par("mar"),
oma = par("oma"), ...)
## S3 method for class 'varstabil'
plot(x, plot.type = c("multiple", "single"), names =
NULL, main = NULL, nc, mar = par("mar"), oma = par("oma"), ...)

Arguments

addbars

Integer, number of empty bars in barplot to reserve space for legend. If set to zero, no legend will be returned.

adj.mtext

Adjustment for mtext(), only applicable if plot.type = "multiple".

col

Character vector, colors to use in plot.

col.edf

Character, color of residuals' EDF.

col.fit

Character vector, colors for diagram of fit.

col.mtext

Character, color for mtext(), only applicable if plot.type = "multiple".

col.resid

Character vector, colors for residual plot.

lag.acf

Integer, lag.max for ACF of residuals.

lag.acf2

Integer, lag.max for ACF of squared residuals.

lag.pacf

Integer, lag.max for PACF of residuals.

lag.pacf2

Integer, lag.max for PACF of squared residuals.

legend

Character vector of names in legend.

lty

Integer/Character, the line types.

lty.fit

Vector, lty for diagram of fit.

lty.resid

Vector, lty for residual plot.

lwd

The width of the lines.

lwd.fit

Vector, lwd for diagram of fit.

lwd.resid

Vector, lwd for residual plot.

main

Character vector, the titles of the plot.

main.acf

Character vector, main for residuals' ACF.

main.acf2

Character vector, main for squared residuals' ACF.

main.fit

Character vector, main for diagram of fit.

main.hist

Character vector, main for histogram of residuals.

main.pacf

Character vector, main for residuals' PACF.

main.pacf2

Character vector, main for squared residuals' PACF.

main.resid

Character vector, main for residual plot.

mar

Setting of margins.

mar.multi

Setting of margins, if plot.type = "multiple".

names

Character vector, the variables names to be plotted. If left NULL, all variables are plotted.

names.arg

Character vector, names for x-axis of barplot.

nc

Integer, number of columns for multiple plot.

oma

Setting of outer margins.

oma.multi

Setting of margins, if plot.type = "multiple".

padj.mtext

Adjustment for mtext(), only applicable if plot.type = "multiple".

plot.type

Character, if multiple all plots are drawn in a single device, otherwise the plots are shown consecutively.

sub

Character, sub title in plot.

x

An object of one of the above classes.

xlab

Character vector signifying the labels for the x-axis.

xlab.acf

Character, xlab for ACF and PACF of residuals and their squares in plot.varcheck.

xlab.fit

Character vector, xlab for diagram of fit.

xlab.resid

Character vector, xlab for residual plot.

ylab

Character vector signifying the labels for the y-axis.

ylab.acf

Character, ylab for ACF.

ylab.fit

Character vector, ylab for diagram of fit.

ylab.pacf

Character, ylab for PACF

ylab.resid

Character vector, ylab for residual plot.

ylim

Vector, the limits of the y-axis.

ylim.fit

Vector, ylim for diagram of fit.

ylim.hist

Vector, ylim for histogram of residuals.

ylim.resid

Vector, ylim for residual plot.

...

Passed to internal plot function.

Details

The plot-method for objects with class attribute vec2var is the same as for objects with class attribute varest. Hence, the same arguments can be utilised.

Author(s)

Bernhard Pfaff

References

Hamilton, J. (1994), Time Series Analysis, Princeton University Press, Princeton.

Lütkepohl, H. (2006), New Introduction to Multiple Time Series Analysis, Springer, New York.

Zeileis, A., F. Leisch, K. Hornik and C. Kleiber (2002), strucchange: An R Package for Testing for Structural Change in Linear Regression Models, Journal of Statistical Software, 7(2): 1-38, http://www.jstatsoft.org/v07/i02/

See Also

Examples

## Not run: 
data(Canada)
var.2c <- VAR(Canada, p = 2, type = "const")
plot(var.2c)
## Diagnostic Testing
## ARCH test
archtest <- arch.test(var.2c)
plot(archtest)
## Normality test
normalitytest <- normality.test(var.2c)
plot(normalitytest)
## serial correlation test
serialtest <- serial.test(var.2c)
plot(serialtest)
## FEVD
var.2c.fevd <- fevd(var.2c, n.ahead = 5)
plot(var.2c.fevd)
## IRF
var.2c.irf <- irf(var.2c, impulse = "e",
response = c("prod", "rw", "U"), boot = FALSE)
plot(var.2c.irf)
## Prediction
var.2c.prd <- predict(var.2c, n.ahead = 8, ci = 0.95)
plot(var.2c.prd)
## Stability
var.2c.stabil <- stability(var.2c, type = "Rec-CUSUM")
plot(var.2c.stabil)

## End(Not run)

vars

VAR Modelling

v1.5-3
GPL (>= 2)
Authors
Bernhard Pfaff [aut, cre], Matthieu Stigler [ctb]
Initial release
2018-08-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.