Learn R Programming

pvar (version 1.0.9)

pvar-package: p-variation calculation and application

Description

This package deals with p-variation for the sequence of data values. It gives opportunity to calculate the p-variation -- this is the main purpose of this package. Moreover, it includes one example of practical application of the p-variation.

Arguments

encoding

utf8

Details

ll{ Package: pvar Type: Package Version: 1.0.7 Date: 2013-12-02 License: GPL-2 Institution: Vilnius University Faculty of Mathematics and Informatics } This package is about p-variation. It deals only of p-variation of a finite sample data values. To be precise, lets star with the definitions. Originally p-variation is defined for a functions. For a function $f:[0,1] \rightarrow R$ and $0 < p < \infty$ p-variation is defined as $$v_p(f) = \sup \left{ \sum_{i=1}^m |f(t_i) - f(t_{i-1})|^p : 0=t_0pvar and PvarBreakTest. The main function in this package is pvar. It calculates the p-variation and the partition. And the function PvarBreakTest is one of the examples of p-variation applications. It performs structural break test of vector x that exams whether there are multiple shifts in mean inside vector x. All other functions are loaded only for supporting and illustrating purposes.

References

[1] R. M. Dudley, R. Norvaisa. An Introduction to p-variation and Young Integrals, Cambridge, Mass., 1998. [2] R. M. Dudley, R. Norvaisa. Differentiability of Six Operators on Nonsmooth Functions and p-Variation, Springer Berlin Heidelberg, Print ISBN 978-3-540-65975-4, Lecture Notes in Mathematics Vol. 1703, 1999. [3] 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. [4] J. Qian. The p-variation of Partial Sum Processes and the Empirical Process. The Annals of Probability, 1998, Vol. 26, No. 3, 1370-1383.

See Also

The main function is pvar - it finds p-variation and the partition that maximises Sum_p function. Other important functions is PvarBreakTest it performs structural break test of vector x by calculating p-variations of BridgeT(x) (see BridgeT).

Examples

Run this code
set.seed(1)

######### pvar ########
x = rbridge(1, 1000)

### simple run:
pv = pvar(x, 2)
print(pv)
summary(pv)
plot(pv)

### partition points are those that maximises Sum_p function
Sum_p(x[pv$Partition], 2)

### lets take only the partition points:
pv2 = pvar(x[pv$Partition], TimeLabel=pv$TimeLabel[pv$Partition], 2)

op <- par(mfrow = c(2, 1))
	plot(pv, main="pvar with original data")
	plot(pv2, main="the same pvar without meaningless points")
par(op)

######### PvarBreakTest ########
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 suggestion of break points. True points are 250, 500 and 750
BreakPoints(PVBT)


##################################
# the statistic maigth by find with pvar
Y = BridgeT(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)

PVBT

Run the code above in your browser using DataLab