
x
x
, that satisfy the requirements).
It is an inner function and should not be applied by users.pvarPseudoMonotonic(x, p, a = 1, b = length(x), sizeN = 1)
x
that should be analysed.x
that should be analysed.pvar
.ChB=TRUE
, elsewier the numbers are meaningless.min
and max
should be in the end points of the vector.
2. removed all monotonic points.pvar
, ChangePointsId
, SplitByExtremum
, FindAnalysingPoints
.############################################################
xx = c(0.9552822, 0.8317665, 0.9347037, 0.3861130, 0.6546701, 0.3600638,
0.6767309, 0.1090384, 0.4675789, 0.3223871, 0.4312971, 0.3514759,
0.4097339, 0.2601273, 0.4978533, 0.3255348, 0.7301583, 0.5317979,
0.6366720, 0.5096362, 0.8123783, -0.8443095)
pvM = pvarPseudoMonotonic(x = xx, p = 2, a = 1, b = 22, sizeN = 7)
sum(pvM$pvarVec[pvM$ChB])
pvar(xx, 2) #gives the same result.
############################################################
set.seed(51)
### get x
x = rbridge(1, 1000)
### remuves monotonic points
xx = x[ChangePointsId(x)]
### splits into pseudo-monotonic parts
s = SplitByExtremum(xx)
### for parts we can calculate p-variaiotn the partitinio
pvM = pvarPseudoMonotonic(x = xx, p = 2, a = s[4], b = s[5], sizeN = 1)
sum(pvM$pvarVec[pvM$ChB])
pvar(xx[s[4]:s[5]], 2) # the same result
Run the code above in your browser using DataLab