PvarBreakTest: Structural break test

View source: R/PvarBreakTest.R

PvarBreakTestR Documentation

Structural break test

Description

This function performs structural break test that is based on p-variation.

Usage

PvarBreakTest(x, TimeLabel = as.vector(time(x)), alpha = 0.05,
  FullInfo = TRUE)

## S3 method for class 'PvarBreakTest'
plot(x, main1 = "Data",
  main2 = "Bridge transformation", ylab1 = x$dname,
  ylab2 = "BridgeT(" %.% x$dname %.% ")", sub2 = NULL,
  col.PP = 3, cex.PP = 0.5, col.BP = 2, cex.BP = 1, cex.DP = 0.5,
  ...)

## S3 method for class 'PvarBreakTest'
summary(object, ...)

Arguments

x

a numeric vector of data values or an object of class pvar.

TimeLabel

numeric, a time index of x. Used only for plotting.

alpha

a small number greater then 0. It indicates the significant level of the test.

FullInfo

logical. If TRUE (the default) the function will return an object of the class PvarBreakTest that saves all useful information. Otherwise only the statistics will by returned.

main1

the main parameter of the data graph.

main2

the main parameter of the Bridge transformation graph.

ylab1

the ylab parameter of the data graph.

ylab2

the ylab parameter of the Bridge transformation graph.

sub2

the sub parameter of the Bridge transformation graph. By default it reports the number of break points.

col.PP

the color of partition points.

cex.PP

the cex of partition points.

col.BP

the color of break points.

cex.BP

the cex of break points.

cex.DP

the cex of data points.

...

further arguments, passed to print.

object

the object of the class PvarBreakTest.

Details

Lets x be a data that should be tested of structural breaks. Then the p-variation of the BridgeT(x) with p=4 is the test's statistics.

The quantiles of H0 distribution is based on Monte-Carlo simulation of 140 millions iterations. The test is reliable then length(x) is between 100 and 10000. The test might work with other lengths too, but it is not tested well. The test will not compute then length(x)<20.

Value

If FullInfo=TRUE then function returns an object of the class PvarBreakTest. It is the list that contains:

Stat

a value of statistics (p-variation of transformed data).

CriticalValue

the critical value of the test according to significant level.

alpha

the significant level.

p.value

approximate p-value.

reject

logical. If TRUE, the H0 was rejected.

dname

the name of data vector.

p

the power in p-variation calculus. The test performs only with the p=4.

x

a vector of original data.

y

a vector of transformed data (y=BridgeT(x)).

Timelabel

time label of x. Used only for ploting.

BreakPoints

the indexes of break points suggestion.

Partition

a vector of indexes that indicates the partition of y that achieves the p-variation maximum.

Author(s)

Vygantas Butkus <Vygantas.Butkus@gmail.com>

References

The test was proposed by A. Rackaskas. The test is based on the results given in the flowing article

[1] R. Norvaisa, A. Rackauskas. Convergence in law of partial sum processes in p-variation norm. Lth. Math. J., 2008., Vol. 48, No. 2, 212-227.

See Also

Tests statistics is pvar of the data BridgeT(x)(see BridgeT) with (p=4). The critical value and the approximate p-value of the test might by found by functions PvarQuantile and PvarPvalue.

Examples

set.seed(1)
MiuDiff <- 0.3
x <- rnorm(250*4, rep(c(0, MiuDiff, 0, MiuDiff), each=250))

plot(x, pch=19, cex=0.5, main='original data, with several shifts of mean')
k <- 50
moveAvg <- filter(x, rep(1/k, k))
lines(time(x), moveAvg, lwd=2, col=2)
legend('topleft', c('sample', 'moving average (k='%.%k%.%')'),
       lty=c(NA,1), lwd=c(NA, 2), col=1:2, pch=c(19,NA), pt.cex=c(0.7,1)
       ,inset = .03, bg='antiquewhite1')

xtest <- PvarBreakTest(x)
plot(xtest)

pvar documentation built on Oct. 18, 2022, 9:09 a.m.