pvar: the calculation and applications of -variation
Abstract
In this vignette we will give a brief introduction to the -variations. Later on, we will give some illustrative examples of the main functions in pvar package.
1 Introduction
Let start with the definitions. Originally -variation is defined for a functions. For a function and -variation is defined as
Suppose is any real-value sequence of numbers. We will call such sequence a sample, whereas will be referred to as a sample size. The -variation of the sample could be expressed as
The set of index that achieves the maximum is refereed as supreme partition.
Lots and detailed information on the known properties of -variation can be found in the books of Norvaiša and Dudley (see [2] and [3]). There are formulated and proved a lot of the properties of -variation. In addition, the comprehensive bibliography of -variation is include.
The core functions of the package is based on algorithm described in [1]. The calculation of -variation was inspired by paper [4], where authors Norvaiša and Račkauskas presented necessary and sufficient conditions for the convergence in law of partial sum processes in -variation norm. Based on the result of this paper, Račkaskas proposed the method of testing sample of multiple shift in mean. This test is also implemented in this package.
The algorithm is written in C++, therefore it is quite fast. It is worth noting, that pvar package could be used to calculate -variation for any piecewise monotone functions and to investigate general properties of -variation.
2 Main function
The main function in pvar package is pvar (that a surprise). It calculates the
supreme partition and the value of -variation. The main usage of pvar function goes as follows
N <- 1000
p <- 2
x <- rwiener(N)
pv <- pvar(x, p)
pv
## p-variation ## 4.475017
summary(pv)
## The summary of p-variation: ## Value: 4.475, p = 2 ## Data: x, n = 1000 (+1) ## ## Data vector (n=1001): 0, 0.02385, -0.008584, -0.01725, 0.005166, -0.02374, ... ## Partition has 112 points: 1, 2, 30, 32, 33, 34, ...
Moreover, the data and supreme partition could be illustrated with plot function
plot(pv)
The points in supreme partition (the red points) are actually used in -variation. All the other points are redundant and could be dropped out with out any effect to -variation. This fact is illustrated in the example below.
pv.PP = pvar(x[pv$partition], TimeLabel=time(x)[pv$partition], 2) plot(pv.PP, main='The same pvar without redundant points')
Moreover, -variation on different intervals could be merged into unified sample. Let look at the example
x = rwiener(1000) pv1 = pvar(x[1:500], 2) pv2 = pvar(x[500:length(x)], 2) sum_pv1_pv2 = pv1 + pv2
The illustration of this looks like this
3 PvarBreakTest
A. Račkauskas has proposed a method of detection of multiple changes in a sequence of independent observations. This method is based on results presented in [4]. This method is realized in this package under the name of Pvar Break Test (or for short). It is implemented in PvarBreakTest function.
Lets consider the example. Let construct the data with multiple shifts in mean.
set.seed(1) MiuDiff <- 0.3 x <- rnorm(250*4, rep(c(0, MiuDiff, 0, MiuDiff), each=250))
From the original data, it is not obvious if there are any breaks in sample. To test whether there is a multiple break, we can apply PvarBreakTest test. The results are remarkable good. Look below.
xtest <- PvarBreakTest(x) xtest
## PvarBreakTest ## ## H0: no structural change ## Results: H0 is rejected at the confidence level of 0.05. ## Data: x, n=1000. ## The output of the test: ## Statistics Critical Value alpha ~p.value ## 24.04223 12.76930 0.05000 0.00730
References
- [1] V. Butkus, R. Norvaiša. Lith Math J (2018). https://doi.org/10.1007/s10986-018-9414-3
- [2] R. M. Dudley, R. Norvaiša. An Introduction to -variation and Young Integrals, Cambridge, Mass., 1998.
- [3] R. M. Dudley, R. Norvaiša. Differentiability of Six Operators on Nonsmooth Functions and -variation, Springer Berlin Heidelberg, Print ISBN 978-3-540-65975-4, Lecture Notes in Mathematics Vol. 1703, 1999.
- [4] R. Norvaiša, A. Račkauskas. Convergence in law of partial sum processes in p-variation norm // Lth. Math. J., Vol. 48, No. 2, 212–227, 2008.
- [5] J. Qian. The -variation of partial sum processes and the empirical process // Ph.D. thesis, Tufts University, 1997.