
BridgeT(x)
depends on n=length(x)
.
This fact is important for getting appropriate quantiles (or p-value).
These functions helps to deal with it.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, bMean = MeanCoef, bSd = SdCoef)
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 valuesPvarQuantileDF
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
MeanCoef
and SdCoef
.
Those vectors are estimated with nls
function form Monte-Carlo simulation.PvarBreakTest
, PvarQuantileDF
, NormalisePvar
, getMean
, getSd
### 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 while:
x100 = replicate(2000, BridgeT(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