Learn R Programming

pvar (version 1.0.6)

PvarQuantile: Quantiles and probabilities of p-variation

Description

The distribution of p-variation of BBT(x) depends on n=length(x). This fact is important for getting appropriate quantiles (or p-value). These functions allows easy way to deal with it.

Usage

PvarQuantile(n, prob = c(0.9, 0.95, 0.99), DF = PvarQuantileDF)
  PvarPvalue(n, stat, DF = PvarQuantileDF)
  
  getMean(n, bMean = MeanCoef) 
  getSd(n, bSd = SdCoef)
  NormalisePvar(x, n=length(x), bMean = MeanCoef, bSd = SdCoef)

Arguments

n
a positive integer indicating the length of data vector.
prob
a cumulative probabilities of p-variation distribution.
stat
a vector of p-variation statistics.
x
a numeric vector of data values.
DF
a data frame with the information of p-variance distribution.
bMean
a coefficient vector that defines a function of the mean of p-variation.
bSd
a coefficient vector that defines a function of the standard deviation of p-variation.

Value

  • Sunctions PvarQuantile and PvarPvalue returns a corresponding value quantile or the probability. Functions getMean and getSd returns a corresponding value of mean and sd statistics. Function NormalisePvar returns normalise values

Details

The distribution of p-variance is form Monte-Carlo simulation based on 140 millions iterations. The data frame PvarQuantileDF saves the results of Monte-Carlo simulation. Meanwhile, MeanCoef and SdCoef defines the coefficients of functional form (according to n) of mean and sd statistics. A functianal form of mean and sd statistics are the same, namely $$f(n) = b_1 + b_2 n^b_2 .$$ And the coeficients $(b_1, b_2, b_3)$ are saved in vectors MeanCoef and SdCoef. Those vectors are estimated with nls function form Monte-Carlo simulation.

See Also

PvarBreakTest, PvarQuantileDF, NormalisePvar, getMean, getSd

Examples

Run this code
### Critical value of 0.05 significant level
CV = PvarQuantile(n=1000, prob = 0.95)
CV

### The p-value of the same significant level.
1-PvarPvalue(n=1000, stat=CV)

### this may take for a wile:
x100 = replicate(2000, BBT(rnorm(100)), simplify=FALSE)
pvar100 = sapply(x100, pvar, p=4, info=FALSE)

# sample mean:
mean(pvar100)
# a mean according to Monte-Carlo simulation:
getMean(100) 

# sample 0.95 quantile
quantile(pvar100, probs=0.95, type=8)

# a mean according to Monte-Carlo simulation:
PvarQuantile(n=100, prob = 0.95)

Run the code above in your browser using DataLab