Bayesian Diagnostic Uncertainty

A software tool for estimating uncertainty of Bayesian posterior probability for disease

Theodora Chatzimichail, MRCS  
tc@hcsl.com
Aristides T. Hatjimihail, MD, PhD
 ath@hcsl.com

Hellenic Complex Systems Laboratory, Kostis Palamas 21, 66131 Drama, Greece.

Clear["`*"];
Off[General::stop];
Needs["HypothesisTesting`"];
logNormalDistribution[μ_,σ_]:=LogNormalDistribution[(1/2) (2 Log[μ]-Log[(((μ^2)+(σ^2))/(μ^2))]),(Sqrt[Log[(((μ^2)+(σ^2))/(μ^2))]])];
gammaDistribution[μ_,σ_]:=GammaDistribution[(μ^2)/(σ^2),(σ^2)/μ];
bpnn[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+(((E^((1/2) (((((x-μD))^2)/((σD)^2))-((((x-μH))^2)/((σH)^2))))) nH σD)/(nD σH))))
ubpnn[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/(Sqrt[2]))(√(((E^(((((x-μD))^2)/((σD)^2))-((((x-μH))^2)/((σH)^2)))) (2 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((σD)^6) ((σH)^6)+(nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((((((x-μD))^2)-((σD)^2)))^2) ((σH)^6)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((σD)^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((σH)^6)+(1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((σD)^6) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((((((x-μH))^2)-((σH)^2)))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) (((x-μH))^2) ((σD)^6) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2))))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((σD)^4) (((nD+(((E^((1/2) (((((x-μD))^2)/((σD)^2))-((((x-μH))^2)/((σH)^2))))) nH σD)/(σH))))^4) ((σH)^8)))),1,(1/(Sqrt[2]))(√(((E^(((((x-μD))^2)/((σD)^2))-((((x-μH))^2)/((σH)^2)))) (2 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((σD)^6) ((σH)^6)+(nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) (-2 (-1+nD) (b0^2)-2 (-1+nD) (b1^2) (x^2)-((σD)^2)) ((((((x-μD))^2)-((σD)^2)))^2) ((σH)^6)+2 (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((σD)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2)) ((σH)^6)+(1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((σD)^6) (-2 (-1+nH) (b0^2)-2 (-1+nH) (b1^2) (x^2)-((σH)^2)) ((((((x-μH))^2)-((σH)^2)))^2)+2 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) (((x-μH))^2) ((σD)^6) ((σH)^2) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2))))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((σD)^4) (((nD+(((E^((1/2) (((((x-μD))^2)/((σD)^2))-((((x-μH))^2)/((σH)^2))))) nH σD)/(σH))))^4) ((σH)^8))))]
dfubpnn[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,-(((-2+nD+nH) (-1+nU) (((2 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((σD)^6) ((σH)^6)+(nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((((((x-μD))^2)-((σD)^2)))^2) ((σH)^6)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((σD)^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((σH)^6)+(1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((σD)^6) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((((((x-μH))^2)-((σH)^2)))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) (((x-μH))^2) ((σD)^6) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2))))^2))/((1-nU) (((-2 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) (((x-μH))^2) ((σD)^6) ((σH)^4)-2 (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((σD)^4) ((σH)^6)-2 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((σD)^6) ((σH)^6)+(nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((σD)^2) ((((((x-μD))^2)-((σD)^2)))^2) ((σH)^6)+(1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((σD)^6) ((σH)^2) ((((((x-μH))^2)-((σH)^2)))^2)))^2)+4 (((-1+nD))^2) (nD^4) (2-nD-nH) (((-1+nH))^2) (nH^4) (((4+nD+nH))^4) (((b0+b1 x))^4) (((((μH)^4) ((σD)^6)-((μH)^2) ((σD)^6) ((σH)^2)+((σD)^6) ((σH)^4)+((μD)^4) ((σH)^6)-((μD)^2) ((σD)^2) ((σH)^6)+((σD)^4) ((σH)^6)+(x^4) (((σD)^6)+((σH)^6))-4 (x^3) (μH ((σD)^6)+μD ((σH)^6))+x (-4 ((μH)^3) ((σD)^6)+2 μH ((σD)^6) ((σH)^2)+2 μD (-2 ((μD)^2)+((σD)^2)) ((σH)^6))+(x^2) (6 ((μH)^2) ((σD)^6)-((σH)^2) (((σD)^6)-6 ((μD)^2) ((σH)^4)+((σD)^2) ((σH)^4)))))^2))),1,-(((-2+nD+nH) (-1+nU) (((2 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((σD)^6) ((σH)^6)+(nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) (-2 (-1+nD) (b0^2)-2 (-1+nD) (b1^2) (x^2)-((σD)^2)) ((((((x-μD))^2)-((σD)^2)))^2) ((σH)^6)+2 (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((σD)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2)) ((σH)^6)+(1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((σD)^6) (-2 (-1+nH) (b0^2)-2 (-1+nH) (b1^2) (x^2)-((σH)^2)) ((((((x-μH))^2)-((σH)^2)))^2)+2 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) (((x-μH))^2) ((σD)^6) ((σH)^2) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2))))^2))/((1-nU) (((-2 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) (((x-μH))^2) ((σD)^6) ((σH)^4)-2 (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((σD)^4) ((σH)^6)-2 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((σD)^6) ((σH)^6)+(nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((σD)^2) ((((((x-μD))^2)-((σD)^2)))^2) ((σH)^6)+(1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((σD)^6) ((σH)^2) ((((((x-μH))^2)-((σH)^2)))^2)))^2)+4 (((-1+nD))^2) (nD^4) (2-nD-nH) (((-1+nH))^2) (nH^4) (((4+nD+nH))^4) ((((b0^2)+(b1^2) (x^2)))^2) (((((μH)^4) ((σD)^6)-((μH)^2) ((σD)^6) ((σH)^2)+((σD)^6) ((σH)^4)+((μD)^4) ((σH)^6)-((μD)^2) ((σD)^2) ((σH)^6)+((σD)^4) ((σH)^6)+(x^4) (((σD)^6)+((σH)^6))-4 (x^3) (μH ((σD)^6)+μD ((σH)^6))+x (-4 ((μH)^3) ((σD)^6)+2 μH ((σD)^6) ((σH)^2)+2 μD (-2 ((μD)^2)+((σD)^2)) ((σH)^6))+(x^2) (6 ((μH)^2) ((σD)^6)-((σH)^2) (((σD)^6)-6 ((μD)^2) ((σH)^4)+((σD)^2) ((σH)^4)))))^2)))],If[b0>0&&b1>0,Min[nD-1,nH-1,nU-1],Min[nD-1,nH-1]]],If[b0>0&&b1>0,2nD+2nH+nU-5,2nD+2nH-4]]
bpnl[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+(((E^(((((x-μD))^2)/(2 ((σD)^2)))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH σD)/(nD x (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))
ubpnl[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/(4 (Sqrt[2])))(√(((E^(((((x-μD))^2)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μH)^2) ((σD)^6) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+16 (nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((((((x-μD))^2)-((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+32 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) ((σD)^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^6) ((σH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((σD)^6) (nH (((b0+b1 x))^2)+((σH)^2)) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))/((-1+nD) (-1+nH) (((4+nD+nH))^2) (x^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((nD+(((E^(((((x-μD))^2)/(2 ((σD)^2)))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH σD)/(x (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))^4) ((Log[1+(((σH)^2)/((μH)^2))])^5)))),1,(1/(4 (Sqrt[2])))(√(((E^(((((x-μD))^2)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μH)^2) ((σD)^6) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+16 (nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) (-2 (-1+nD) ((b0^2)+(b1^2) (x^2))-((σD)^2)) ((((((x-μD))^2)-((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+32 (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) ((σD)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((σD)^6) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2)) (((-4 ((σH)^2) (((Log[x]-Log[μH]))^2)+4 (((σH)^2)+(((μH)^2)+((σH)^2)) (Log[x]-Log[μH])) Log[1+(((σH)^2)/((μH)^2))]+(2 ((μH)^2)+3 ((σH)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^2)))^2)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^6) ((σH)^2) (2 (-1+nH) ((b0^2)+(b1^2) (x^2))+((σH)^2)) (((-4 (((Log[x]-Log[μH]))^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)))/((-1+nD) (-1+nH) (((4+nD+nH))^2) (x^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((nD+(((E^(((((x-μD))^2)/(2 ((σD)^2)))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH σD)/(x (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))^4) ((Log[1+(((σH)^2)/((μH)^2))])^5))))]
dfubpnl[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((-2+nD+nH) (-1+nU) ((((E^(((((x-μD))^2)/(2 ((σD)^2)))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH σD+nD x (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))^8) (((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μH)^2) ((σD)^6) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+16 (nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((((((x-μD))^2)-((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+32 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) ((σD)^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^6) ((σH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((σD)^6) (nH (((b0+b1 x))^2)+((σH)^2)) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2))/((((nD x+(((E^(((((x-μD))^2)/(2 ((σD)^2)))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH σD)/(Sqrt[Log[1+(((σH)^2)/((μH)^2))]]))))^8) ((Log[1+(((σH)^2)/((μH)^2))])^4) (-((1-nU) (((32 (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μH)^2) ((σD)^6) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)-16 (nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((((((x-μD))^2)-((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^6) ((σH)^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((σD)^6) ((σH)^2) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2))-(nD^2) (2-nD-nH) (nH^2) (((4+nD+nH))^4) (((-32 (-1+nD) (-1+nH) nH (((x-μD))^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+16 nD (1-nH) nH ((μH)^2) ((σD)^2) ((((((x-μD))^2)-((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+16 nD (1-nH) nH ((μH)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((((((x-μD))^2)-((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+32 (1-nD) (1-nH) nH (((x-μD))^2) ((μH)^2) ((σD)^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)-(-1+nD) nD nH ((μH)^2) ((σD)^6) ((σH)^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+(-1+nD) nD nH ((μH)^2) ((σD)^6) ((σH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) nD (1-nH) ((σD)^6) (nH (((b0+b1 x))^2)+((σH)^2)) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)-2 (1-nD) nD (1-nH) ((σD)^6) (((4 ((σH)^3) Log[1+(((σH)^2)/((μH)^2))]+2 σH (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^3) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2))),1,((-2+nD+nH) (-1+nU) ((((E^(((((x-μD))^2)/(2 ((σD)^2)))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH σD+nD x (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))^8) (((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μH)^2) ((σD)^6) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+16 (nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) (-2 (-1+nD) ((b0^2)+(b1^2) (x^2))-((σD)^2)) ((((((x-μD))^2)-((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+32 (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) ((σD)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((σD)^6) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2)) (((-4 ((σH)^2) (((Log[x]-Log[μH]))^2)+4 (((σH)^2)+(((μH)^2)+((σH)^2)) (Log[x]-Log[μH])) Log[1+(((σH)^2)/((μH)^2))]+(2 ((μH)^2)+3 ((σH)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^2)))^2)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^6) ((σH)^2) (2 (-1+nH) ((b0^2)+(b1^2) (x^2))+((σH)^2)) (((-4 (((Log[x]-Log[μH]))^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)))^2))/((((nD x+(((E^(((((x-μD))^2)/(2 ((σD)^2)))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH σD)/(Sqrt[Log[1+(((σH)^2)/((μH)^2))]]))))^8) ((Log[1+(((σH)^2)/((μH)^2))])^4) (-((1-nU) (((32 (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μH)^2) ((σD)^6) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)-16 (nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((((((x-μD))^2)-((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((σD)^6) ((σH)^2) (((-4 ((σH)^2) (((Log[x]-Log[μH]))^2)+4 (((σH)^2)+(((μH)^2)+((σH)^2)) (Log[x]-Log[μH])) Log[1+(((σH)^2)/((μH)^2))]+(2 ((μH)^2)+3 ((σH)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^2)))^2)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^6) ((σH)^4) (((-4 (((Log[x]-Log[μH]))^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)))^2))-(nD^2) (2-nD-nH) (nH^2) (((4+nD+nH))^4) (((-32 (-1+nD) (-1+nH) nH (((x-μD))^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+16 nD (1-nH) nH ((μH)^2) ((σD)^2) ((((((x-μD))^2)-((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+16 nD (1-nH) nH ((μH)^2) (-2 (-1+nD) ((b0^2)+(b1^2) (x^2))-((σD)^2)) ((((((x-μD))^2)-((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+32 (-1+nD) (-1+nH) nH (((x-μD))^2) ((μH)^2) ((σD)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)-2 (1-nD) nD (1-nH) ((σD)^6) ((σH)^2) (((-4 ((σH)^2) (((Log[x]-Log[μH]))^2)+4 (((σH)^2)+(((μH)^2)+((σH)^2)) (Log[x]-Log[μH])) Log[1+(((σH)^2)/((μH)^2))]+(2 ((μH)^2)+3 ((σH)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^2)))^2)+2 (1-nD) nD (1-nH) ((σD)^6) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2)) (((-4 ((σH)^2) (((Log[x]-Log[μH]))^2)+4 (((σH)^2)+(((μH)^2)+((σH)^2)) (Log[x]-Log[μH])) Log[1+(((σH)^2)/((μH)^2))]+(2 ((μH)^2)+3 ((σH)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^2)))^2)-(-1+nD) nD nH ((μH)^2) ((σD)^6) ((σH)^4) (((-4 (((Log[x]-Log[μH]))^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+(-1+nD) nD nH ((μH)^2) ((σD)^6) ((σH)^2) (2 (-1+nH) ((b0^2)+(b1^2) (x^2))+((σH)^2)) (((-4 (((Log[x]-Log[μH]))^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)))^2)))],If[b0>0&&b1>0,Min[nD-1,nH-1,nU-1],Min[nD-1,nH-1]]],If[b0>0&&b1>0,2nD+2nH+nU-5,2nD+2nH-4]]
bpng[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=1-(1/(1+(((E^(-((((x-μD))^2)/(2 ((σD)^2)))+((x μH)/((σH)^2)))) nD (x^(1-(((μH)^2)/((σH)^2)))) ((((((σH)^2)/(μH))))^(((μH)^2)/((σH)^2))) Gamma[(((μH)^2)/((σH)^2))])/(nH (Sqrt[2 π]) σD))))
ubpng[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(Sqrt[π]) √(((E^(((((x-μD))^2)/((σD)^2))-((2 x μH)/((σH)^2)))) (x^(-2+((2 ((μH)^2))/((σH)^2)))) ((((((σH)^2)/(μH))))^(-((2 ((μH)^2))/((σH)^2)))) (((2 (2+nD) (2+nH) (((nD+nH))^3) ((σD)^6))/(((4+nD+nH))^2))+(((nD^2) (nH^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((((((x-μD))^2)-((σD)^2)))^2))/(1-nD))+2 nD (nH^2) (((x-μD))^2) ((σD)^2) (nD (((b0+b1 x))^2)+((σD)^2))+(1/((-1+nH) ((σH)^6)))4 (nD^2) (nH^2) ((μH)^2) ((σD)^6) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(1/((σH)^4))2 (nD^2) nH ((σD)^6) (nH (((b0+b1 x))^2)+((σH)^2)) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))/(((σD)^4) (((nD+(((E^(((((x-μD))^2)/(2 ((σD)^2)))-((x μH)/((σH)^2)))) nH (Sqrt[2 π]) (x^(-1+(((μH)^2)/((σH)^2)))) σD ((((((σH)^2)/(μH))))^(-(((μH)^2)/((σH)^2)))))/(Gamma[(((μH)^2)/((σH)^2))]))))^4) ((Gamma[(((μH)^2)/((σH)^2))])^2))),1,(Sqrt[π]) √(((E^(((((x-μD))^2)/((σD)^2))-((2 x μH)/((σH)^2)))) (x^(-2+((2 ((μH)^2))/((σH)^2)))) ((((((σH)^2)/(μH))))^(-((2 ((μH)^2))/((σH)^2)))) (((2 (2+nD) (2+nH) (((nD+nH))^3) ((σD)^6))/(((4+nD+nH))^2))+(((nD^2) (nH^2) ((((((x-μD))^2)-((σD)^2)))^2) (2 (-1+nD) ((b0^2)+(b1^2) (x^2))+((σD)^2)))/(-1+nD))+2 nD (nH^2) (((x-μD))^2) ((σD)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2))+(1/((-1+nH) ((σH)^6)))4 (nD^2) (nH^2) ((μH)^2) ((σD)^6) (2 (-1+nH) ((b0^2)+(b1^2) (x^2))+((σH)^2)) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(1/((σH)^4))2 (nD^2) nH ((σD)^6) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2)) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))/(((σD)^4) (((nD+(((E^(((((x-μD))^2)/(2 ((σD)^2)))-((x μH)/((σH)^2)))) nH (Sqrt[2 π]) (x^(-1+(((μH)^2)/((σH)^2)))) σD ((((((σH)^2)/(μH))))^(-(((μH)^2)/((σH)^2)))))/(Gamma[(((μH)^2)/((σH)^2))]))))^4) ((Gamma[(((μH)^2)/((σH)^2))])^2)))]
dfubpng[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,-(((((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) (-1+nU) ((σH)^12) (((((2 (2+nD) (2+nH) (((nD+nH))^3) ((σD)^6))/(((4+nD+nH))^2))+(((nD^2) (nH^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((((((x-μD))^2)-((σD)^2)))^2))/(1-nD))+2 nD (nH^2) (((x-μD))^2) ((σD)^2) (nD (((b0+b1 x))^2)+((σD)^2))+(1/((-1+nH) ((σH)^6)))4 (nD^2) (nH^2) ((μH)^2) ((σD)^6) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(1/((σH)^4))2 (nD^2) nH ((σD)^6) (nH (((b0+b1 x))^2)+((σH)^2)) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2))/((1-nU) ((σH)^4) (((2 (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((σD)^4) ((σH)^4)+2 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((σD)^6) ((σH)^4)-(nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((σD)^2) ((((((x-μD))^2)-((σD)^2)))^2) ((σH)^4)+4 (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^6) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+2 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^6) ((σH)^2) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2)+(nD^2) (2-nD-nH) (nH^2) (((4+nD+nH))^4) (((2 (-1+nD) (-1+nH) nH (((x-μD))^2) ((σD)^4) ((σH)^6)-nD (1-nH) nH ((σD)^2) ((((((x-μD))^2)-((σD)^2)))^2) ((σH)^6)+nD (1-nH) nH ((((((x-μD))^2)-((σD)^2)))^2) (2 (-1+nD) (((b0+b1 x))^2)+((σD)^2)) ((σH)^6)-2 (1-nD) (1-nH) nH (((x-μD))^2) ((σD)^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((σH)^6)+4 (-1+nD) nD nH ((μH)^2) ((σD)^6) ((σH)^2) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+4 (1-nD) nD nH ((μH)^2) ((σD)^6) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+2 (-1+nD) nD (-1+nH) ((σD)^6) ((σH)^4) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)-2 (1-nD) nD (1-nH) ((σD)^6) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2))),1,-(((((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) (-1+nU) ((σH)^12) (((((2 (2+nD) (2+nH) (((nD+nH))^3) ((σD)^6))/(((4+nD+nH))^2))+(((nD^2) (nH^2) ((((((x-μD))^2)-((σD)^2)))^2) (2 (-1+nD) ((b0^2)+(b1^2) (x^2))+((σD)^2)))/(-1+nD))+2 nD (nH^2) (((x-μD))^2) ((σD)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2))+(1/((-1+nH) ((σH)^6)))4 (nD^2) (nH^2) ((μH)^2) ((σD)^6) (2 (-1+nH) ((b0^2)+(b1^2) (x^2))+((σH)^2)) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(1/((σH)^4))2 (nD^2) nH ((σD)^6) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2)) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2))/((1-nU) ((σH)^4) (((2 (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((σD)^4) ((σH)^4)+2 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((σD)^6) ((σH)^4)-(nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((σD)^2) ((((((x-μD))^2)-((σD)^2)))^2) ((σH)^4)+4 (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^6) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+2 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^6) ((σH)^2) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2)+(nD^2) (2-nD-nH) (nH^2) (((4+nD+nH))^4) (((2 (-1+nD) (-1+nH) nH (((x-μD))^2) ((σD)^4) ((σH)^6)-nD (1-nH) nH ((σD)^2) ((((((x-μD))^2)-((σD)^2)))^2) ((σH)^6)+nD (1-nH) nH ((((((x-μD))^2)-((σD)^2)))^2) (2 (-1+nD) ((b0^2)+(b1^2) (x^2))+((σD)^2)) ((σH)^6)-2 (-1+nD) (-1+nH) nH (((x-μD))^2) ((σD)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2)) ((σH)^6)+4 (-1+nD) nD nH ((μH)^2) ((σD)^6) ((σH)^2) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+4 (1-nD) nD nH ((μH)^2) ((σD)^6) (2 (-1+nH) ((b0^2)+(b1^2) (x^2))+((σH)^2)) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+2 (-1+nD) nD (-1+nH) ((σD)^6) ((σH)^4) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)-2 (-1+nD) nD (-1+nH) ((σD)^6) ((σH)^2) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2)) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2)))],If[b0>0&&b1>0,Min[nD-1,nH-1,nU-1],Min[nD-1,nH-1]]],If[b0>0&&b1>0,2nD+2nH+nU-5,2nD+2nH-4]]
bpln[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+(((E^((1/8) (-((4 (((x-μH))^2))/((σH)^2))+((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(Log[1+(((σD)^2)/((μD)^2))]))))) nH x (Sqrt[Log[1+(((σD)^2)/((μD)^2))]]))/(nD σH))))
ubpln[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/(4 (Sqrt[2])))(√(((E^((1/4) (((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(Log[1+(((σD)^2)/((μD)^2))]))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(Log[1+(((σH)^2)/((μH)^2))]))))) (32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((nD+(1/(Sqrt[Log[1+(((σH)^2)/((μH)^2))]]))(E^((1/8) (((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(Log[1+(((σD)^2)/((μD)^2))]))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(Log[1+(((σH)^2)/((μH)^2))]))))) nH (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))^4) ((Log[1+(((σH)^2)/((μH)^2))])^5)))),1,(1/(4 (Sqrt[2])))(√(((E^((1/4) (((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(Log[1+(((σD)^2)/((μD)^2))]))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(Log[1+(((σH)^2)/((μH)^2))]))))) (32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (2 (-1+nD) (b0^2)+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (-1+nH) (b0^2)+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((nD+(1/(Sqrt[Log[1+(((σH)^2)/((μH)^2))]]))(E^((1/8) (((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(Log[1+(((σD)^2)/((μD)^2))]))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(Log[1+(((σH)^2)/((μH)^2))]))))) nH (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))^4) ((Log[1+(((σH)^2)/((μH)^2))])^5))))]
dfubpln[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,(((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2)/((((4+nD+nH))^4) ((1/((-2+nD+nH) (((4+nD+nH))^4)))(((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) (((nD (-1+nH) nH ((μD)^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)-nD (-1+nH) nH ((μD)^2) ((μH)^2) ((σD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) (1-nH) nH ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)-2 (1-nD) (1-nH) nH ((μH)^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) nD nH ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)-(-1+nD) nD nH ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) nD (1-nH) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)-2 (1-nD) nD (1-nH) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2))),1,(((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (2 (-1+nD) (b0^2)+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (-1+nH) (b0^2)+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2)/((((4+nD+nH))^4) ((1/((-2+nD+nH) (((4+nD+nH))^4)))(((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) (((nD (-1+nH) nH ((μD)^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)-nD (-1+nH) nH ((μD)^2) ((μH)^2) ((σD)^2) (2 (-1+nD) (b0^2)+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) (1-nH) nH ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)-2 (1-nD) (1-nH) nH ((μH)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) nD nH ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)-(-1+nD) nD nH ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (-1+nH) (b0^2)+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) nD (1-nH) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)-2 (1-nD) nD (1-nH) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2)))],If[b0>0&&b1>0,Min[nD-1,nH-1,nU-1],Min[nD-1,nH-1]]],If[b0>0&&b1>0,2nD+2nH+nU-5,2nD+2nH-4]]
bpll[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+(((E^((1/8) (((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(Log[1+(((σD)^2)/((μD)^2))]))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(Log[1+(((σH)^2)/((μH)^2))]))))) nH (Sqrt[Log[1+(((σD)^2)/((μD)^2))]]))/(nD (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))
ubpll[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/(4 (Sqrt[2])))(√(((E^((1/4) (((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(Log[1+(((σD)^2)/((μD)^2))]))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(Log[1+(((σH)^2)/((μH)^2))]))))) (32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((nD+(1/(Sqrt[Log[1+(((σH)^2)/((μH)^2))]]))(E^((1/8) (((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(Log[1+(((σD)^2)/((μD)^2))]))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(Log[1+(((σH)^2)/((μH)^2))]))))) nH (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))^4) ((Log[1+(((σH)^2)/((μH)^2))])^5)))),1,(1/(4 (Sqrt[2])))(√(((E^((1/4) (((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(Log[1+(((σD)^2)/((μD)^2))]))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(Log[1+(((σH)^2)/((μH)^2))]))))) (32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (2 (-1+nD) (b0^2)+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (-1+nH) (b0^2)+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((nD+(1/(Sqrt[Log[1+(((σH)^2)/((μH)^2))]]))(E^((1/8) (((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(Log[1+(((σD)^2)/((μD)^2))]))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(Log[1+(((σH)^2)/((μH)^2))]))))) nH (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))^4) ((Log[1+(((σH)^2)/((μH)^2))])^5))))]
dfubpll[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=
Min[Max[Switch[nl,0,(((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2)/((((4+nD+nH))^4) ((1/((-2+nD+nH) (((4+nD+nH))^4)))(((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) (((nD (-1+nH) nH ((μD)^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)-nD (-1+nH) nH ((μD)^2) ((μH)^2) ((σD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) (1-nH) nH ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)-2 (1-nD) (1-nH) nH ((μH)^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) nD nH ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)-(-1+nD) nD nH ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) nD (1-nH) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)-2 (1-nD) nD (1-nH) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2))),1,(((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (2 (-1+nD) (b0^2)+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (-1+nH) (b0^2)+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2)/((((4+nD+nH))^4) ((1/((-2+nD+nH) (((4+nD+nH))^4)))(((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) (((nD (-1+nH) nH ((μD)^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)-nD (-1+nH) nH ((μD)^2) ((μH)^2) ((σD)^2) (2 (-1+nD) (b0^2)+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+2 (1-nD) (1-nH) nH ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)-2 (1-nD) (1-nH) nH ((μH)^2) (nD ((b0^2)+(b1^2) (x^2))+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^4)+(-1+nD) nD nH ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)-(-1+nD) nD nH ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (-1+nH) (b0^2)+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+2 (1-nD) nD (1-nH) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)-2 (1-nD) nD (1-nH) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (nH ((b0^2)+(b1^2) (x^2))+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)))^2)))],If[b0>0&&b1>0,Min[nD-1,nH-1,nU-1],Min[nD-1,nH-1]]],If[b0>0&&b1>0,2nD+2nH+nU-5,2nD+2nH-4]]
bplg[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=((Sqrt[2]) (E^((x μH)/((σH)^2))) nD ((((((σH)^2)/(μH))))^(((μH)^2)/((σH)^2))) Gamma[(((μH)^2)/((σH)^2))])/((Sqrt[2]) (E^((x μH)/((σH)^2))) nD ((((((σH)^2)/(μH))))^(((μH)^2)/((σH)^2))) Gamma[(((μH)^2)/((σH)^2))]+2 (E^((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(8 Log[1+(((σD)^2)/((μD)^2))]))) nH (Sqrt[π]) (x^(((μH)^2)/((σH)^2))) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]]))
ubplg[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/2) (Sqrt[π]) √(((E^(((2 x μH)/((σH)^2))+((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (x^((2 ((μH)^2))/((σH)^2))) ((((((σH)^2)/(μH))))^((2 ((μH)^2))/((σH)^2))) ((Gamma[(((μH)^2)/((σH)^2))])^2) (32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Log[1+(((σD)^2)/((μD)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((σD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) ((σH)^6) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((σH)^6) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)+64 (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+32 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((((Sqrt[2]) (E^((x μH)/((σH)^2))) nD ((((((σH)^2)/(μH))))^(((μH)^2)/((σH)^2))) Gamma[(((μH)^2)/((σH)^2))]+2 (E^((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(8 Log[1+(((σD)^2)/((μD)^2))]))) nH (Sqrt[π]) (x^(((μH)^2)/((σH)^2))) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))^4) ((Log[1+(((σD)^2)/((μD)^2))])^3))),1,(1/2) (Sqrt[π]) √(((E^(((2 x μH)/((σH)^2))+((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (x^((2 ((μH)^2))/((σH)^2))) ((((((σH)^2)/(μH))))^((2 ((μH)^2))/((σH)^2))) ((Gamma[(((μH)^2)/((σH)^2))])^2) (32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Log[1+(((σD)^2)/((μD)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)+64 (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+32 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((((Sqrt[2]) (E^((x μH)/((σH)^2))) nD ((((((σH)^2)/(μH))))^(((μH)^2)/((σH)^2))) Gamma[(((μH)^2)/((σH)^2))]+2 (E^((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(8 Log[1+(((σD)^2)/((μD)^2))]))) nH (Sqrt[π]) (x^(((μH)^2)/((σH)^2))) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))^4) ((Log[1+(((σD)^2)/((μD)^2))])^3)))]
dfubplg[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,(((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Log[1+(((σD)^2)/((μD)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((σD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) ((σH)^6) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((σH)^6) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)+64 (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+32 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2)/((((4+nD+nH))^4) ((1/((-2+nD+nH) (((4+nD+nH))^4)))(((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Log[1+(((σD)^2)/((μD)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((σD)^4) ((σH)^6) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((σD)^2) ((σH)^6) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)+64 (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+32 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) (((nD (-1+nH) nH ((μD)^2) ((σD)^4) ((σH)^6) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2)-nD (-1+nH) nH ((μD)^2) ((σD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) ((σH)^6) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2)-2 (1-nD) (1-nH) nH (nD (((b0+b1 x))^2)+((σD)^2)) ((σH)^6) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)+2 (1-nD) (1-nH) nH ((σH)^6) (((4 ((σD)^3) Log[1+(((σD)^2)/((μD)^2))]+2 σD (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^3) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)+64 (-1+nD) nD nH ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)-64 (-1+nD) nD nH ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+32 (-1+nD) nD (-1+nH) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)-32 (-1+nD) nD (-1+nH) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2))),1,(((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Log[1+(((σD)^2)/((μD)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)+64 (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+32 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2)/((((4+nD+nH))^4) ((1/((-2+nD+nH) (((4+nD+nH))^4)))(((32 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Log[1+(((σD)^2)/((μD)^2))])^4)+(nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((σD)^4) ((σH)^6) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2)+2 (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((σD)^2) ((σH)^6) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)+64 (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+32 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) (((nD (-1+nH) nH ((μD)^2) ((σD)^4) ((σH)^6) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2)-nD (-1+nH) nH ((μD)^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) (((-4 ((Log[x])^2)+8 Log[x] Log[μD]-4 ((Log[μD])^2)+Log[1+(((σD)^2)/((μD)^2))] (4+Log[1+(((σD)^2)/((μD)^2))])))^2)-2 (1-nD) (1-nH) nH ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) (((4 ((σD)^2) Log[1+(((σD)^2)/((μD)^2))]+2 (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^2) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)+2 (1-nD) (1-nH) nH ((σH)^6) (((4 ((σD)^3) Log[1+(((σD)^2)/((μD)^2))]+2 σD (((μD)^2)+2 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))] (2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])-((σD)^3) (((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)+64 (-1+nD) nD nH ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)-64 (-1+nD) nD nH ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+32 (-1+nD) nD (-1+nH) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)-32 (-1+nD) nD (-1+nH) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2)))],If[b0>0&&b1>0,Min[nD-1,nH-1,nU-1],Min[nD-1,nH-1]]],If[b0>0&&b1>0,2nD+2nH+nU-5,2nD+2nH-4]]
bpgn[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+(((E^(((x μD)/((σD)^2))-((((x-μH))^2)/(2 ((σH)^2))))) nH (x^(1-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/(nD (Sqrt[2 π]) σH))))
ubpgn[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/2) √(((E^(((2 x μD)/((σD)^2))-((((x-μH))^2)/((σH)^2)))) (x^(2-((2 ((μD)^2))/((σD)^2)))) ((((((σD)^2)/(μD))))^((2 ((μD)^2))/((σD)^2))) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((2 (2+nD) (2+nH) (((nD+nH))^3) ((σH)^6))/((((4+nD+nH))^2) π))+(1/(π-nH π))(nD^2) (nH^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((((((x-μH))^2)-((σH)^2)))^2)+((2 (nD^2) nH (((x-μH))^2) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)))/π)+(1/((-1+nD) π ((σD)^6)))4 (nD^2) (nH^2) ((μD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) ((σH)^6) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/(π ((σD)^4)))2 nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((σH)^6) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))/(((σH)^8) (((nD+(((E^(((x μD)/((σD)^2))-((((x-μH))^2)/(2 ((σH)^2))))) nH (x^(1-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/((Sqrt[2 π]) σH))))^4))),1,(1/(2 (Sqrt[π])))(√(((E^(((2 x μD)/((σD)^2))-((((x-μH))^2)/((σH)^2)))) (x^(2-((2 ((μD)^2))/((σD)^2)))) ((((((σD)^2)/(μD))))^((2 ((μD)^2))/((σD)^2))) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((2 (2+nD) (2+nH) (((nD+nH))^3) ((σH)^6))/(((4+nD+nH))^2))+(1/(-1+nH))(nD^2) (nH^2) ((((x^2)-2 x μH+((μH)^2)-((σH)^2)))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2))+2 (nD^2) nH (((x-μH))^2) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2))+(1/((-1+nD) ((σD)^6)))4 (nD^2) (nH^2) ((μD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^4))2 nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))/(((σH)^8) (((nD+(((E^(((x μD)/((σD)^2))-((((x-μH))^2)/(2 ((σH)^2))))) nH (x^(1-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/((Sqrt[2 π]) σH))))^4))))]
dfubpgn[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,-(((((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) (-1+nU) ((σD)^12) (((2 nD (Sqrt[π]) σH+(Sqrt[2]) (E^(((x μD)/((σD)^2))-((((x-μH))^2)/(2 ((σH)^2))))) nH (x^(1-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))]))^8) (((((2 (2+nD) (2+nH) (((nD+nH))^3) ((σH)^6))/((((4+nD+nH))^2) π))+(1/(π-nH π))(nD^2) (nH^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((((((x-μH))^2)-((σH)^2)))^2)+((2 (nD^2) nH (((x-μH))^2) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)))/π)+(1/((-1+nD) π ((σD)^6)))4 (nD^2) (nH^2) ((μD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) ((σH)^6) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/(π ((σD)^4)))2 nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((σH)^6) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))^2))/(256 (((nD σH+(((E^(((x μD)/((σD)^2))-((((x-μH))^2)/(2 ((σH)^2))))) nH (x^(1-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/(Sqrt[2 π]))))^8) ((1-nU) ((σD)^4) (((2 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) π (((x-μH))^2) ((σD)^4) ((σH)^4)+2 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((σD)^4) ((σH)^6)-(1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) π ((σD)^4) ((σH)^2) ((((((x-μH))^2)-((σH)^2)))^2)-4 (nD^2) (nH^2) (((4+nD+nH))^2) (π-nH π) ((μD)^2) ((σH)^6) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+2 (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) π ((σD)^2) ((σH)^6) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))^2)+(nD^2) (2-nD-nH) (nH^2) (((4+nD+nH))^4) (((2 (-1+nD) nD (-1+nH) π (((x-μH))^2) ((σD)^6) ((σH)^4)-(1-nD) nD nH π ((σD)^6) ((σH)^2) ((((((x-μH))^2)-((σH)^2)))^2)+(1-nD) nD nH π ((σD)^6) ((((((x-μH))^2)-((σH)^2)))^2) (2 (-1+nH) (((b0+b1 x))^2)+((σH)^2))-2 (1-nD) nD (π-nH π) (((x-μH))^2) ((σD)^6) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2))-4 nD nH (π-nH π) ((μD)^2) ((σD)^2) ((σH)^6) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+4 nD nH (π-nH π) ((μD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) ((σH)^6) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+2 (-1+nD) (-1+nH) nH π ((σD)^4) ((σH)^6) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)-2 (1-nD) nH (π-nH π) ((σD)^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((σH)^6) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))^2)))),1,-(((((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) (-1+nU) ((σD)^12) (((2 nD (Sqrt[π]) σH+(Sqrt[2]) (E^(((x μD)/((σD)^2))-((((x-μH))^2)/(2 ((σH)^2))))) nH (x^(1-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))]))^8) (((((2 (2+nD) (2+nH) (((nD+nH))^3) ((σH)^6))/(((4+nD+nH))^2))+(1/(-1+nH))(nD^2) (nH^2) ((((x^2)-2 x μH+((μH)^2)-((σH)^2)))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2))+2 (nD^2) nH (((x-μH))^2) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2))+(1/((-1+nD) ((σD)^6)))4 (nD^2) (nH^2) ((μD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^4))2 nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))^2))/(256 (π^4) (((nD σH+(((E^(((x μD)/((σD)^2))-((((x-μH))^2)/(2 ((σH)^2))))) nH (x^(1-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/(Sqrt[2 π]))))^8) ((1-nU) ((σD)^4) (((2 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) (((x-μH))^2) ((σD)^4) ((σH)^4)+2 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((σD)^4) ((σH)^6)+(-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((σD)^4) ((σH)^2) ((((x^2)-2 x μH+((μH)^2)-((σH)^2)))^2)+4 (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((σH)^6) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+2 (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((σD)^2) ((σH)^6) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))^2)+(nD^2) (2-nD-nH) (nH^2) (((4+nD+nH))^4) (((2 (-1+nD) nD (-1+nH) (((x-μH))^2) ((σD)^6) ((σH)^4)+(-1+nD) nD nH ((σD)^6) ((σH)^2) ((((x^2)-2 x μH+((μH)^2)-((σH)^2)))^2)+(1-nD) nD nH ((σD)^6) ((((x^2)-2 x μH+((μH)^2)-((σH)^2)))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2))-2 (-1+nD) nD (-1+nH) (((x-μH))^2) ((σD)^6) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2))+4 nD (-1+nH) nH ((μD)^2) ((σD)^2) ((σH)^6) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+4 nD (1-nH) nH ((μD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+2 (-1+nD) (-1+nH) nH ((σD)^4) ((σH)^6) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)-2 (-1+nD) (-1+nH) nH ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))^2))))],If[b0>0&&b1>0,Min[nD-1,nH-1,nU-1],Min[nD-1,nH-1]]],If[b0>0&&b1>0,2nD+2nH+nU-5,2nD+2nH-4]]
bpgl[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+(((E^(((x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH (x^(-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/(nD (Sqrt[2 π]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))
ubpgl[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/(8 (Sqrt[π])))(√(((E^(((2 x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (x^(-((2 ((μD)^2))/((σD)^2)))) ((((((σD)^2)/(μD))))^((2 ((μD)^2))/((σD)^2))) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σH)^2)/((μH)^2))])^4))/(((4+nD+nH))^2))+(1/((-1+nH) (((((μH)^2)+((σH)^2)))^2)))(nD^2) (nH^2) ((σH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+(1/(((μH)^2) (((((μH)^2)+((σH)^2)))^2)))2 (nD^2) nH (nH (((b0+b1 x))^2)+((σH)^2)) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)+(1/((-1+nD) ((σD)^6)))64 (nD^2) (nH^2) ((μD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^4))32 nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))/((((nD+((E^(((x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH (x^(-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/((Sqrt[2 π]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]]))))^4) ((Log[1+(((σH)^2)/((μH)^2))])^5)))),1,(1/(8 (Sqrt[π])))(√(((E^(((2 x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (x^(-((2 ((μD)^2))/((σD)^2)))) ((((((σD)^2)/(μD))))^((2 ((μD)^2))/((σD)^2))) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σH)^2)/((μH)^2))])^4))/(((4+nD+nH))^2))+((nD^2) (nH^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2))/((-1+nH) (((((μH)^2)+((σH)^2)))^2))+(1/(((μH)^2) (((((μH)^2)+((σH)^2)))^2)))2 (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)+(1/((-1+nD) ((σD)^6)))64 (nD^2) (nH^2) ((μD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^4))32 nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))/((((nD+(((E^(((x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH (x^(-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/((Sqrt[2 π]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))^4) ((Log[1+(((σH)^2)/((μH)^2))])^5))))]
dfubpgl[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((E^(((4 x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(2 Log[1+(((σH)^2)/((μH)^2))])))) (x^(-((4 ((μD)^2))/((σD)^2)))) ((((((σD)^2)/(μD))))^((4 ((μD)^2))/((σD)^2))) ((Gamma[(((μD)^2)/((σD)^2))])^4) (((((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σH)^2)/((μH)^2))])^4))/(((4+nD+nH))^2))+(1/((-1+nH) (((((μH)^2)+((σH)^2)))^2)))(nD^2) (nH^2) ((σH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+(1/(((μH)^2) (((((μH)^2)+((σH)^2)))^2)))2 (nD^2) nH (nH (((b0+b1 x))^2)+((σH)^2)) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)+(1/((-1+nD) ((σD)^6)))64 (nD^2) (nH^2) ((μD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^4))32 nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))^2))/(4096 (π^2) (((nD+(((E^(((x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH (x^(-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/((Sqrt[2 π]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))^8) ((Log[1+(((σH)^2)/((μH)^2))])^10) (((E^(((4 x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(2 Log[1+(((σH)^2)/((μH)^2))])))) (x^(-((4 ((μD)^2))/((σD)^2)))) ((((((σD)^2)/(μD))))^((4 ((μD)^2))/((σD)^2))) ((Gamma[(((μD)^2)/((σD)^2))])^4) (((((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σH)^2)/((μH)^2))])^4))/(((4+nD+nH))^2))+((nD^2) (nH^2) ((σH)^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2))/((-1+nH) (((((μH)^2)+((σH)^2)))^2))+(1/(((μH)^2) (((((μH)^2)+((σH)^2)))^2)))2 (nD^2) nH ((σH)^2) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)+(1/((-1+nD) ((σD)^4)))64 (nD^2) (nH^2) ((μD)^2) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^2))32 nD (nH^2) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))^2))/(4096 (-2+nD+nH) (π^2) (((nD+(((E^(((x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH (x^(-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/((Sqrt[2 π]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))^8) ((Log[1+(((σH)^2)/((μH)^2))])^10))+((E^(((4 x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(2 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) (x^(-((4 ((μD)^2))/((σD)^2)))) ((((((σD)^2)/(μD))))^((4 ((μD)^2))/((σD)^2))) ((Gamma[(((μD)^2)/((σD)^2))])^4) ((((nD nH ((σH)^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2))/((-1+nH) (((((μH)^2)+((σH)^2)))^2))-(1/((-1+nH) (((((μH)^2)+((σH)^2)))^2)))nD nH ((σH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)-(1/(((μH)^2) (((((μH)^2)+((σH)^2)))^2)))2 nD (nH (((b0+b1 x))^2)+((σH)^2)) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)+(1/(((μH)^2) (((((μH)^2)+((σH)^2)))^2)))2 nD (((4 ((σH)^3) Log[1+(((σH)^2)/((μH)^2))]+2 σH (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^3) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)+(1/((-1+nD) ((σD)^4)))64 nD nH ((μD)^2) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)-(1/((-1+nD) ((σD)^6)))64 nD nH ((μD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^2))32 nH ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)-(1/((σD)^4))32 nH (nD (((b0+b1 x))^2)+((σD)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))^2))/(4096 (-1+nU) (π^2) (((nD+(((E^(((x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH (x^(-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/((Sqrt[2 π]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))^8) ((Log[1+(((σH)^2)/((μH)^2))])^10)))),1,((E^(((4 x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(2 Log[1+(((σH)^2)/((μH)^2))])))) (x^(-((4 ((μD)^2))/((σD)^2)))) ((((((σD)^2)/(μD))))^((4 ((μD)^2))/((σD)^2))) ((Gamma[(((μD)^2)/((σD)^2))])^4) (((((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σH)^2)/((μH)^2))])^4))/(((4+nD+nH))^2))+((nD^2) (nH^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2))/((-1+nH) (((((μH)^2)+((σH)^2)))^2))+(1/(((μH)^2) (((((μH)^2)+((σH)^2)))^2)))2 (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)+(1/((-1+nD) ((σD)^6)))64 (nD^2) (nH^2) ((μD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^4))32 nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))^2))/(4096 (π^2) (((nD+(((E^(((x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH (x^(-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/((Sqrt[2 π]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))^8) ((Log[1+(((σH)^2)/((μH)^2))])^10) (((E^(((4 x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(2 Log[1+(((σH)^2)/((μH)^2))])))) (x^(-((4 ((μD)^2))/((σD)^2)))) ((((((σD)^2)/(μD))))^((4 ((μD)^2))/((σD)^2))) ((Gamma[(((μD)^2)/((σD)^2))])^4) (((((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σH)^2)/((μH)^2))])^4))/(((4+nD+nH))^2))+((nD^2) (nH^2) ((σH)^4) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2))/((-1+nH) (((((μH)^2)+((σH)^2)))^2))+(1/(((μH)^2) (((((μH)^2)+((σH)^2)))^2)))2 (nD^2) nH ((σH)^2) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)+(1/((-1+nD) ((σD)^4)))64 (nD^2) (nH^2) ((μD)^2) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^2))32 nD (nH^2) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))^2))/(4096 (-2+nD+nH) (π^2) (((nD+(((E^(((x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH (x^(-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/((Sqrt[2 π]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))^8) ((Log[1+(((σH)^2)/((μH)^2))])^10))+((E^(((4 x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(2 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) (x^(-((4 ((μD)^2))/((σD)^2)))) ((((((σD)^2)/(μD))))^((4 ((μD)^2))/((σD)^2))) ((Gamma[(((μD)^2)/((σD)^2))])^4) ((((1/(((((μH)^2)+((σH)^2)))^2))(b0^2) nD nH ((σH)^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+(1/(((((μH)^2)+((σH)^2)))^2))(b1^2) nD nH (x^2) ((σH)^2) (((-4 ((Log[x])^2)+8 Log[x] Log[μH]-4 ((Log[μH])^2)+Log[1+(((σH)^2)/((μH)^2))] (4+Log[1+(((σH)^2)/((μH)^2))])))^2)+(1/(((μH)^2) (((((μH)^2)+((σH)^2)))^2)))nD ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((4 ((σH)^2) Log[1+(((σH)^2)/((μH)^2))]+2 (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^2) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)-(1/(((μH)^2) (((((μH)^2)+((σH)^2)))^2)))nD (((4 ((σH)^3) Log[1+(((σH)^2)/((μH)^2))]+2 σH (((μH)^2)+2 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))] (2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])-((σH)^3) (((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)+(1/((σD)^6))64 (b0^2) nD nH ((μD)^2) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^6))64 (b1^2) nD nH (x^2) ((μD)^2) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)-(1/((σD)^2))16 nH ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^4))16 nH ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Log[1+(((σH)^2)/((μH)^2))])^4) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)))^2))/(1024 (-1+nU) (π^2) (((nD+(((E^(((x μD)/((σD)^2))-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(8 Log[1+(((σH)^2)/((μH)^2))])))) nH (x^(-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/((Sqrt[2 π]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))^8) ((Log[1+(((σH)^2)/((μH)^2))])^10))))],If[b0>0&&b1>0,Min[nD-1,nH-1,nU-1],Min[nD-1,nH-1]]],If[b0>0&&b1>0,2nD+2nH+nU-5,2nD+2nH-4]]
bpgg[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+(((E^(((x μD)/((σD)^2))-((x μH)/((σH)^2)))) nH (x^(-(((μD)^2)/((σD)^2))+(((μH)^2)/((σH)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) ((((((σH)^2)/(μH))))^(-(((μH)^2)/((σH)^2)))) Gamma[(((μD)^2)/((σD)^2))])/(nD Gamma[(((μH)^2)/((σH)^2))]))))
ubpgg[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,√(((E^(((2 x μD)/((σD)^2))-((2 x μH)/((σH)^2)))) (x^(-((2 ((μD)^2))/((σD)^2))+((2 ((μH)^2))/((σH)^2)))) ((((((σD)^2)/(μD))))^((2 ((μD)^2))/((σD)^2))) ((((((σH)^2)/(μH))))^(-((2 ((μH)^2))/((σH)^2)))) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((((2+nD) (2+nH) (((nD+nH))^3))/(((4+nD+nH))^2))+(1/((-1+nD) ((σD)^6)))2 (nD^2) (nH^2) ((μD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^4))nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((-1+nH) ((σH)^6)))2 (nD^2) (nH^2) ((μH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(1/((σH)^4))(nD^2) nH (nH (((b0+b1 x))^2)+((σH)^2)) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))/((((nD+(1/(Gamma[(((μH)^2)/((σH)^2))]))(E^(((x μD)/((σD)^2))-((x μH)/((σH)^2)))) nH (x^(-(((μD)^2)/((σD)^2))+(((μH)^2)/((σH)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) ((((((σH)^2)/(μH))))^(-(((μH)^2)/((σH)^2)))) Gamma[(((μD)^2)/((σD)^2))]))^4) ((Gamma[(((μH)^2)/((σH)^2))])^2))),1,√(((E^(((2 x μD)/((σD)^2))-((2 x μH)/((σH)^2)))) (x^(-((2 ((μD)^2))/((σD)^2))+((2 ((μH)^2))/((σH)^2)))) ((((((σD)^2)/(μD))))^((2 ((μD)^2))/((σD)^2))) ((((((σH)^2)/(μH))))^(-((2 ((μH)^2))/((σH)^2)))) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((((2+nD) (2+nH) (((nD+nH))^3))/(((4+nD+nH))^2))+(1/((-1+nD) ((σD)^6)))2 (nD^2) (nH^2) ((μD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^4))nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((-1+nH) ((σH)^6)))2 (nD^2) (nH^2) ((μH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(1/((σH)^4))(nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))/((((nD+(((E^(((x μD)/((σD)^2))-((x μH)/((σH)^2)))) nH (x^(-(((μD)^2)/((σD)^2))+(((μH)^2)/((σH)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) ((((((σH)^2)/(μH))))^(-(((μH)^2)/((σH)^2)))) Gamma[(((μD)^2)/((σD)^2))])/(Gamma[(((μH)^2)/((σH)^2))]))))^4) ((Gamma[(((μH)^2)/((σH)^2))])^2)))]
dfubpgg[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((((2+nD) (2+nH) (((nD+nH))^3))/(((4+nD+nH))^2))+(1/((-1+nD) ((σD)^6)))2 (nD^2) (nH^2) ((μD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^4))nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((-1+nH) ((σH)^6)))2 (nD^2) (nH^2) ((μH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(1/((σH)^4))(nD^2) nH (nH (((b0+b1 x))^2)+((σH)^2)) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2)/((1/(-2+nD+nH))((((((2+nD) (2+nH) (((nD+nH))^3))/(((4+nD+nH))^2))+(1/((-1+nD) ((σD)^4)))2 (nD^2) (nH^2) ((μD)^2) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^2))nD (nH^2) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((-1+nH) ((σH)^4)))2 (nD^2) (nH^2) ((μH)^2) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(1/((σH)^2))(nD^2) nH (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) ((((2 nD nH ((μD)^2) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2))/((-1+nD) ((σD)^4))-(1/((-1+nD) ((σD)^6)))2 nD nH ((μD)^2) (2 (-1+nD) (b0^2)+4 (-1+nD) b0 b1 x+2 (-1+nD) (b1^2) (x^2)+((σD)^2)) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^2))nH (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)-(1/((σD)^4))nH (nD (((b0+b1 x))^2)+((σD)^2)) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((-1+nH) ((σH)^4)))2 nD nH ((μH)^2) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)-(1/((-1+nH) ((σH)^6)))2 nD nH ((μH)^2) (2 (-1+nH) (b0^2)+4 (-1+nH) b0 b1 x+2 (-1+nH) (b1^2) (x^2)+((σH)^2)) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(1/((σH)^2))nD (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)-(1/((σH)^4))nD (nH (((b0+b1 x))^2)+((σH)^2)) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2)),1,-(((((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) (-1+nU) ((σD)^12) ((σH)^12) ((((((2+nD) (2+nH) (((nD+nH))^3))/(((4+nD+nH))^2))+(1/((-1+nD) ((σD)^6)))2 (nD^2) (nH^2) ((μD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((σD)^4))nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(1/((-1+nH) ((σH)^6)))2 (nD^2) (nH^2) ((μH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(1/((σH)^4))(nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2))/((1-nU) ((σD)^4) ((σH)^4) ((((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((σD)^4) ((σH)^4)+2 (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((σH)^4) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((σD)^2) ((σH)^4) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+2 (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^4) ((σH)^2) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)))^2)+(2-nD-nH) ((((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((σD)^6) ((σH)^6)-2 (nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)-2 (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^6) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^6) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)-((σD)^2) ((σH)^2) ((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((σD)^4) ((σH)^4)+2 (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((σH)^4) (((x-μD-μD Log[x]+μD Log[(((σD)^2)/(μD))]+μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+(-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((σD)^2) ((σH)^4) (((x-μD-2 μD Log[x]+2 μD Log[(((σD)^2)/(μD))]+2 μD PolyGamma[0,(((μD)^2)/((σD)^2))]))^2)+2 (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) (((x-μH-μH Log[x]+μH Log[(((σH)^2)/(μH))]+μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2)+(-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^4) ((σH)^2) (((x-μH-2 μH Log[x]+2 μH Log[(((σH)^2)/(μH))]+2 μH PolyGamma[0,(((μH)^2)/((σH)^2))]))^2))))^2)))],If[b0>0&&b1>0,Min[nD-1,nH-1,nU-1],Min[nD-1,nH-1]]],If[b0>0&&b1>0,2nD+2nH+nU-5,2nD+2nH-4]]
d[dD_,dH_]:=Switch[dD,
"normal",
Switch[dH,"normal",bpnn,"lognormal",bpnl,"gamma",bpng],
"lognormal",
Switch[dH,"normal",bpln,"lognormal",bpll,"gamma",bplg],
"gamma",
Switch[dH,"normal",bpgn,"lognormal",bpgl,"gamma",bpgg]];
c[dD_,dH_]:=Switch[dD,
"normal",
Switch[dH,"normal",ubpnn,"lognormal",ubpnl,"gamma",ubpng],
"lognormal",
Switch[dH,"normal",ubpln,"lognormal",ubpll,"gamma",ubplg],
"gamma",
Switch[dH,"normal",ubpgn,"lognormal",ubpgl,"gamma",ubpgg]];
df[dD_,dH_]:=Switch[dD,
"normal",
Switch[dH,"normal",dfubpnn,"lognormal",dfubpnl,"gamma",dfubpng],
"lognormal",
Switch[dH,"normal",dfubpln,"lognormal",dfubpll,"gamma",dfubplg],
"gamma",
Switch[dH,"normal",dfubpgn,"lognormal",dfubpgl,"gamma",dfubpgg]];
lb[pr_,μD_,μH_,σD_,σH_]:=Switch[pr,True,Floor[Max[μH-4Max[σD,σH],0]],False,Floor[Max[μH-2Max[σD,σH],0]]];
ub[pr_,μD_,μH_,σD_,σH_]:=Switch[pr,True,Ceiling[μD+4Max[σD,σH]],False,Ceiling[μD+2Max[σD,σH]]];
pro[pr_]:=Switch[pr,True,SetOptions[Plot,PlotRange->All],False,SetOptions[Plot,PlotRange->Automatic]];
bp[t_,nD_,nH_,μD_,μH_,σD_,σH_,dD_,dH_]:=Check[d[dD,dH]@@{t,nD,nH,μD,μH,σD,σH},Indeterminate];
bpu[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dD_,dH_]:=Check[Block[{fc,fc0},fc=c[dD,dH]@@{t,nD,nH,μD,μH,σD,σH,b0,b1,nl};fc0=c[dD,dH]@@{t,nD,nH,μD,μH,σD,σH,0,0,nl};
If[fc∈Reals&&fc>=0 &&fc0∈Reals&&fc0>=0 &&fc>=fc0,{fc,(Sqrt[(fc^2)-(fc0^2)]),fc0},{Indeterminate,Indeterminate,Indeterminate},{Indeterminate,Indeterminate,Indeterminate}]],{Indeterminate,Indeterminate,Indeterminate}];
bpru[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dD_,dH_]:=Check[Block[{fc,fc0,fd},fc=c[dD,dH]@@{t,nD,nH,μD,μH,σD,σH,b0,b1,nl};fc0=c[dD,dH]@@{t,nD,nH,μD,μH,σD,σH,0,0,nl};fd=d[dD,dH]@@{t,nD,nH,μD,μH,σD,σH};
If[fc∈Reals&&fc>=0 &&fc0∈Reals&&fc0>=0 &&fd∈Reals&&fd>0&&fc>=fc0,{fc/fd,(Sqrt[(fc^2)-(fc0^2)])/fd,fc0/fd},{Indeterminate,Indeterminate,Indeterminate},{Indeterminate,Indeterminate,Indeterminate}]],{Indeterminate,Indeterminate,Indeterminate}];
bpci[t_,p_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_,dD_,dH_]:=Check[Block[{fc,fd,fdf},fc=c[dD,dH]@@{t,nD,nH,μD,μH,σD,σH,b0,b1,nl};fd=d[dD,dH]@@{t,nD,nH,μD,μH,σD,σH};fdf=df[dD,dH]@@{t,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl};
If[fc∈Reals&&fc>=0&& fd∈Reals&&fd>=0 &&fd<=1&&fdf∈Reals,{Max[Min[StudentTCI[fd,fc,fdf,ConfidenceLevel->p][[1]],1],0],
fd,Max[Min[StudentTCI[fd,fc,fdf,ConfidenceLevel->p][[2]],1],0]},{Indeterminate,Indeterminate,Indeterminate},{Indeterminate,Indeterminate,Indeterminate}]],{Indeterminate,Indeterminate,Indeterminate}];
pbpu[nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dD_,dH_,pr_]:=Text@Labeled[Quiet[Plot[{bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[1]],bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[2]],bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[3]]},{t,lb[pr,μD,μH,σD,σH],ub[pr,μD,μH,σD,σH]},Exclusions->"Singularities",AxesOrigin->{lb[pr,μD,μH,σD,σH],0}, AxesLabel->{"x","u(P(D|T))"},PlotStyle->{ RGBColor[1,.47,0],{ColorData["HTML","SlateBlue"],Dashing[{Large,Small}]},{ColorData["HTML","Green"],Dashing[{Large,Small}]}},PlotLegends->Placed[{"combined","measurement","sampling"},Bottom],PlotHighlighting->"XSlice", ImageSize->450]],Column[{"u(P(D|T)) versus measurand value x"},Center],Top]
pbpru[nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dD_,dH_,pr_]:=Text@Labeled[Quiet[Plot[{bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[1]],bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[2]],bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[3]]},{t,lb[pr,μD,μH,σD,σH],ub[pr,μD,μH,σD,σH]},Exclusions->"Singularities",AxesOrigin->{lb[pr,μD,μH,σD,σH],0}, AxesLabel->{"x","u(P(D|T))/P(D|T)"},PlotStyle->{ RGBColor[1,.47,0],{ColorData["HTML","SlateBlue"],Dashing[{Large,Small}]},{ColorData["HTML","Green"],Dashing[{Large,Small}]}},PlotLegends->Placed[{"combined","measurement","sampling"},Bottom],PlotHighlighting->"XSlice", ImageSize->450]],Column[{"u(P(D|T))/P(D|T) versus measurand value x"},Center],Top]
pbpci[p_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_,dD_,dH_,pr_]:=Text@Labeled[Quiet[Plot[{bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dD,dH][[1]],bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dD,dH][[2]],bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dD,dH][[3]]},{t,lb[pr,μD,μH,σD,σH],ub[pr,μD,μH,σD,σH]},Exclusions->"Singularities",AxesLabel->{"x","P(D|T)"},PlotStyle->{ColorData["HTML","SlateBlue"], {RGBColor[1,.47,0],Thick},ColorData["HTML","Green"]},PlotLegends->Placed[{"lower bound","point estimation","upper bound"},Bottom],PlotHighlighting->"XSlice", ImageSize->450]], Column[{ToString[NumberForm[N[100 p],{4,2}]]<>"% confidence intervals of P(D|T) versus measurand value x curves"},Center],Top];
pbpub0[t_,nD_,nH_,μD_,μH_,σD_,σH_,b1_,nl_,dD_,dH_,pr_]:=Text@Labeled[Quiet[Plot[{bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[1]],bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[2]],bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[3]]},{b0,0,Switch[pr,True,0.5σH,False,0.15 σH]},Exclusions->"Singularities",AxesOrigin->{0,0}, AxesLabel->{"(Subscript[b, 0])","u(P(D|T))"},PlotStyle->{ RGBColor[1,.47,0],{ColorData["HTML","SlateBlue"],Dashing[{Large,Small}]},{ColorData["HTML","Green"],Dashing[{Large,Small}]}},PlotLegends->Placed[{"combined","measurement","sampling"},Bottom],PlotHighlighting->"XSlice", ImageSize->450]],Column[{"u(P(D|T)) versus  (Subscript[b, 0])"},Center],Top]
pbprub0[t_,nD_,nH_,μD_,μH_,σD_,σH_,b1_,nl_,dD_,dH_,pr_]:=Text@Labeled[Quiet[Plot[{bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[1]],bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[2]],bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[3]]},{b0,0,Switch[pr,True,0.5σH,False,0.15 σH]},Exclusions->"Singularities",AxesOrigin->{0,0}, AxesLabel->{"(Subscript[b, 0])","u(P(D|T))/P(D|T)"},PlotStyle->{ RGBColor[1,.47,0],{ColorData["HTML","SlateBlue"],Dashing[{Large,Small}]},{ColorData["HTML","Green"],Dashing[{Large,Small}]}},PlotLegends->Placed[{"combined","measurement","sampling"},Bottom],PlotHighlighting->"XSlice", ImageSize->450]],Column[{"u(P(D|T))/P(D|T) versus (Subscript[b, 0])"},Center],Top]
pbpcib0[t_,p_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b1_,nl_,dD_,dH_,pr_]:=Text@Labeled[Quiet[Plot[{bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dD,dH][[1]],bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dD,dH][[2]],bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dD,dH][[3]]},{b0,0,Switch[pr,True,0.5σH,False,0.15 σH]},Exclusions->"Singularities",AxesLabel->{"(Subscript[b, 0])","P(D|T)"},PlotStyle->{ColorData["HTML","SlateBlue"], {RGBColor[1,.47,0],Thick},ColorData["HTML","Green"]},PlotLegends->Placed[{"lower bound","point estimation","upper bound"},Bottom], PlotHighlighting->"XSlice",ImageSize->450]], Column[{ToString[NumberForm[N[100 p],{4,2}]]<>"% confidence intervals of P(D|T) versus (Subscript[b, 0]) curves"},Center],Top]
pbpub1[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,nl_,dD_,dH_,pr_]:=Text@Labeled[Quiet[Plot[{bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[1]],bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[2]],bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[3]]},{b1,0,Switch[pr,True,0.1,False,0.05 ]},Exclusions->"Singularities",AxesOrigin->{0,0}, AxesLabel->{"(Subscript[b, 1])","u(P(D|T))"},PlotStyle->{ RGBColor[1,.47,0],{ColorData["HTML","SlateBlue"],Dashing[{Large,Small}]},{ColorData["HTML","Green"],Dashing[{Large,Small}]}},PlotLegends->Placed[{"combined","measurement","sampling"},Bottom],PlotHighlighting->"XSlice", ImageSize->450]],Column[{"u(P(D|T)) versus (Subscript[b, 1])"},Center],Top]
pbprub1[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,nl_,dD_,dH_,pr_]:=Text@Labeled[Quiet[Plot[{bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[1]],bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[2]],bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dD,dH][[3]]},{b1,0,Switch[pr,True,0.1,False,0.05 ]},Exclusions->"Singularities",AxesOrigin->{0,0}, AxesLabel->{"(Subscript[b, 1])","u(P(D|T))/P(D|T)"},PlotStyle->{ RGBColor[1,.47,0],{ColorData["HTML","SlateBlue"],Dashing[{Large,Small}]},{ColorData["HTML","Green"],Dashing[{Large,Small}]}},PlotLegends->Placed[{"combined","measurement","sampling"},Bottom],PlotHighlighting->"XSlice", ImageSize->450]],Column[{"u(P(D|T))/P(D|T) versus (Subscript[b, 1])"},Center],Top]
pbpcib1[t_,p_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,nl_,dD_,dH_,pr_]:=Text@Labeled[Quiet[Plot[{bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dD,dH][[1]],bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dD,dH][[2]],bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dD,dH][[3]]},{b1,0,Switch[pr,True,0.1,False,0.05 ]},Exclusions->"Singularities",AxesLabel->{"(Subscript[b, 1])","P(D|T)"},PlotStyle->{ColorData["HTML","SlateBlue"], {RGBColor[1,.47,0],Thick},ColorData["HTML","Green"]},PlotLegends->Placed[{"lower bound","point estimation","upper bound"},Bottom], PlotHighlighting->"XSlice",ImageSize->450]], Column[{ToString[NumberForm[N[100 p],{4,2}]]<>"% confidence intervals of P(D|T) versus (Subscript[b, 1]) curves"},Center],Top]
pbpun[t_,r_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dD_,dH_,pr_]:=Text@Labeled[Quiet[Plot[{bpu[t,n r, n(1-r),μD,μH,σD,σH,b0,b1,nl,dD,dH][[1]],bpu[t,n r, n(1-r),μD,μH,σD,σH,b0,b1,nl,dD,dH][[2]],bpu[t,n r, n(1-r),μD,μH,σD,σH,b0,b1,nl,dD,dH][[3]]},{n,Max[Ceiling[2/r],Ceiling[2/(1-r)],20],Switch[pr,True,Max[5 Ceiling[2/r],5 Ceiling[2/(1-r)],10000],False,Max[5Ceiling[2/r],5Ceiling[2/(1-r)],5000]]},Exclusions->"Singularities",AxesOrigin->{Max[Ceiling[2/r],Ceiling[2/(1-r)],20],0}, AxesLabel->{"n","u(P(D|T))"},PlotStyle->{ RGBColor[1,.47,0],{ColorData["HTML","SlateBlue"],Dashing[{Large,Small}]},{ColorData["HTML","Green"],Dashing[{Large,Small}]}},PlotLegends->Placed[{"combined","measurement","sampling"},Bottom],PlotHighlighting->"XSlice", ImageSize->450]],Column[{"u(P(D|T)) versus total population sample size n"},Center],Top]
pbprun[t_,r_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dD_,dH_,pr_]:=Text@Labeled[Quiet[Plot[{bpru[t,n r, n(1-r),μD,μH,σD,σH,b0,b1,nl,dD,dH][[1]],bpru[t,n r, n(1-r),μD,μH,σD,σH,b0,b1,nl,dD,dH][[2]],bpru[t,n r, n(1-r),μD,μH,σD,σH,b0,b1,nl,dD,dH][[3]]},{n,Max[Ceiling[2/r],Ceiling[2/(1-r)],20],Switch[pr,True,Max[10 Ceiling[2/r],10 Ceiling[2/(1-r)],10000],False,Max[5Ceiling[2/r],5Ceiling[2/(1-r)],5000]]},Exclusions->"Singularities",AxesOrigin->{Max[Ceiling[2/r],Ceiling[2/(1-r)],20],0}, AxesLabel->{"n","u(P(D|T))/P(D|T)"},PlotStyle->{ RGBColor[1,.47,0],{ColorData["HTML","SlateBlue"],Dashing[{Large,Small}]},{ColorData["HTML","Green"],Dashing[{Large,Small}]}},PlotLegends->Placed[{"combined","measurement","sampling"},Bottom],PlotHighlighting->"XSlice", ImageSize->450]],Column[{"u(P(D|T)/P(D|T) versus total population sample size n"},Center],Top]
pbpcin[t_,p_,r_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_,dD_,dH_,pr_]:=Text@Labeled[Plot[{bpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,dD,dH][[1]],bpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,dD,dH][[2]],bpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,dD,dH][[3]]},{n,Max[Ceiling[2/r],Ceiling[2/(1-r)],20],Switch[pr,True,Max[10 Ceiling[2/r],10 Ceiling[2/(1-r)],10000],False,Max[5Ceiling[2/r],5Ceiling[2/(1-r)],5000]]},Exclusions->"Singularities",AxesLabel->{"n","P(D|T)"},PlotStyle->{ColorData["HTML","SlateBlue"], {RGBColor[1,.47,0],Thick},ColorData["HTML","Green"]},PlotLegends->Placed[{"lower bound","point estimation","upper bound"},Bottom],PlotHighlighting->"XSlice", ImageSize->450], Column[{ToString[NumberForm[N[100 p],{4,2}]]<>"% confidence intervals of P(D|T) versus total population sample size n"},Center],Top]
tbpu[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=
Text@Grid[Quiet[Transpose[
{{Style["standard uncertainty of posterior probability for disease",Bold],"measurand distribution","diseased","normal",SpanFromAbove,SpanFromAbove,"lognormal",SpanFromAbove,SpanFromAbove,"gamma",SpanFromAbove,SpanFromAbove},
{SpanFromLeft,SpanFromLeft,"nondiseased","nornal","lognormal","gamma","nornal","lognormal","gamma","nornal","lognormal","gamma"},
{SpanFromLeft,"probability",
SpanFromAbove,
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"normal","normal"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"normal","lognormal"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"normal","gamma"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"lognormal","normal"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"lognormal","lognormal"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"lognormal","gamma"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"gamma","normal"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"gamma","lognormal"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"gamma","gamma"],{10,6}]},
{SpanFromLeft,"standard uncertainty",
"combined",
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","normal"][[1]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","lognormal"][[1]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","gamma"][[1]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","normal"][[1]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","lognormal"][[1]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","gamma"][[1]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","normal"][[1]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","lognormal"][[1]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","gamma"][[1]],{10,6}]},
{SpanFromLeft,SpanFromLeft,
"measurement",
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","normal"][[2]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","lognormal"][[2]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","gamma"][[2]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","normal"][[2]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","lognormal"][[2]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","gamma"][[2]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","normal"][[2]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","lognormal"][[2]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","gamma"][[2]],{10,6}]},
{SpanFromLeft,SpanFromLeft,
"sampling",
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","normal"][[3]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","lognormal"][[3]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","gamma"][[3]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","normal"][[3]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","lognormal"][[3]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","gamma"][[3]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","normal"][[3]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","lognormal"][[3]],{10,6}],
NumberForm[N@bpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","gamma"][[3]],{10,6}]}}]],
Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->Automatic]
tbpru[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=
Text@Grid[Quiet[Transpose[
{{Style["relative standard uncertainty of posterior probability for disease",Bold],"measurand distribution","diseased","normal",SpanFromAbove,SpanFromAbove,"lognormal",SpanFromAbove,SpanFromAbove,"gamma",SpanFromAbove,SpanFromAbove},
{SpanFromLeft,SpanFromLeft,"nondiseased","nornal","lognormal","gamma","nornal","lognormal","gamma","nornal","lognormal","gamma"},
{SpanFromLeft,"probability",
SpanFromAbove,
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"normal","normal"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"normal","lognormal"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"normal","gamma"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"lognormal","normal"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"lognormal","lognormal"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"lognormal","gamma"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"gamma","normal"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"gamma","lognormal"],{10,6}],
NumberForm[N@bp[t,nD,nH,μD,μH,σD,σH,"gamma","gamma"],{10,6}]},
{SpanFromLeft,"relative standard uncertainty",
"combined",
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","normal"][[1]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","lognormal"][[1]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","gamma"][[1]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","normal"][[1]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","lognormal"][[1]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","gamma"][[1]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","normal"][[1]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","lognormal"][[1]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","gamma"][[1]],{10,6}]},
{SpanFromLeft,SpanFromLeft,
"measurement",
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","normal"][[2]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","lognormal"][[2]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","gamma"][[2]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","normal"][[2]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","lognormal"][[2]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","gamma"][[2]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","normal"][[2]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","lognormal"][[2]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,nl,"gamma","gamma"][[2]],{10,6}]},
{SpanFromLeft,SpanFromLeft,
"sampling",
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","normal"][[3]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","lognormal"][[3]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"normal","gamma"][[3]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","normal"][[3]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","lognormal"][[3]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"lognormal","gamma"][[3]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","normal"][[3]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","lognormal"][[3]],{10,6}],
NumberForm[N@bpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"gamma","gamma"][[3]],{10,6}]}}]],
Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->Automatic]
tbpci[t_,p_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=
Text@Grid[Quiet[Transpose[
{{Style[Style[StringJoin["posterior probability for disease: ",ToString[NumberForm[N[100 p],{4,2}]], "% confidence intervals"]],Bold],Style["diseased",Bold],"normal",SpanFromAbove,SpanFromAbove,"lognormal",SpanFromAbove,SpanFromAbove,"gamma",SpanFromAbove,SpanFromAbove},
{SpanFromLeft,"nondiseased","nornal","lognormal","gamma","nornal","lognormal","gamma","nornal","lognormal","gamma"},
{SpanFromLeft,
"point estimation",
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"normal","normal"][[2]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"normal","lognormal"][[2]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"normal","gamma"][[2]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"lognormal","normal"][[2]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"lognormal","lognormal"][[2]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"lognormal","gamma"][[2]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"gamma","normal"][[2]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"gamma","lognormal"][[2]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"gamma","gamma"][[2]],{10,6}]},
{SpanFromLeft,
"lower bound",
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"normal","normal"][[1]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"normal","lognormal"][[1]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"normal","gamma"][[1]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"lognormal","normal"][[1]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"lognormal","lognormal"][[1]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"lognormal","gamma"][[1]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"gamma","normal"][[1]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"gamma","lognormal"][[1]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"gamma","gamma"][[1]],{10,6}]},
{SpanFromLeft,
"upper bound",
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"normal","normal"][[3]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"normal","lognormal"][[3]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"normal","gamma"][[3]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"lognormal","normal"][[3]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"lognormal","lognormal"][[3]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"lognormal","gamma"][[3]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"gamma","normal"][[3]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"gamma","lognormal"][[3]],{10,6}],
NumberForm[N@bpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"gamma","gamma"][[3]],{10,6}]}}]],
Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->Automatic]

Quiet[TabView[{"plots"->
TabView[{"plots vs measurand value"->
TabView[{
"P(D|T) uncertainty plots"->
Manipulate[pro[pr];
pbpu[nD,nH,mD,mH,sD,sH,b0,b1,nl,dD,dH,pr],
Style["standard uncertainty plot",Bold],
{{pr,True,"plot range"},{True->"full",False->"partial"},ControlPlacement->Left},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nD,154,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dD,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nH,822,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dH,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b0,0.866,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0109,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top],
"P(D|T) relative uncertainty plots"->
Manipulate[pro[pr];
pbpru[nD,nH,mD,mH,sD,sH,b0,b1,nl,dD,dH,pr],
Style["relative standard uncertainty plot",Bold],
{{pr,True,"plot range"},{True->"full",False->"partial"},ControlPlacement->Left},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nD,154,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dD,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nH,822,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dH,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b0,0.866,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0109,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top],
"P(D|T) CI plots"->
Manipulate[pro[pr];
pbpci[p,nD,nH,mD,mH,sD,sH,nU,b0,b1,nl,dD,dH,pr],
Style["P(D|T) CI plot",Bold],
{{pr,True,"plot range"},{True->"full",False->"partial"},ControlPlacement->Left},
Delimiter,
Style["confidence level",Bold],
{{p,0.95,"p"},0.900,0.999,0.001,Appearance->"Labeled",ImageSize->Tiny},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nD,154,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dD,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nH,822,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dH,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b0,0.866,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0109,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
{{nU,1350,"sample size"},20,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top]}],
"plots vs (Subscript[b, 0])"->
TabView[{
"P(D|T) uncertainty plots"->
Manipulate[pro[pr];
pbpub0[t,nD,nH,mD,mH,sD,sH,b1,nl,dD,dH,pr],
Style["standard uncertainty plot",Bold],
{{pr,False,"plot range"},{True->"full",False->"partial"},ControlPlacement->Left},
Delimiter,
Style["measurand value",Bold],
{{t,126,"x"},Max[mH-5sH,0],mD+5sH,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nD,154,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dD,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nH,822,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dH,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b1,0.0109,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top],
"P(D|T) relative uncertainty plots"->
Manipulate[pro[pr];
pbprub0[t,nD,nH,mD,mH,sD,sH,b1,nl,dD,dH,pr],
Style["relative standard uncertainty plot",Bold],
{{pr,False,"plot range"},{True->"full",False->"partial"},ControlPlacement->Left},
Delimiter,
Style["measurand value",Bold],
{{t,126,"x"},Max[mH-5sH,0],mD+5sH,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nD,154,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dD,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nH,822,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dH,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b1,0.0109,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top],
"P(D|T) CI plots"->
Manipulate[pro[pr];
pbpcib0[t,p,nD,nH,mD,mH,sD,sH,nU,b1,nl,dD,dH,pr],
Style["confidence intervals plot",Bold],
{{pr,False,"plot range"},{True->"full",False->"partial"},ControlPlacement->Left},
Delimiter,
Style["confidence level",Bold],
{{p,0.95,"p"},0.900,0.999,0.001,Appearance->"Labeled",ImageSize->Tiny},
Delimiter,
Style["measurand value",Bold],
{{t,126,"x"},Max[mH-5sH,0],mD+5sH,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nD,154,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dD,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nH,822,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dH,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b1,0.0109,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Style["measurements sample",Bold],
{{nU,1350,"sample size"},20,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top]}],
"plots vs (Subscript[b, 1])"->
TabView[{
"P(D|T) uncertainty plots"->
Manipulate[pro[pr];
pbpub1[t,nD,nH,mD,mH,sD,sH,b0,nl,dD,dH,pr],
Style["standard uncertainty plot",Bold],
{{pr,False,"plot range"},{True->"full",False->"partial"},ControlPlacement->Left},
Delimiter,
Style["measurand value",Bold],
{{t,126,"x"},Max[mH-5sH,0],mD+5sH,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nD,154,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dD,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nH,822,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dH,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b0,0.866,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top],
"P(D|T) relative uncertainty plots"->
Manipulate[pro[pr];
pbprub1[t,nD,nH,mD,mH,sD,sH,b0,nl,dD,dH,pr],
Style["relative standard uncertainty plot",Bold],
{{pr,False,"plot range"},{True->"full",False->"partial"},ControlPlacement->Left},
Delimiter,
Style["measurand value",Bold],
{{t,126,"x"},Max[mH-5sH,0],mD+5sH,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nD,154,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dD,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nH,822,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dH,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b0,0.866,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top],
"P(D|T) CI plots"->
Manipulate[pro[pr];
pbpcib1[t,p,nD,nH,mD,mH,sD,sH,nU,b0,nl,dD,dH,pr],
Style["confidence intervals plot",Bold],
{{pr,False,"plot range"},{True->"full",False->"partial"},ControlPlacement->Left},
Delimiter,
Style["confidence level",Bold],
{{p,0.95,"p"},0.900,0.999,0.001,Appearance->"Labeled",ImageSize->Tiny},
Delimiter,
Style["measurand value",Bold],
{{t,126,"x"},Max[mH-5sH,0],mD+5sH,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nD,154,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dD,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nH,822,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
{{dH,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b0,0.866,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
Style["measurements sample",Bold],
{{nU,1350,"sample size"},20,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top]}],
"plots vs population sample size"->
TabView[{
"P(D|T) uncertainty plots"->
Manipulate[pro[pr];
pbpun[t,r,mD,mH,sD,sH,b0,b1,nl,dD,dH,pr],
Style["standard uncertainty plot",Bold],
{{pr,False,"plot range"},{True->"full",False->"partial"},ControlPlacement->Left},
Delimiter,
Style["measurand value",Bold],
{{t,126,"x"},Max[mH-5sH,0],mD+5sH,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["prior probability of disease condition",Bold],
{{r,0.158,"v"},0.001,0.999,.001,ImageSize->Tiny,
Appearance->"Labeled"},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{dD,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{dH,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b0,0.866,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0109,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top],
"P(D|T) relative uncertainty plots"->
Manipulate[pro[pr];
pbprun[t,r,mD,mH,sD,sH,b0,b1,nl,dD,dH,pr],
Style["relative standard uncertainty plot",Bold],
{{pr,False,"plot range"},{True->"full",False->"partial"},ControlPlacement->Left},
Delimiter,
Style["measurand value",Bold],
{{t,126,"x"},Max[mH-5sH,0],mD+5sH,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["prior probability of disease condition",Bold],
{{r,0.158,"v"},0.001,0.999,.001,ImageSize->Tiny,
Appearance->"Labeled"},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{dD,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{dH,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b0,0.866,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0109,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top],
"P(D|T) CI plots"->
Manipulate[pro[pr];
pbpcin[t,p,r,mD,mH,sD,sH,nU,b0,b1,nl,dD,dH, pr],
Style["confidence interval plot",Bold],
{{pr,False,"plot range"},{True->"full",False->"partial"},ControlPlacement->Left},
Delimiter,
Style["confidence level",Bold],
{{p,0.95,"p"},0.900,0.999,0.001,Appearance->"Labeled",ImageSize->Tiny},
Delimiter,
Style["measurand value",Bold],
{{t,126,"x"},Max[mH-5sH,0],mD+5sH,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["prevalence rate of disease condition",Bold],
{{r,0.158,"v"},0.001,0.999,.001,ImageSize->Tiny,
Appearance->"Labeled"},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{dD,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{dH,"lognormal","measurand distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b0,0.866,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0109,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Style["measurements sample",Bold],
{{nU,1350,"sample size"},20,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top]}]}],
"tables"->
TabView[{"P(D|T) uncertainty table"->
Manipulate[
tbpu[t,nD,nH,mD,mH,sD,sH,b0,b1,nl],
"",
Delimiter,
Style["measurand value",Bold],
{{t,126,"x"},Max[mH-5sH,0],mD+5sH,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nD,154,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nH,822,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b0,0.866,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0109,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top],
"P(D|T) relative uncertainty table"->
Manipulate[
tbpru[t,nD,nH,mD,mH,sD,sH,b0,b1,nl],
"",
Delimiter,
Style["measurand value",Bold],
{{t,126,"x"},Max[mH-5sH,0],mD+5sH,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nD,154,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nH,822,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b0,0.866,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0109,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top],
"P(D|T) CI table"->
Manipulate[
tbpci[t,p,nD,nH,mD,mH,sD,sH,nU,b0,b1,nl],
"",
Style["confidence level",Bold],
{{p,0.95,"p"},0.900,0.999,0.001,Appearance->"Labeled",ImageSize->Tiny},
Delimiter,
Style["measurand value",Bold],
{{t,126,"x"},Max[mH-5sH,0],mD+5sH,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["diseased population sample",Bold],
{{mD,120.7,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sD,17.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nD,154,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["nondiseased population sample",Bold],
{{mH,102.6,"mean"},0.1,10000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{sH,10.7,"standard deviation"},0.01,1000,.01,ImageSize->Tiny,Appearance->"Labeled"},
{{nH,822,"sample size"},2,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m]) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])x",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (x^2)])"},ImageSize->Tiny},
{{b0,0.866,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0109,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Style["measurements sample",Bold],
{{nU,1350,"sample size"},20,10000,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Top]}]},
ImageSize->Automatic]]

Notation
P(D|T): posterior probability for disease
u(P(D|T)): standard uncertainty of posterior probability for disease
u(P(D|T))/P(D|T): relative standard uncertainty of posterior probability for disease
CI: Confidence Interval
(Subscript[b, 0]):  constant contribution to measurement uncertainty
(Subscript[b, 1]):  measurement uncertainty proportionality constant
r : prior probability for disease
n : total population sample size

Disclaimer of Warranties
The notebook is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or Hellenic Complex Systems Laboratory or any of its members be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the notebook or the use or other dealings in the notebook.

About
Bayesian Diagnostic Uncertainty
Version Number 1.0.1.3
Hellenic Complex Systems Laboratory 2024
This notebook is distributed under  an Attribution - NonCommercial - ShareAlike 4.0 International Creative Commons License.