plot.cointmonitoR {cointmonitoR}R Documentation

Plot Method for Monitoring Procedures.

Description

Plotting objects of class "cointmonitoR".

Usage

## S3 method for class 'cointmonitoR'
plot(x, what = "test", type, main, xlab, ylab,
  axes = TRUE, legend = TRUE, main.val, xlab.val, ylab.val, lines = TRUE,
  ...)

Arguments

x

[cointmonitoR]
Object of class "cointmonitoR", i.e. the result of monitorStationarity or monitorCointegration.

what

[character]
Whether to plot test statistics ("test") (default) or the values/residuals of the tested time series ("values" or "residuals") or "both". Works only, if return.stats = TRUE in the called function that to get x (default setting).

type

[character]
Plot type (from plot). Default is "l".

main, xlab, ylab

[character]
Title and axis titles (from plot). Default values will be generated from the contents of x.

axes, legend

[logical]
Whether to add axes (from plot) and a legend to the plot.

main.val, xlab.val, ylab.val

[character]
Title and axis titles (from plot) for the second plot, if generating both plots in one step (see argument what). Default values will be generated from the contents of x.

lines

[logical]
Whether to add lines and annotations to the plot. Default is TRUE.

...

[any]
Further arguments passed to plot.

See Also

Other cointmonitoR: monitorCointegration, monitorStationarity, print.cointmonitoR

Examples

### Monitoring stationarity (no break):
set.seed(1909)
x = rnorm(200)
test = monitorStationarity(x, m = 0.5)
plot(test)

oldpar = par(mfrow = c(2, 1), mar = c(4, 4, 1, 1))
plot(test, what = "both", legend = FALSE, main = "", main.val = "")
par(oldpar)


### Monitoring stationarity (break):
x = c(x[1:100], cumsum(rnorm(100, sd = 0.5)) + x[101:200])
test2 = monitorStationarity(x, m = 0.5)
plot(test2)

oldpar = par(mfrow = c(2, 1), mar = c(4, 4, 1, 1))
plot(test2, what = "both", legend = FALSE, main = "", main.val = "")
par(oldpar)


### Monitoring cointegration (no break):
set.seed(42)
x = data.frame(x1 = cumsum(rnorm(200)), x2 = cumsum(rnorm(200)))
eps1 = rnorm(200, sd = 2)
y = x$x1 - x$x2 + 10 + eps1
test3 = monitorCointegration(x = x, y = y, m = 0.5, model = "FM")
plot(test3)

oldpar = par(mfrow = c(2, 1), mar = c(4, 4, 1, 1))
plot(test3, what = "both", legend = FALSE, main = "", main.val = "")
par(oldpar)


### Monitoring cointegration (break):
eps2 = c(eps1[1:100], cumsum(eps1[101:200]))
y = x$x1 - x$x2 + 10 + eps2
test4 = monitorCointegration(x = x, y = y, m = 0.5, model = "FM")
plot(test4)

oldpar = par(mfrow = c(2, 1), mar = c(4, 4, 1, 1))
plot(test4, what = "both", legend = FALSE, main = "", main.val = "")
par(oldpar)


[Package cointmonitoR version 0.1.0 Index]