It is inefficient to translate a p-box derived from moment information into a consonant possibility structure; it loses information. Instead, the inference to the consonant structure should be made directly from moments. The green structure was computed using Dominik Hose's formulation described in section 3.4.2.2 of his thesis which can be found at https://dominikhose.github.io/dissertation/diss_dhose.pdf. Note, however, this formulation uses the version of the Chebyshev inequality with the absolute value function, so we expect it may itself be suboptimal.
The R code to make these plots is below. It uses functions currently in development in the pba.r and union.r libraries available on the Code page.
# makeconsonant.pbox(mmms(m,M,mu,sd))) doesn't agree with Dominik section 3.4.2.2
# the tails are too fat
makeconsonantfrommoments = function(m,M,mu,sd,st=consonantlevels) {
# section 3.4.2.2 in https://dominikhose.github.io/dissertation/diss_dhose.pdf
p=(0:(st-1))/(st-1)
return(consonant(mb=pmax(m,pmin(M,mu + c(-sd/sqrt(p), rev(sd/sqrt(p)))))))
}
makeconsonant.pbox = function(x) {
# uses the three-step procedure:
# double cdf values,
# flip the right edge (i.e., subtract the doubled p-values from 2), and
# truncate both sides at the p-value 1
mx = c(x@u, x@d)
lx = length(mx)
half = lx %/% 4
return(fn(mb=rep(mx[c(1:half, (lx-half+1):lx)], rep(2,2*half)))) # does this use outward-directed rounding? does it need to worry about it?
}
source("C:\\Users\\Scott's Surface Pro\\Desktop\\pba.r") #:pbox> library loaded
"%/%" <- function(x,y) if (is.uncertain(x) || is.uncertain(y)) frechetconv.pbox(x,y,'/') else do.call(.Primitive("%/%"),list(x,y))
par(mfcol=c(3,1))
m = 0
M = 20
mu = 10
sig = 1
b = meanstd(mu,sig)
B = mmms(m,M,mu,sig)
##b
##blue(B)
# P-box: ~ {mean, std}( range=[-21.60696,41.60696], mean=10, var=1)
##edf(10,col='lightgray')
##d = makeconsonant.pbox(b)
##plot(d,col='red')
##plot(d,col='red')
mom = makeconsonantfrommoments(m,M,mu,sig)
##plot(mom,new=FALSE,col='green')
G1 = mom
R1 = d
b = meanstd(mu,sig)
B = mmms(m,M,mu,sig)
B
blue(b)
# P-box: ~ {mean, std}( range=[-21.60696,41.60696], mean=10, var=1)
edf(10,col='lightgray')
d = makeconsonant.pbox(B)
plot(d,col='red')
plot(d,col='red')
mom = makeconsonantfrommoments(m,M,mu,sig)
plot(mom,new=FALSE,col='green')
G2 = mom
R2 = d
cmp = function() {
rbyc(2,1)
plot(G1); plot(G2,'gray',new=FALSE)
plot(R1); plot(R2,'gray',new=FALSE)
}