Learn R Programming

pvar (version 1.0.6)

PvarBreakTest: Structural break test

Description

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

Usage

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

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

## S3 method for class 'PvarBreakTest':
plot(x, main1 = "Data", main2 = "Brownian Bridge transformation", 
    ylab1 = x$dname, ylab2 = "BBT(" \%.\% x$dname \%.\% ")", sub2=NULL, 
	col.PP = 3, cex.PP = 0.5, col.BP = 2, cex.BP = 1, cex.DP = 0.5, ...)
	
BreakPoints(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.
object
the object of the class PvarBreakTest.
main1
the main parameter of the data graph.
main2
the main parameter of the Brownian Bridge transformation graph.
ylab1
the ylab parameter of the data graph.
ylab2
the ylab parameter of the Brownian Bridge transformation graph.
sub2
the sub parameter of the Brownian Bridge transformation graph. By default it reports the number of break points.
cex.DP
the cex of data 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.
...
further arguments.

Value

  • If FullInfo=TRUE then function returns an object of the class PvarBreakTest. It is the list that contains:
  • Stata value of statistics (p-variation of transformed data).
  • CriticalValuethe critical value of the test according significant level.
  • alphathe significant level.
  • p.valueapproximate p-value.
  • rejectlogical. If TRUE, the H0 was rejected.
  • dnamethe name of data vector.
  • pthe power in p-variation calculus. The test performs only with the p=4.
  • xa vector of original data.
  • ya vector of transformed data (y=BBT(x)).
  • Timelabeltime label of x. Used only for ploting.
  • BreakPointsthe indexes of break points suggestion.
  • Partitiona vector of indexes that indicates the partition of y that achieves the p-variation maximum.
  • SplitPointsthe indexes of y that indicates the points where y might be spited and analysed separately.
  • infothe list of extra information about the calculation.
  • The info is a list that contains:
  • PartitionNthe length of the partition.
  • AnalysedPointsNthe length of the prepared y, i.e. after removing monotonic points and meaningless pints in small intervals.
  • SegmentsNthe number of segments the y was splinted.
  • sizeNthe inner sizeN parameter
  • TakesTimethe total time taken for calculation.

Details

Lets x be a data that should be tested of structial breaks. Then the p-variation of the BBT(x) with p=4 is the test's statistics. The quantiles of H0 distribution is based on Monte-Carlo simulation of 140 millions iterations. If 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< code="">

References

~~~ Some articles about p-variation.~~~

See Also

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

Examples

Run this code
set.seed(1)
# x contains 4 blocks with diferent mean.
x = c(rnorm(250,0),rnorm(250,0.3), rnorm(250,0), rnorm(250,0.3))

# Run test
PVBT = PvarBreakTest(x); PVBT
PVBTSummary = summary(PVBT); PVBTSummary

# the plot of the test
plot(PVBT)

# the sugestion of break points. True points are 250, 500 and 750
BreakPoints(PVBT)

# if we only interesting in main numbers.
PvarBreakTest(x, FullInfo = FALSE)

##################################
# the statistic maigth by find with pvar
Y = BBT(x)
pv = pvar(Y, p = 4)
pv

# critical value
PvarQuantile(n=length(x), prob = c(0.95))
# apricimal p-value
PvarPvalue(n=length(x), stat=pv$value)

Run the code above in your browser using DataLab