pvar: p-variation calculation

View source: R/p-variation.R

pvarR Documentation

p-variation calculation

Description

Calculates p-variation of the sample.

Usage

pvar(x, p, TimeLabel = as.vector(time(x)), LSI = 3)

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

## S3 method for class 'pvar'
plot(x, main = "p-variation", ylab = x$dname,
  sub = "p=" %.% round(x$p, 5) %.% ", p-variation: " %.%
  formatC(x$value, 5, format = "f"), col.PP = 2, cex.PP = 0.5, ...)

Arguments

x

a (non-empty) numeric vector of data values or an object of the class pvar.

p

a positive number indicating the power p in p-variation.

TimeLabel

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

LSI

a length of small interval. It must be a positive odd number. This parameter do not have effect on final result, but might influence the speed of calculation.

object

an objct of the class pvar.

...

further arguments.

main

a main parameter in plot function.

ylab

a ylab parameter in plot function.

sub

a sub parameter in plot function.

col.PP

the color of partition points.

cex.PP

the cex of partition points.

Details

This function is the main function in this package. It calculates the p-variation of the sample. The formal definition is given in pvar-package.

Value

An object of the class pvar. Namely, it is a list that contains

value

a value of p-variation.

x

a vector of original data x.

p

the value of p.

partition

a vector of indexes that indicates the partition that achieves the maximum.

dname

a name of data vector (optional).

TimeLabel

a time label of x (optional).

Author(s)

Vygantas Butkus <Vygantas.Butkus@gmail.com>

See Also

IsEqualPvar, AddPvar, PvarBreakTest.

Examples

### randomised data:
x = rbridge(1000)

### the main functions:
pv = pvar(x, 2)
print(pv)
summary(pv)
plot(pv)

### The value of p-variation is    
pv; Sum_p(x[pv$partition], 2)  

### The meaning of supreme partition points:
pv.PP = pvar(x[pv$partition], TimeLabel=time(x)[pv$partition], 2)
pv.PP == pv.PP
op <- par(mfrow = c(2, 1), mar=c(2, 4, 4, 1))
plot(pv, main='pvar with original data')
plot(pv.PP, main='The same pvar without redundant points')
par(op)

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