Learn R Programming

cointmonitoR (version 0.1.0)

monitorStationarity: Procedure for Monitoring Level and Trend Stationarity

Description

This procedure is able to monitor a one-dimensional vector for level or trend stationarity 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

monitorStationarity(x, m = 0.25, trend = FALSE, kernel = c("ba", "pa", "qs", "tr"), bandwidth = c("and", "nw"), 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. 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).
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.
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
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)

Details

The calibration period can be specified by setting the argument m to the number of its last observation. The corresponding fraction of the data's length will be calculated automatically. Alternatively you can set m directly to the fitting fraction value. Attention: The calibration period may become smaller than intended: The last observation is calculated as floor(m * N) (with N = 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: monitorCointegration, plot.cointmonitoR, print.cointmonitoR

Examples

Run this code
set.seed(1909)
x <- rnorm(200)
x2 <- c(x[1:100], cumsum(x[101:200]) / 2)

# Specify the calibration period
# as fraction of the total length of x:
monitorStationarity(x, m = 0.25)
monitorStationarity(x2, m = 0.465)

# Specify the calibration period
# by setting its last observation exactly:
monitorStationarity(x, m = 50)
monitorStationarity(x2, m = 93)

Run the code above in your browser using DataLab