Learn R Programming

cointmonitoR (version 0.1.0)

monitorCointegration: Procedure for Monitoring Level and Trend Cointegration

Description

This procedure is able to monitor a cointegration model for level or trend cointegration and returns the corresponding break point, if available. It is based on parameter estimation on a pre-break "calibration" period at the beginning of the sample that is known or assumed to be free of structural change and can be specified exactly via the m argument (see Details for further information).

Usage

monitorCointegration(x, y, m = 0.25, model = c("FM", "D", "IM"), trend = FALSE, kernel = c("ba", "pa", "qs", "tr"), bandwidth = c("and", "nw"), D.options = NULL, signif.level = 0.05, return.stats = TRUE, return.input = TRUE, check = TRUE, ...)

Arguments

x
[numeric | matrix | data.frame] Data on which to apply the monitoring procedure (RHS).
y
[numeric | matrix | data.frame] Data on which to apply the monitoring procedure (LHS). Has to be one-dimensional. If matrix, it may have only one row or column, if data.frame just one column.
m
[numeric(1)] Length of calibration period as fraction of the data's length (between 0.1 and 0.9) or as number of observations (see Details).
model
[character(1)] The model to be used for modified OLS calculations. Should be one of FM-OLS ("FM"), D-OLS ("D") or IM-OLS ("IM").
trend
[logical] Should an intercept and a linear trend be included? If FALSE (default), only an intercept is included.
kernel
[character(1)] The kernel function to use for calculating the long-run variance. Default is Bartlett kernel ("ba"), see Details for alternatives.
bandwidth
[character(1) | numeric(1)] The bandwidth to use for calculating the long-run variance. Default is Andrews (1991) ("and"), an alternative is Newey West (1994) ("nw"). You can also set the bandwidth manually.
D.options
[list | NULL] Options for the D-OLS calculations. A list with elements n.lead, n.lag, kmax and info.crit -- or NULL (then default arguments are the same as in cointRegD. See that help page for further information.) Missing list elements will be replaced automatically.
signif.level
[numeric(1)] Level of significance (between 0.01 and 0.1). Detection time will be calculated only if the estimated p-value is smaller than signif.level. Default is 0.05.
return.stats
[logical] Whether to return all test statistics. Default is TRUE.
return.input
[logical] Whether to return the input data, default is TRUE.
check
[logical] Wheather to check (and if necessary convert) the arguments. See checkVars for further information.
...
Arguments passed to getBandwidthNW (inter, weights), if bandwidth = "nw".

Value

[cointmonitoR] object with components:
Hsm [numeric(1)]
value of the test statistic
time [numeric(1)]
detected time of structural break
p.value [numeric(1)]
estimated p-value of the test (between 0.01 and 0.1)
cv [numeric(1)]
critical value of the test
sig [numeric(1)]
significance level used for the test
residuals [numeric]
residuals of the modified OLS model to be used for calculating the test statistics
model [character(1)]
cointOLS model ("FM", "D", or "IM")
trend [character(1)]
trend model ("level" or "trend")
name [character(1)]
name(s) of data
m [list(2)]
list with components: $m.frac [numeric(1)]: calibration period (fraction) $m.index [numeric(1)]: calibration period (length)
kernel [character(1)]
kernel function
bandwidth [list(2)]
$name [character(1)]: bandwidth function (name) $number [numeric(1)]: bandwidth
statistics [numeric]
values of test statistics with the same length as data, but NA during calibration period (available if return.stats = TRUE)
input [numeric | matrix | data.frame]
copy of input data (available if return.stats = TRUE)
D.options [list]
information about further parameters (available if model = "D")

Details

The calibration period can be set by setting the argument m to the number of the last observation, that should be inside this period. The corresponding fraction of the data's length will be calculated automatically. Alternatively you can set m directly to the fitting fraction value, but you should pay attention to the fact, that the calibration period may become smaller than intended: The last observation is calculated as floor(m * N) (with N the length of x).

The kernel that is used for calculating the long-run variance can be one of the following:

  • "ba": Bartlett kernel
  • "pa": Parzen kernel
  • "qs": Quadratic Spectral kernel
  • "tr": Truncated kernel

References

  • Wagner, M. and D. Wied (2015): "Monitoring Stationarity and Cointegration," Discussion Paper, DOI:10.2139/ssrn.2624657.

See Also

Other cointmonitoR: monitorStationarity, plot.cointmonitoR, print.cointmonitoR

Examples

Run this code
set.seed(42)
x = data.frame(x1 = cumsum(rnorm(200)), x2 = cumsum(rnorm(200)))
eps1 = rnorm(200, sd = 2)
eps2 = c(eps1[1:100], cumsum(eps1[101:200]))

y = x$x1 - x$x2 + 10 + eps1
monitorCointegration(x = x, y = y, m = 0.5, model = "FM")

y2 = y + seq(1, 30, length = 200)
monitorCointegration(x = x, y = y2, m = 0.5, model = "FM")
monitorCointegration(x = x, y = y2, m = 0.5, trend = TRUE, model = "FM")

y3 = x$x1 - x$x2 + 10 + eps2
monitorCointegration(x = x, y = y3, m = 0.5, model = "FM")
monitorCointegration(x = x, y = y3, m = 0.5, model = "D")
monitorCointegration(x = x, y = y3, m = 0.5, model = "IM")

Run the code above in your browser using DataLab