Truncated Normal Inverse CDF
x=distfun_tnorminv(p,mu,sigma,a,b) x=distfun_tnorminv(p,mu,sigma,a,b,lowertail)
a matrix of doubles, the probability. Must be in the range [0,1].
a matrix of doubles, the mean.
a matrix of doubles, the standard deviation. sigma>0.
a matrix of doubles, the lower bound
a matrix of doubles, the upper bound (with a<=b)
a 1-by-1 matrix of booleans, the tail (default lowertail=%t). If lowertail is true (the default), then considers P(X<=x) otherwise P(X>x).
a matrix of doubles, the outcome
Computes the inverse Normal cumulated probability distribution function of the Normal (Laplace-Gauss) function.
Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.
p=[0.01 0.5 0.9 0.99 0.7]' distfun_tnorminv (p,0,1,-1,1) expected = [ -0.9721734 0. 0.7490146 0.9721734 0.3492199 ] // Plot accuracy // See how the accuracy decreases when // we invert the upper tail: // in the upper left figure, the number of // significant digits goes down from 16 to 0. // This is what the lowertail=%f option is for. a=-10; b=10; // mu=-8; sigma=2; x=linspace(a,b,1000); p1=distfun_tnormcdf(x,mu,sigma,a,b); x1=distfun_tnorminv(p1,mu,sigma,a,b); d1=assert_computedigits(x,x1); // mu=0; sigma=2; x=linspace(a,b,1000); p2=distfun_tnormcdf(x,mu,sigma,a,b); x2=distfun_tnorminv(p2,mu,sigma,a,b); d2=assert_computedigits(x,x2); // mu=9; sigma=10; x=linspace(a,b,1000); p3=distfun_tnormcdf(x,mu,sigma,a,b); x3=distfun_tnorminv(p3,mu,sigma,a,b); d3=assert_computedigits(x,x3); // mu=0; sigma=10; x=linspace(a,b,1000); p4=distfun_tnormcdf(x,mu,sigma,a,b); x4=distfun_tnorminv(p4,mu,sigma,a,b); d4=assert_computedigits(x,x4); // scf(); subplot(2,2,1) plot(x,d1) sshared="$\textrm{Inv. Trunc. normal [-10,10], }"; s=sshared+"\mu=-8,\sigma=2$"; xtitle(s,"X","Digits"); subplot(2,2,2) plot(x,d2) s=sshared+"\mu=0,\sigma=2$"; xtitle(s,"X","Digits"); subplot(2,2,3) plot(x,d3) s=sshared+"\mu=9,\sigma=10$"; xtitle(s,"X","Digits"); subplot(2,2,4) plot(x,d4) s=sshared+"\mu=0,\sigma=10$"; xtitle(s,"X","Digits"); | ![]() | ![]() |
http://en.wikipedia.org/wiki/Truncated_normal_distribution