Bayesian Diagnostic Insights

A Software Tool for Applying Bayes’ Theorem in Medical Diagnostics

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["`*"];
Needs["HypothesisTesting`"];
logNormalDistribution[μ_,σ_]:=LogNormalDistribution[(1/2) (2 Log[μ]-Log[(((μ^2)+(σ^2))/(μ^2))]),(Sqrt[Log[(((μ^2)+(σ^2))/(μ^2))]])]
gammaDistribution[μ_,σ_]:=GammaDistribution[(μ^2)/(σ^2),(σ^2)/μ]

bpdnn[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1-(((E^((1/2) (((((x-μD))^2)/((σD)^2))-((((x-μH))^2)/((σH)^2))))) (-1+r) σD)/(r σH))))
bpdnn[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))))
ubpdnn[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))))]
dfubpdnn[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]]
bpdnl[x_,r_,μ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))])))) (-1+r) σD)/(r x (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))
bpdnl[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))]])))))
ubpdnl[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))))]
dfubpdnl[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]]
bpdng[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1-(((E^(((((x-μD))^2)/(2 ((σD)^2)))-((x μH)/((σH)^2)))) (Sqrt[2 π]) (-1+r) (x^(-1+(((μH)^2)/((σH)^2)))) σD ((((((σH)^2)/(μH))))^(-(((μH)^2)/((σH)^2)))))/(r Gamma[(((μH)^2)/((σH)^2))]))))
bpdng[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))))
ubpdng[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)))]
dfubpdng[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]]
bpdln[x_,r_,μ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))]))))) (-1+r) x (Sqrt[Log[1+(((σD)^2)/((μD)^2))]]))/(r σH))))
bpdln[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))))
ubpdln[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/4) (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)))) (((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σD)^2)/((μD)^2))])^4))/(((4+nD+nH))^2))+(1/((-1+nD) (((((μD)^2)+((σD)^2)))^2)))(nD^2) (nH^2) ((σD)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^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)+(1/(((μD)^2) (((((μD)^2)+((σD)^2)))^2)))2 nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^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)+(1/((-1+nH) ((σH)^6)))64 (nD^2) (nH^2) ((μH)^2) (2 (b0^2) (-1+nH)+4 b0 b1 (-1+nH) x+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)+(1/((σH)^4))32 (nD^2) nH ((b0^2) nH+2 b0 b1 nH x+(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)))/(((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD+(((E^(-((x μH)/((σH)^2))+((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(8 Log[1+(((σD)^2)/((μD)^2))])))) nH (Sqrt[2 π]) (x^(((μH)^2)/((σH)^2))) ((((((σH)^2)/(μH))))^(-(((μH)^2)/((σH)^2)))) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]]))/(Gamma[(((μH)^2)/((σH)^2))]))))^4) ((Log[1+(((σD)^2)/((μD)^2))])^3))),1,(1/(4 (Sqrt[2])))(√(((E^(-((((x-μH))^2)/((σH)^2))+((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (x^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)+16 (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (-2 (b0^2) (-1+nH)-2 (b1^2) (-1+nH) (x^2)-((σH)^2)) ((((((x-μH))^2)-((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4)+32 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((x-μH))^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)+(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)))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^8) (((nD+(((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))]]))/(σH))))^4) ((Log[1+(((σD)^2)/((μD)^2))])^3))))]
dfubpdln[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((-2+nD+nH) (-1+nU) (((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)+16 (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((((((x-μH))^2)-((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4)+32 (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((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)+4 b0 b1 (-1+nD) x+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) (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-nU) (((32 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^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)-16 (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((((((x-μH))^2)-((σH)^2)))^2) ((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)))^2))-(nD^2) (2-nD-nH) (nH^2) (((4+nD+nH))^4) (((-32 (-1+nD) nD (-1+nH) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4)+16 (1-nD) nD nH ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((((((x-μH))^2)-((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4)+16 (1-nD) nD nH ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((((((x-μH))^2)-((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4)+32 (1-nD) nD (1-nH) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Log[1+(((σD)^2)/((μD)^2))])^4)-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)+4 b0 b1 (-1+nD) x+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 (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)))^2)),1,((-2+nD+nH) (-1+nU) (((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)+16 (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (-2 (b0^2) (-1+nH)-2 (b1^2) (-1+nH) (x^2)-((σH)^2)) ((((((x-μH))^2)-((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4)+32 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((x-μH))^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)+(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)))^2))/(-((1-nU) (((32 (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^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)-16 (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((((((x-μH))^2)-((σH)^2)))^2) ((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)))^2))-(nD^2) (2-nD-nH) (nH^2) (((4+nD+nH))^4) (((-32 (-1+nD) nD (-1+nH) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Log[1+(((σD)^2)/((μD)^2))])^4)+16 (1-nD) nD nH ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((((((x-μH))^2)-((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4)+16 (1-nD) nD nH ((μD)^2) (((((μD)^2)+((σD)^2)))^2) (-2 (b0^2) (-1+nH)-2 (b1^2) (-1+nH) (x^2)-((σH)^2)) ((((((x-μH))^2)-((σH)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^4)+32 (-1+nD) nD (-1+nH) ((μD)^2) (((x-μH))^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)-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)))^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]]
bpdll[x_,r_,μD_,μH_,σD_,σH_]:=1/(1-(1/(r (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))]))))) (-1+r) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]]))
bpdll[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))]])))))
ubpdll[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))))]
dfubpdll[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]]
bpdlg[x_,r_,μD_,μH_,σD_,σH_]:=1/(1-(1/(r Gamma[(((μH)^2)/((σH)^2))]))(E^(-((x μH)/((σH)^2))+((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(8 Log[1+(((σD)^2)/((μD)^2))])))) (Sqrt[2 π]) (-1+r) (x^(((μH)^2)/((σH)^2))) ((((((σH)^2)/(μH))))^(-(((μH)^2)/((σH)^2)))) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]]))
bpdlg[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+(((E^(-((x μH)/((σH)^2))+((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(8 Log[1+(((σD)^2)/((μD)^2))])))) nH (Sqrt[2 π]) (x^(((μH)^2)/((σH)^2))) ((((((σH)^2)/(μH))))^(-(((μH)^2)/((σH)^2)))) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]]))/(nD Gamma[(((μH)^2)/((σH)^2))]))))
ubpdlg[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/4) (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)))) (((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σD)^2)/((μD)^2))])^4))/(((4+nD+nH))^2))+(1/((-1+nD) (((((μD)^2)+((σD)^2)))^2)))(nD^2) (nH^2) ((σD)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^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)+(1/(((μD)^2) (((((μD)^2)+((σD)^2)))^2)))2 nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^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)+(1/((-1+nH) ((σH)^6)))64 (nD^2) (nH^2) ((μH)^2) (2 (b0^2) (-1+nH)+4 b0 b1 (-1+nH) x+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)+(1/((σH)^4))32 (nD^2) nH ((b0^2) nH+2 b0 b1 nH x+(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)))/(((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD+(((E^(-((x μH)/((σH)^2))+((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(8 Log[1+(((σD)^2)/((μD)^2))])))) nH (Sqrt[2 π]) (x^(((μH)^2)/((σH)^2))) ((((((σH)^2)/(μH))))^(-(((μH)^2)/((σH)^2)))) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]]))/(Gamma[(((μH)^2)/((σH)^2))]))))^4) ((Log[1+(((σD)^2)/((μD)^2))])^3))),1,(1/4) (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)))) (((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σD)^2)/((μD)^2))])^4))/(((4+nD+nH))^2))+((nD^2) (nH^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^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))/((-1+nD) (((((μD)^2)+((σD)^2)))^2))+(1/(((μD)^2) (((((μD)^2)+((σD)^2)))^2)))2 nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^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)+(1/((-1+nH) ((σH)^6)))64 (nD^2) (nH^2) ((μH)^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)+(1/((σH)^4))32 (nD^2) nH ((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)))/(((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD+(((E^(-((x μH)/((σH)^2))+((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(8 Log[1+(((σD)^2)/((μD)^2))])))) nH (Sqrt[2 π]) (x^(((μH)^2)/((σH)^2))) ((((((σH)^2)/(μH))))^(-(((μH)^2)/((σH)^2)))) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]]))/(Gamma[(((μH)^2)/((σH)^2))]))))^4) ((Log[1+(((σD)^2)/((μD)^2))])^3)))]
dfubpdlg[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,(((((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σD)^2)/((μD)^2))])^4))/(((4+nD+nH))^2))+(1/((-1+nD) (((((μD)^2)+((σD)^2)))^2)))(nD^2) (nH^2) ((σD)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^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)+(1/(((μD)^2) (((((μD)^2)+((σD)^2)))^2)))2 nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^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)+(1/((-1+nH) ((σH)^6)))64 (nD^2) (nH^2) ((μH)^2) (2 (b0^2) (-1+nH)+4 b0 b1 (-1+nH) x+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)+(1/((σH)^4))32 (nD^2) nH ((b0^2) nH+2 b0 b1 nH x+(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)/((1/(-2+nD+nH))(((((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σD)^2)/((μD)^2))])^4))/(((4+nD+nH))^2))+((nD^2) (nH^2) ((σD)^4) (((-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))/((-1+nD) (((((μD)^2)+((σD)^2)))^2))+(1/(((μD)^2) (((((μD)^2)+((σD)^2)))^2)))2 nD (nH^2) ((σD)^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)+(1/((-1+nH) ((σH)^4)))64 (nD^2) (nH^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)+(1/((σH)^2))32 (nD^2) nH ((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 nH ((σD)^4) (((-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))/((-1+nD) (((((μD)^2)+((σD)^2)))^2))-(nD nH ((σD)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^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))/((-1+nD) (((((μD)^2)+((σD)^2)))^2))-(1/(((μD)^2) (((((μD)^2)+((σD)^2)))^2)))2 nH (nD (((b0+b1 x))^2)+((σD)^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)+(1/(((μD)^2) (((((μD)^2)+((σD)^2)))^2)))2 nH (((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)+(1/((-1+nH) ((σH)^4)))64 nD nH ((μ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)-(1/((-1+nH) ((σH)^6)))64 nD nH ((μH)^2) (2 (b0^2) (-1+nH)+4 b0 b1 (-1+nH) x+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)+(1/((σH)^2))32 nD ((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/((σH)^4))32 nD ((b0^2) nH+2 b0 b1 nH x+(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)),1,(((((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σD)^2)/((μD)^2))])^4))/(((4+nD+nH))^2))+(1/((-1+nD) (((((μD)^2)+((σD)^2)))^2)))(nD^2) (nH^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^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)+(1/(((μD)^2) (((((μD)^2)+((σD)^2)))^2)))2 nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^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)+(1/((-1+nH) ((σH)^6)))64 (nD^2) (nH^2) ((μH)^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)+(1/((σH)^4))32 (nD^2) nH ((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)/((1/(-2+nD+nH))(((((32 (2+nD) (2+nH) (((nD+nH))^3) ((Log[1+(((σD)^2)/((μD)^2))])^4))/(((4+nD+nH))^2))+((nD^2) (nH^2) ((σD)^4) (((-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))/((-1+nD) (((((μD)^2)+((σD)^2)))^2))+(1/(((μD)^2) (((((μD)^2)+((σD)^2)))^2)))2 nD (nH^2) ((σD)^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)+(1/((-1+nH) ((σH)^4)))64 (nD^2) (nH^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)+(1/((σH)^2))32 (nD^2) nH ((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))4 (nD^2) (nH^2) ((((1/(((((μD)^2)+((σD)^2)))^2))(b0^2) nD nH ((σD)^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)+(1/(((((μD)^2)+((σD)^2)))^2))(b1^2) nD nH (x^2) ((σD)^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)+(1/(((μD)^2) (((((μD)^2)+((σD)^2)))^2)))nH ((b0^2) nD+(b1^2) nD (x^2)+((σD)^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)-(1/(((μD)^2) (((((μD)^2)+((σD)^2)))^2)))nH (((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)+(1/((σH)^6))64 (b0^2) nD nH ((μ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)+(1/((σH)^6))64 (b1^2) nD 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)-(1/((σH)^2))16 nD ((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/((σH)^4))16 nD ((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]]
bpdgn[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1-(((E^(((x μD)/((σD)^2))-((((x-μH))^2)/(2 ((σH)^2))))) (-1+r) (x^(1-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/((Sqrt[2 π]) r σH))))
bpdgn[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))))
ubpdgn[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))))]
dfubpdgn[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]]
bpdgl[x_,r_,μ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))])))) (-1+r) (x^(-(((μD)^2)/((σD)^2)))) ((((((σD)^2)/(μD))))^(((μD)^2)/((σD)^2))) Gamma[(((μD)^2)/((σD)^2))])/((Sqrt[2 π]) r (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))))
bpdgl[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))]])))))
ubpdgl[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))))]
dfubpdgl[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]]
bpdgg[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1-(((E^(((x μD)/((σD)^2))-((x μH)/((σH)^2)))) (-1+r) (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))])/(r Gamma[(((μH)^2)/((σH)^2))]))))
bpdgg[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))]))))
ubpdgg[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)))]
dfubpdgg[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]]
bpnnn[x_,r_,μD_,μH_,σD_,σH_]:=1-bpdnn[x,r,μD,μH,σD,σH]
bpnnn[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=1-bpdnn[x,nD,nH,μD,μH,σD,σH]
ubpnnn[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=ubpdnn[x,nD,nH,μD,μH,σD,σH,b0,b1,nl]
dfubpnnn[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=dfubpdnn[x,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl]
bpnnl[x_,r_,μD_,μH_,σD_,σH_]:=1-bpdnl[x,r,μD,μH,σD,σH]
bpnnl[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=1-bpdnl[x,nD,nH,μD,μH,σD,σH]
ubpnnl[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=ubpdnl[x,nD,nH,μD,μH,σD,σH,b0,b1,nl]
dfubpnnl[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=dfubpdnl[x,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl]
bpnng[x_,r_,μD_,μH_,σD_,σH_]:=1-bpdng[x,r,μD,μH,σD,σH]
bpnng[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=1-bpdng[x,nD,nH,μD,μH,σD,σH]
ubpnng[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=ubpdng[x,nD,nH,μD,μH,σD,σH,b0,b1,nl]
dfubpnng[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=dfubpdng[x,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl]
bpnln[x_,r_,μD_,μH_,σD_,σH_]:=1-bpdln[x,r,μD,μH,σD,σH]
bpnln[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=1-bpdln[x,nD,nH,μD,μH,σD,σH]
ubpnln[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=ubpdln[x,nD,nH,μD,μH,σD,σH,b0,b1,nl]
dfubpnln[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=dfubpdln[x,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl]
bpnll[x_,r_,μD_,μH_,σD_,σH_]:=1-bpdll[x,r,μD,μH,σD,σH]
bpnll[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=1-bpdll[x,nD,nH,μD,μH,σD,σH]
ubpnll[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=ubpdll[x,nD,nH,μD,μH,σD,σH,b0,b1,nl]
dfubpnll[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=dfubpdll[x,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl]
bpnlg[x_,r_,μD_,μH_,σD_,σH_]:=1-bpdlg[x,r,μD,μH,σD,σH]
bpnlg[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=1-bpdlg[x,nD,nH,μD,μH,σD,σH]
ubpnlg[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=ubpdlg[x,nD,nH,μD,μH,σD,σH,b0,b1,nl]
dfubpnlg[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=dfubpdlg[x,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl]
bpngn[x_,r_,μD_,μH_,σD_,σH_]:=1-bpdgn[x,r,μD,μH,σD,σH]
bpngn[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=1-bpdgn[x,nD,nH,μD,μH,σD,σH]
ubpnnn[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=ubpdgn[x,nD,nH,μD,μH,σD,σH,b0,b1,nl]
dfubpngn[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=dfubpdgn[x,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl]
bpngl[x_,r_,μD_,μH_,σD_,σH_]:=1-bpdgl[x,r,μD,μH,σD,σH]
bpngl[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=1-bpdgl[x,nD,nH,μD,μH,σD,σH]
ubpngl[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=ubpdgl[x,nD,nH,μD,μH,σD,σH,b0,b1,nl]
dfubpngl[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=dfubpdgl[x,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl]
bpngg[x_,r_,μD_,μH_,σD_,σH_]:=1-bpdgg[x,r,μD,μH,σD,σH]
bpngg[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=1-bpdgg[x,nD,nH,μD,μH,σD,σH]
ubpngg[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=ubpdgg[x,nD,nH,μD,μH,σD,σH,b0,b1,nl]
dfubpngg[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=dfubpdgg[x,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl]
ppvnn[x_,r_,μD_,μH_,σD_,σH_]:=((r (-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))/(-2+r Erfc[((-x+μD)/((Sqrt[2]) σD))]-(-1+r) Erfc[((-x+μH)/((Sqrt[2]) σH))]))
ppvnn[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=((nD (1+Erf[((-x+μD)/((Sqrt[2]) σD))]))/(nD+nH+nD Erf[((-x+μD)/((Sqrt[2]) σD))]+nH Erf[((-x+μH)/((Sqrt[2]) σH))]))

uppvnn[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/(Sqrt[π]))(√(((E^(-((((x-μH))^2)/((σH)^2)))) (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) (((x-μH))^2) ((σD)^4) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+2 (E^(-((((x-μH))^2)/((σH)^2)))) (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((σD)^4) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+(E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((σD)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+(-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((σD)^4) ((σH)^4) (((-2 (nD+nH)+nD Erfc[((-x+μD)/((Sqrt[2]) σD))]+nH Erfc[((-x+μH)/((Sqrt[2]) σH))]))^4)))),1,(1/(Sqrt[π]))(√(((E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) (((x-μH))^2) ((σD)^4) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+2 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^4) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+(E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^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)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+(-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((σD)^4) ((σH)^4) (((-2 (nD+nH)+nD Erfc[((-x+μD)/((Sqrt[2]) σD))]+nH Erfc[((-x+μH)/((Sqrt[2]) σH))]))^4))))]

dfuppvnn[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,-(((-2+nD+nH) (-1+nU) ((((E^(-((((x-μH))^2)/((σH)^2)))) (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) (((x-μH))^2) ((σD)^4) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+2 (E^(-((((x-μH))^2)/((σH)^2)))) (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((σD)^4) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+(E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((σD)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+(-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)))^2))/((nD^2) (2-nD-nH) (nH^2) (((4+nD+nH))^4) ((((E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) nD nH (((x-μH))^2) ((σD)^4) ((σH)^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+2 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) nD (-1+nH) ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)-(E^(-((((x-μH))^2)/((σH)^2)))) (1-nD) nD nH (((x-μH))^2) ((σD)^4) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)-2 (E^(-((((x-μH))^2)/((σH)^2)))) (1-nD) nD (1-nH) ((σD)^4) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+(E^(-((((x-μD))^2)/((σD)^2)))) nD (-1+nH) nH (((x-μD))^2) ((σD)^2) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) (-1+nH) nH ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)-(E^(-((((x-μD))^2)/((σD)^2)))) nD (-1+nH) nH (((x-μD))^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)-2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) (-1+nH) nH ((σD)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)))^2)+(1-nU) ((((E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) (((x-μH))^2) ((σD)^4) ((σH)^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+2 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+(E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((σD)^2) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+(-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)))^2))),1,-(((-2+nD+nH) (-1+nU) ((((E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) (((x-μH))^2) ((σD)^4) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+2 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^4) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+(E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^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)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+(-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)))^2))/((nD^2) (2-nD-nH) (nH^2) (((4+nD+nH))^4) ((((E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) nD nH (((x-μH))^2) ((σD)^4) ((σH)^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+2 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) nD (-1+nH) ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)-(E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) nD nH (((x-μH))^2) ((σD)^4) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)-2 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) nD (-1+nH) ((σD)^4) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+(E^(-((((x-μD))^2)/((σD)^2)))) nD (-1+nH) nH (((x-μD))^2) ((σD)^2) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) (-1+nH) nH ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)-(E^(-((((x-μD))^2)/((σD)^2)))) nD (-1+nH) nH (((x-μD))^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)-2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) (-1+nH) nH ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)))^2)+(1-nU) ((((E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) (((x-μH))^2) ((σD)^4) ((σH)^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+2 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2)+(E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((σD)^2) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^2)+(-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))^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]]
ppvnl[x_,r_,μD_,μH_,σD_,σH_]:=((r (-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))/(-2+r Erfc[((-x+μD)/((Sqrt[2]) σD))]-(-1+r) Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))
ppvnl[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+((nH Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])/(nD (1+Erf[((-x+μD)/((Sqrt[2]) σD))])))))

uppvnl[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/(2 (Sqrt[π])))(√((4 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+8 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+4 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^4) ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2 (nD+nH)+nD Erfc[((-x+μD)/((Sqrt[2]) σD))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^4) ((Log[1+(((σH)^2)/((μH)^2))])^3)))),1,(1/(2 (Sqrt[π])))(√((4 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+8 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+4 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^4) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2 (nD+nH)+nD Erfc[((-x+μD)/((Sqrt[2]) σD))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^4) ((Log[1+(((σH)^2)/((μH)^2))])^3))))]

dfuppvnl[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,(((4 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+8 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+4 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^4) ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)/((((4+nD+nH))^4) ((1/((-2+nD+nH) (((4+nD+nH))^4)))(((4 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+8 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+4 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^4) ((σH)^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) (((4 (E^(-((((x-μD))^2)/((σD)^2)))) nD (-1+nH) nH (((x-μD))^2) ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+8 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)-4 (E^(-((((x-μD))^2)/((σD)^2)))) nD (-1+nH) nH (((x-μD))^2) ((μH)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)-8 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD nH ((μH)^2) ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)-(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (1-nD) nD nH ((μH)^2) ((σD)^4) ((σH)^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD (-1+nH) ((σD)^4) ((σH)^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)-2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD (-1+nH) ((σD)^4) ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)))^2))),1,(((4 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+8 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+4 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^4) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)/((((4+nD+nH))^4) ((1/((-2+nD+nH) (((4+nD+nH))^4)))(((4 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+8 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+4 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((σD)^4) ((σH)^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) (((4 (E^(-((((x-μD))^2)/((σD)^2)))) nD (-1+nH) nH (((x-μD))^2) ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+8 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)-4 (E^(-((((x-μD))^2)/((σD)^2)))) nD (-1+nH) nH (((x-μD))^2) ((μH)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)-8 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD nH ((μH)^2) ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)-(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD nH ((μH)^2) ((σD)^4) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD (-1+nH) ((σD)^4) ((σH)^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)-2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD (-1+nH) ((σD)^4) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) 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]]
ppvng[x_,r_,μD_,μH_,σD_,σH_]:=((r (-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))/(-2+r Erfc[((-x+μD)/((Sqrt[2]) σD))]-2 (-1+r) GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))
ppvng[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=((nD (-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))/(nD Erfc[((-x+μD)/((Sqrt[2]) σD))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))

uppvng[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/(Sqrt[π]))2 √(((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μH)^2) ((σD)^4) ((σH)^6) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μH)/((σH)^2)))) (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) π ((σD)^4) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) π ((μH)^2) ((σD)^4) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[((-x+μD)/((Sqrt[2]) σD))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^4))),1,(1/(Sqrt[π]))2 √(((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μH)^2) ((σD)^4) ((σH)^6) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) π ((σD)^4) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) π ((μH)^2) ((σD)^4) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[((-x+μD)/((Sqrt[2]) σD))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^4)))]

dfuppvng[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μH)^2) ((σD)^4) ((σH)^6) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μH)/((σH)^2)))) (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) π ((σD)^4) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) π ((μH)^2) ((σD)^4) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/((((4+nD+nH))^4) ((1/((-2+nD+nH) (((4+nD+nH))^4)))((((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μH)^2) ((σD)^4) ((σH)^6) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) π ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) π ((μH)^2) ((σD)^4) ((σH)^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) ((((E^(-((((x-μD))^2)/((σD)^2)))) nD (-1+nH) nH (((x-μD))^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)-(E^(-((((x-μD))^2)/((σD)^2)))) nD (-1+nH) nH (((x-μD))^2) ((μH)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)-2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) π ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-(E^(-((2 x μH)/((σH)^2)))) (1-nD) nD (1-nH) π ((σD)^4) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD nH π ((μH)^2) ((σD)^4) ((σH)^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-2 (E^(-((2 x μH)/((σH)^2)))) (1-nD) nD nH π ((μH)^2) ((σD)^4) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2))),1,((((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μH)^2) ((σD)^4) ((σH)^6) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) π ((σD)^4) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) π ((μH)^2) ((σD)^4) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/((((4+nD+nH))^4) ((1/((-2+nD+nH) (((4+nD+nH))^4)))((((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) (((x-μD))^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μH)^2) ((σD)^4) ((σH)^6) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) π ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) π ((μH)^2) ((σD)^4) ((σH)^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) ((((E^(-((((x-μD))^2)/((σD)^2)))) nD (-1+nH) nH (((x-μD))^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)-(E^(-((((x-μD))^2)/((σD)^2)))) nD (-1+nH) nH (((x-μD))^2) ((μH)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)-2 (E^(-((((x-μD))^2)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) π ((σD)^4) ((σH)^4) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-(E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) π ((σD)^4) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD nH π ((μH)^2) ((σD)^4) ((σH)^2) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD nH π ((μH)^2) ((σD)^4) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-2+Erfc[((-x+μD)/((Sqrt[2]) σD))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-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]]
ppvln[x_,r_,μD_,μH_,σD_,σH_]:=-((r Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])/(-2+(1-r)Erfc[((-x+μH)/((Sqrt[2]) σH))]+r Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))
ppvln[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=1+((nH (-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))/(nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))
uppvln[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0, (1/(2 (Sqrt[π])))(√((4 (E^(-((((x-μH))^2)/((σH)^2)))) (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+8 (E^(-((((x-μH))^2)/((σH)^2)))) (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)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+4 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (1-nH) (((4+nD+nH))^2) ((μD)^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^4) ((Log[1+(((σD)^2)/((μD)^2))])^3)))),1,(1/(2 (Sqrt[π])))(√((4 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+8 (E^(-((((x-μH))^2)/((σH)^2)))) (-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)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+4 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^4) ((Log[1+(((σD)^2)/((μD)^2))])^3))))]

dfuppvln[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,(((4 (E^(-((((x-μH))^2)/((σH)^2)))) (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+8 (E^(-((((x-μH))^2)/((σH)^2)))) (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)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+4 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (1-nH) (((4+nD+nH))^2) ((μD)^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)/(16 (((-1+nD))^2) (((-1+nH))^2) (((4+nD+nH))^4) (π^2) ((μD)^4) (((((μD)^2)+((σD)^2)))^4) ((σH)^8) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6) ((((4 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+8 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+4 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((σD)^4) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((σD)^2) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)/(16 (((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) (π^2) ((μD)^4) (((((μD)^2)+((σD)^2)))^4) ((σH)^8) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6))+((nD^2) (((-4 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) nD (nH^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)-8 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) nD (-1+nH) nH ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+4 (E^(-((((x-μH))^2)/((σH)^2)))) (1-nD) nD (nH^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+8 (E^(-((((x-μH))^2)/((σH)^2)))) (1-nD) nD (1-nH) nH ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (1-nH) ((μD)^2) ((σD)^4) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (1-nH) ((μD)^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)-2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) (-1+nH) ((σD)^2) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) (-1+nH) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)))^2))/(16 (((-1+nD))^2) (((-1+nH))^2) (-1+nU) (π^2) ((μD)^4) (((((μD)^2)+((σD)^2)))^4) ((σH)^8) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6)))),1,(((4 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+8 (E^(-((((x-μH))^2)/((σH)^2)))) (-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)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+4 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)/(16 (((-1+nD))^2) (((-1+nH))^2) (((4+nD+nH))^4) (π^2) ((μD)^4) (((((μD)^2)+((σD)^2)))^4) ((σH)^8) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6) ((((4 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+8 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+4 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((σD)^4) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((σD)^2) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)))^2)/(16 (((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) (π^2) ((μD)^4) (((((μD)^2)+((σD)^2)))^4) ((σH)^8) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6))+((nD^2) (((4 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) nD (nH^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+8 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) nD (-1+nH) nH ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)-4 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) nD (nH^2) ((μD)^2) (((x-μH))^2) (((((μD)^2)+((σD)^2)))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)-8 (E^(-((((x-μH))^2)/((σH)^2)))) (-1+nD) nD (-1+nH) nH ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (-1+nH) ((μD)^2) ((σD)^4) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)-(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (-1+nH) ((μD)^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) (-1+nH) ((σD)^2) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)-2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) (-1+nH) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^4) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)))^2))/(16 (((-1+nD))^2) (((-1+nH))^2) (-1+nU) (π^2) ((μD)^4) (((((μD)^2)+((σD)^2)))^4) ((σH)^8) (((nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-nD Erf[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6))))],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]]
ppvll[x_,r_,μD_,μH_,σD_,σH_]:=
-((r Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])/(-2+r Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-(-1+r) Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))
ppvll[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+((nH Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])/(nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))))

uppvll[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/(2 (Sqrt[π])))(√((4 (-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) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (1-nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (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+b1 x))^2)-((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) (((-2 (nD+nH)+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^4) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((Log[1+(((σH)^2)/((μH)^2))])^3)))),1,(1/(2 (Sqrt[π])))(√((4 (-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) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (((((μH)^2)+((σH)^2)))^2) (((-2 (nD+nH)+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^4) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((Log[1+(((σH)^2)/((μH)^2))])^3))))]

dfuppvll[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,(((4 (-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) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (1-nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (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+b1 x))^2)-((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)/(16 (((-1+nD))^2) (((-1+nH))^2) (((4+nD+nH))^4) (π^2) ((μD)^4) ((μH)^4) (((((μD)^2)+((σD)^2)))^4) (((((μH)^2)+((σH)^2)))^4) (((-2 (nD+nH)+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6) ((Log[1+(((σH)^2)/((μH)^2))])^6) ((((4 (-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) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)/(16 (((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) (π^2) ((μD)^4) ((μH)^4) (((((μD)^2)+((σD)^2)))^4) (((((μH)^2)+((σH)^2)))^4) (((-2 (nD+nH)+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6) ((Log[1+(((σH)^2)/((μH)^2))])^6))+((nD^2) ((((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (-1+nH) ((μD)^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)-(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (1-nH) ((μD)^2) ((μH)^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) (-1+nH) ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)-2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) (-1+nH) ((μH)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD (nH^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)-(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (1-nD) nD (nH^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD (-1+nH) nH ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)-2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD (-1+nH) nH ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)))^2))/(16 (((-1+nD))^2) (((-1+nH))^2) (-1+nU) (π^2) ((μD)^4) ((μH)^4) (((((μD)^2)+((σD)^2)))^4) (((((μH)^2)+((σH)^2)))^4) (((-2 (nD+nH)+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6) ((Log[1+(((σH)^2)/((μH)^2))])^6)))),1,(((4 (-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) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)/(16 (((-1+nD))^2) (((-1+nH))^2) (((4+nD+nH))^4) (π^2) ((μD)^4) ((μH)^4) (((((μD)^2)+((σD)^2)))^4) (((((μH)^2)+((σH)^2)))^4) (((-2 (nD+nH)+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6) ((Log[1+(((σH)^2)/((μH)^2))])^6) ((((4 (-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) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2+Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)))^2)/(16 (((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) (π^2) ((μD)^4) ((μH)^4) (((((μD)^2)+((σD)^2)))^4) (((((μH)^2)+((σH)^2)))^4) (((-2 (nD+nH)+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6) ((Log[1+(((σH)^2)/((μH)^2))])^6))+((nD^2) ((((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (-1+nH) ((μD)^2) ((μH)^2) ((σD)^4) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)-(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (-1+nH) ((μD)^2) ((μH)^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) (-1+nH) ((μH)^2) ((σD)^2) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)-2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) (-1+nH) ((μH)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) (((((μH)^2)+((σH)^2)))^2) (((-2 nD-2 nH+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD (nH^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)-(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD (nH^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD (-1+nH) nH ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)-2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (-1+nD) nD (-1+nH) nH ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)))^2))/(16 (((-1+nD))^2) (((-1+nH))^2) (-1+nU) (π^2) ((μD)^4) ((μH)^4) (((((μD)^2)+((σD)^2)))^4) (((((μH)^2)+((σH)^2)))^4) (((-2 (nD+nH)+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6) ((Log[1+(((σH)^2)/((μH)^2))])^6))))],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]]
ppvlg[x_,r_,μD_,μH_,σD_,σH_]:=-((r Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])/(-2+r Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (-1+r) GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))
ppvlg[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=-((nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])/(nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))

uppvlg[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/(2 (Sqrt[π])))(√((16 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (1-nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-2 (nD+nH)+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+2 nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)+16 (E^(-((2 x μH)/((σH)^2)))) (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)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+32 (E^(-((2 x μH)/((σH)^2)))) (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^4) ((Log[1+(((σD)^2)/((μD)^2))])^3)))),1,(1/(2 (Sqrt[π])))(√((16 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)+16 (E^(-((2 x μH)/((σH)^2)))) (-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)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+32 (E^(-((2 x μH)/((σH)^2)))) (-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)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^4) ((Log[1+(((σD)^2)/((μD)^2))])^3))))]

dfuppvlg[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,(((16 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (1-nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-2 (nD+nH)+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+2 nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)+16 (E^(-((2 x μH)/((σH)^2)))) (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)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+32 (E^(-((2 x μH)/((σH)^2)))) (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/(16 (((-1+nD))^2) (((-1+nH))^2) (((4+nD+nH))^4) (π^2) ((μD)^4) ((μH)^4) (((((μD)^2)+((σD)^2)))^4) ((σH)^12) ((Gamma[(((μH)^2)/((σH)^2))])^4) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6) ((((16 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)+16 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+32 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/(16 (((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) (π^2) ((μD)^4) ((μH)^4) (((((μD)^2)+((σD)^2)))^4) ((σH)^12) ((Gamma[(((μH)^2)/((σH)^2))])^4) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6))+((nD^2) ((((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (1-nH) ((μD)^2) ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-2 (nD+nH)+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+2 nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (1-nH) ((μD)^2) ((μH)^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-2 (nD+nH)+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+2 nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)-2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) (-1+nH) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) (-1+nH) ((μH)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)-16 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) nH π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+16 (E^(-((2 x μH)/((σH)^2)))) (1-nD) nD (1-nH) nH π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-32 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (nH^2) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+32 (E^(-((2 x μH)/((σH)^2)))) (1-nD) nD (nH^2) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2))/(16 (((-1+nD))^2) (((-1+nH))^2) (-1+nU) (π^2) ((μD)^4) ((μH)^4) (((((μD)^2)+((σD)^2)))^4) ((σH)^12) ((Gamma[(((μH)^2)/((σH)^2))])^4) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6)))),1,(((16 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)+16 (E^(-((2 x μH)/((σH)^2)))) (-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)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+32 (E^(-((2 x μH)/((σH)^2)))) (-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)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/(16 (((-1+nD))^2) (((-1+nH))^2) (((4+nD+nH))^4) (π^2) ((μD)^4) ((μH)^4) (((((μD)^2)+((σD)^2)))^4) ((σH)^12) ((Gamma[(((μH)^2)/((σH)^2))])^4) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6) ((((16 (-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^6) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)+(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) nD (-1+nH) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)+16 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+32 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/(16 (((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) (π^2) ((μD)^4) ((μH)^4) (((((μD)^2)+((σD)^2)))^4) ((σH)^12) ((Gamma[(((μH)^2)/((σH)^2))])^4) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6))+((nD^2) ((((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (-1+nH) ((μD)^2) ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)-(E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (-1+nH) ((μD)^2) ((μH)^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)+2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) (-1+nH) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)-2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (-1+nD) (-1+nH) ((μH)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nD Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2)+16 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) nH π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^4) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-16 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) nH π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+32 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (nH^2) π ((μD)^2) ((μH)^2) (((((μD)^2)+((σD)^2)))^2) ((σH)^2) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-32 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) 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)) ((Erfc[((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Log[1+(((σD)^2)/((μD)^2))])^3) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2))/(16 (((-1+nD))^2) (((-1+nH))^2) (-1+nU) (π^2) ((μD)^4) ((μH)^4) (((((μD)^2)+((σD)^2)))^4) ((σH)^12) ((Gamma[(((μH)^2)/((σH)^2))])^4) (((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]-2 (nD+nH-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])))^8) ((Log[1+(((σD)^2)/((μD)^2))])^6))))],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]]
ppvgn[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1+(((-1+r) (1+Erf[((-x+μH)/((Sqrt[2]) σH))]))/(2 r (-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])))))
ppvgn[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+((nH (-2+Erfc[((-x+μH)/((Sqrt[2]) σH))]))/(2 nD (-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])))))

uppvgn[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,2 √(((1/((π-nH π) ((σH)^4)))(E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+(1/(((4+nD+nH))^2))(2+nD) (2+nH) (((nD+nH))^3) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+((2 (E^(-((((x-μH))^2)/((σH)^2)))) nH (nH (((b0+b1 x))^2)+((σH)^2)) (((nD-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2))/(π ((σH)^2)))+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((1-nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2))/(((2 nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-2 nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^4)),1,2 √(((1/((-1+nH) π ((σH)^4)))(E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+(1/(π ((σH)^2)))2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+(1/(((4+nD+nH))^2))(2+nD) (2+nH) (((nD+nH))^3) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((-1+nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2))/(((2 nD+nH+nH Erf[((-x+μH)/((Sqrt[2]) σH))]-2 nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^4))]

dfuppvgn[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((1/((π-nH π) ((σH)^4)))(E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+(1/(((4+nD+nH))^2))(2+nD) (2+nH) (((nD+nH))^3) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+((2 (E^(-((((x-μH))^2)/((σH)^2)))) nH (nH (((b0+b1 x))^2)+((σH)^2)) (((nD-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2))/(π ((σH)^2)))+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((1-nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)/((1/(-1+nU))(nH^2) (((-((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2))/π)+(1/(π ((σH)^4)))2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH (((b0+b1 x))^2) (((x-μH))^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+(1/(π ((σH)^2)))2 (E^(-((((x-μH))^2)/((σH)^2)))) (nH (((b0+b1 x))^2)+((σH)^2)) (((nD-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)-(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nD nH (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nD nH (nD (((b0+b1 x))^2)+((σD)^2)) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (E^(-((2 x μD)/((σD)^2)))) (nD^2) nH (((b0+b1 x))^2) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)+(1/(-2+nD+nH))(((((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2))/π)+(((E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2))/((-1+nH) π ((σH)^2)))+(1/(((4+nD+nH))^2))(2+nD) (2+nH) (((nD+nH))^3) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nD (nH^2) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((-1+nD) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)),1,((((1/((-1+nH) π ((σH)^4)))(E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+(1/(π ((σH)^2)))2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+(1/(((4+nD+nH))^2))(2+nD) (2+nH) (((nD+nH))^3) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((-1+nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)/((1/(-1+nU))(nD^2) (nH^2) (((-((2 (E^(-((((x-μH))^2)/((σH)^2)))) nD (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2))/π)+((2 (b0^2) (E^(-((((x-μH))^2)/((σH)^2)))) nD nH (((x-μH))^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2))/(π ((σH)^4)))+((2 (b1^2) (E^(-((((x-μH))^2)/((σH)^2)))) nD nH (x^2) (((x-μH))^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2))/(π ((σH)^4)))+(1/(π ((σH)^2)))2 (E^(-((((x-μH))^2)/((σH)^2)))) nD ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)-(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nH (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nH ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (b0^2) (E^(-((2 x μD)/((σD)^2)))) nD nH (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (b1^2) (E^(-((2 x μD)/((σD)^2)))) nD nH (x^2) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)+(1/(-2+nD+nH))(((((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2))/π)+(((E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2))/((-1+nH) π ((σH)^2)))+(1/(((4+nD+nH))^2))(2+nD) (2+nH) (((nD+nH))^3) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nD (nH^2) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (((1+Erf[((-x+μH)/((Sqrt[2]) σH))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2))/((-1+nD) ((σD)^4) ((Gamma[(((μ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]]
ppvgl[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1+(((-1+r) Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])/(2 r (-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])))))
ppvgl[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1-((nH Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])/(2 nD (-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])))))

uppvgl[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/4) √(((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((π-nH π) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (E^(-((2 x μD)/((σD)^2)))) nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((1-nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2))/(((nD+(1/2) nH Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^4)),1,(1/4) √(((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(1/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)))2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (E^(-((2 x μD)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((-1+nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2))/(((nD+(1/2) nH Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^4))]

dfuppvgl[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((π-nH π) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (E^(-((2 x μD)/((σD)^2)))) nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((1-nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)/(256 (((nD+(1/2) nH Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^8) (((nD^2) (nH^2) (((((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD nH (((b0+b1 x))^2) ((σH)^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/(π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((σH)^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))-(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) nH ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) nH (nD (((b0+b1 x))^2)+((σD)^2)) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) nD nH (((b0+b1 x))^2) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2))/(64 (-1+nU) (((nD+(1/2) nH Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^8))+((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^4) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((σH)^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (E^(-((2 x μD)/((σD)^2)))) nD (nH^2) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((-1+nD) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)/(256 (-2+nD+nH) (((nD+(1/2) nH Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^8)))),1,((-1+nU) ((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2)+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(1/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)))2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (E^(-((2 x μD)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((-1+nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2))/(4 (nD^2) (nH^2) (((((b0^2) (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD nH ((σH)^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/(π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(1/(π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)))(b1^2) (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD nH (x^2) ((σH)^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)-(1/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)))(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((σH)^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)+(1/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)))(E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2)-(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) nH ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) nH ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (b0^2) (E^(-((2 x μD)/((σD)^2)))) nD nH ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (b1^2) (E^(-((2 x μD)/((σD)^2)))) nD nH (x^2) ((Erfc[((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-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]]
ppvgg[x_,r_,μD_,μH_,σD_,σH_]:=(r (-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))/(-1+r GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]-(-1+r) GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])
ppvgg[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=((nD-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])/(nD+nH-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))
uppvgg[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,√(((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μD)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) ((σD)^6) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD+nH-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^4))),1,√(((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μD)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) ((σD)^6) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD+nH-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^4)))]

dfuppvgg[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μD)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (1-nD) (nD^2) (1-nH) nH (((4+nD+nH))^2) ((μD)^2) ((σD)^6) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (1-nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/((((-1+nD))^2) (((-1+nH))^2) (((4+nD+nH))^4) ((μD)^4) ((μH)^4) ((σD)^12) ((σH)^12) ((Gamma[(((μD)^2)/((σD)^2))])^4) ((Gamma[(((μH)^2)/((σH)^2))])^4) (((nD+nH-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^8) (((((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μD)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) ((σD)^6) ((σH)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/((((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) ((μD)^4) ((μH)^4) ((σD)^12) ((σH)^12) ((Gamma[(((μD)^2)/((σD)^2))])^4) ((Gamma[(((μH)^2)/((σH)^2))])^4) (((nD+nH-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^8))+((nD^2) (nH^2) ((((E^(-((2 x μD)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)-(E^(-((2 x μD)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) nD (-1+nH) nH ((μD)^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)-2 (E^(-((2 x μD)/((σD)^2)))) nD (-1+nH) nH ((μD)^2) ((μH)^2) (2 (b0^2) (-1+nD)+4 b0 b1 (-1+nD) x+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) ((μD)^2) ((σD)^6) ((σH)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-(E^(-((2 x μH)/((σH)^2)))) (1-nD) nD (1-nH) ((μD)^2) ((σD)^6) ((σH)^2) (nH (((b0+b1 x))^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD nH ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-2 (E^(-((2 x μH)/((σH)^2)))) (1-nD) nD nH ((μD)^2) ((μH)^2) ((σD)^6) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2))/((((-1+nD))^2) (((-1+nH))^2) (-1+nU) ((μD)^4) ((μH)^4) ((σD)^12) ((σH)^12) ((Gamma[(((μD)^2)/((σD)^2))])^4) ((Gamma[(((μH)^2)/((σH)^2))])^4) (((nD+nH-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^8)))),1,((((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μD)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) ((σD)^6) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/((((-1+nD))^2) (((-1+nH))^2) (((4+nD+nH))^4) ((μD)^4) ((μH)^4) ((σD)^12) ((σH)^12) ((Gamma[(((μD)^2)/((σD)^2))])^4) ((Gamma[(((μH)^2)/((σH)^2))])^4) (((nD+nH-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^8) (((((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2)+(E^(-((2 x μD)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) ((σD)^6) ((σH)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/((((-1+nD))^2) (((-1+nH))^2) (-2+nD+nH) (((4+nD+nH))^4) ((μD)^4) ((μH)^4) ((σD)^12) ((σH)^12) ((Gamma[(((μD)^2)/((σD)^2))])^4) ((Gamma[(((μH)^2)/((σH)^2))])^4) (((nD+nH-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^8))+((nD^2) (nH^2) ((((E^(-((2 x μD)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)-(E^(-((2 x μD)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) nD (-1+nH) nH ((μD)^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)-2 (E^(-((2 x μD)/((σD)^2)))) nD (-1+nH) nH ((μD)^2) ((μH)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((-1+GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) ((μD)^2) ((σD)^6) ((σH)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-(E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) ((μD)^2) ((σD)^6) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD nH ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD nH ((μD)^2) ((μH)^2) ((σD)^6) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) (((-1+GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2))/((((-1+nD))^2) (((-1+nH))^2) (-1+nU) ((μD)^4) ((μH)^4) ((σD)^12) ((σH)^12) ((Gamma[(((μD)^2)/((σD)^2))])^4) ((Gamma[(((μH)^2)/((σH)^2))])^4) (((nD+nH-nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]-nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^8))))],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]]
npvnn[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1-((r Erfc[((-x+μD)/((Sqrt[2]) σD))])/((-1+r) Erfc[((-x+μH)/((Sqrt[2]) σH))]))))
npvnn[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+((nD Erfc[((-x+μD)/((Sqrt[2]) σD))])/(nH Erfc[((-x+μH)/((Sqrt[2]) σH))]))))

unpvnn[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,√((1/(((nD Erfc[((-x+μD)/((Sqrt[2]) σD))]+nH Erfc[((-x+μH)/((Sqrt[2]) σH))]))^4))((((E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2))/((π-nH π) ((σH)^4)))+((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH (nH (((b0+b1 x))^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2))/(π ((σH)^2)))+(((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/((π-nD π) ((σD)^4)))+((2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/(π ((σD)^2)))+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/(((4+nD+nH))^2)))),1,√((1/(((nD Erfc[((-x+μD)/((Sqrt[2]) σD))]+nH Erfc[((-x+μH)/((Sqrt[2]) σH))]))^4))((((E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2))/((-1+nH) π ((σH)^4)))+((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2))/(π ((σH)^2)))+(((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/((-1+nD) π ((σD)^4)))+((2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/(π ((σD)^2)))+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/(((4+nD+nH))^2))))]

dfunpvnn[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((((E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2))/((π-nH π) ((σH)^4)))+((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH (nH (((b0+b1 x))^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2))/(π ((σH)^2)))+(((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/((π-nD π) ((σD)^4)))+((2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/(π ((σD)^2)))+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/(((4+nD+nH))^2))))^2)/((1/((-1+nU) (π^2) ((σD)^8) ((σH)^8)))4 (E^(-((2 (((x-μD))^2))/((σD)^2))-((2 (((x-μH))^2))/((σH)^2)))) (nD^4) (nH^4) (((b0+b1 x))^4) ((((E^((((x-μD))^2)/((σD)^2))) ((σD)^4) ((x^2)-2 x μH+((μH)^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2)+(E^((((x-μH))^2)/((σH)^2))) ((x^2)-2 x μD+((μD)^2)+((σD)^2)) ((σH)^4) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2)))^2)+(1/(-2+nD+nH))(((((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2))/π)+(((E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2))/((-1+nH) π ((σH)^2)))+((2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/π)+(((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/((-1+nD) π ((σD)^2)))+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/(((4+nD+nH))^2))))^2)),1,((((((E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2))/((-1+nH) π ((σH)^4)))+((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2))/(π ((σH)^2)))+(1/((-1+nD) π ((σD)^4)))(E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2)+((2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/(π ((σD)^2)))+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/(((4+nD+nH))^2))))^2)/((1/((-1+nU) (π^2) ((σD)^8) ((σH)^8)))4 (E^(-((2 (((x-μD))^2))/((σD)^2))-((2 (((x-μH))^2))/((σH)^2)))) (nD^4) (nH^4) ((((b0^2)+(b1^2) (x^2)))^2) ((((E^((((x-μD))^2)/((σD)^2))) ((σD)^4) ((x^2)-2 x μH+((μH)^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2)+(E^((((x-μH))^2)/((σH)^2))) ((x^2)-2 x μD+((μD)^2)+((σD)^2)) ((σH)^4) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2)))^2)+(1/(-2+nD+nH))(((((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2))/π)+(((E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2))/((-1+nH) π ((σH)^2)))+((2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/π)+(((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/((-1+nD) π ((σD)^2)))+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2))/(((4+nD+nH))^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]]
npvnl[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1-((r Erfc[((-x+μD)/((Sqrt[2]) σD))])/((-1+r) Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))))
npvnl[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=1-(1/(1+((nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])/(nD Erfc[((-x+μD)/((Sqrt[2]) σD))]))))

unpvnl[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/2) √(((1/((π-nD π) ((σD)^4)))4 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2)+((8 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/(π ((σD)^2)))+((4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/(((4+nD+nH))^2))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((π-nH π) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)))/(((nD Erfc[((-x+μD)/((Sqrt[2]) σD))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^4)),1,(1/2) √(((1/((-1+nD) π ((σD)^4)))4 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2)+((8 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/(π ((σD)^2)))+((4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/(((4+nD+nH))^2))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)))/(((nD Erfc[((-x+μD)/((Sqrt[2]) σD))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^4))]

dfunpvnl[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((1/((π-nD π) ((σD)^4)))4 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2)+((8 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/(π ((σD)^2)))+((4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/(((4+nD+nH))^2))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((π-nH π) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))))^2)/((1/(-2+nD+nH))(((((8 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/π)+((4 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/((-1+nD) π ((σD)^2)))+((4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/(((4+nD+nH))^2))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^4) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((σH)^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))))^2)+(1/((-1+nU) (π^2)))4 (nD^2) (nH^2) (((-4 (E^(-((((x-μD))^2)/((σD)^2)))) nH ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2)+((4 (E^(-((((x-μD))^2)/((σD)^2)))) nD nH (((b0+b1 x))^2) (((x-μD))^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/((σD)^4))+((4 (E^(-((((x-μD))^2)/((σD)^2)))) nH (nD (((b0+b1 x))^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/((σD)^2))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD nH (((b0+b1 x))^2) ((σH)^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((σH)^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))))^2)),1,((((1/((-1+nD) π ((σD)^4)))4 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2)+((8 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/(π ((σD)^2)))+((4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/(((4+nD+nH))^2))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))))^2)/((1/(-2+nD+nH))(((((8 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/π)+((4 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/((-1+nD) π ((σD)^2)))+((4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/(((4+nD+nH))^2))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^4) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((σH)^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))))^2)+(1/((-1+nU) (π^2)))4 (nD^2) (nH^2) (((-4 (E^(-((((x-μD))^2)/((σD)^2)))) nH ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2)+((4 (b0^2) (E^(-((((x-μD))^2)/((σD)^2)))) nD nH (((x-μD))^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/((σD)^4))+((4 (b1^2) (E^(-((((x-μD))^2)/((σD)^2)))) nD nH (x^2) (((x-μD))^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/((σD)^4))+((4 (E^(-((((x-μD))^2)/((σD)^2)))) nH ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2))/((σD)^2))+((b0^2) (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD nH ((σH)^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+((b1^2) (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD nH (x^2) ((σH)^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((σH)^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))))^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]]
npvng[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1-((r Erfc[((-x+μD)/((Sqrt[2]) σD))])/(2 (-1+r) GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))))
npvng[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+((nD Erfc[((-x+μD)/((Sqrt[2]) σD))])/(2 nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))))

unpvng[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/2) √(((1/(π ((σD)^2)))2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(1/(π ((σD)^4)))2 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) ((((b0+b1 x))^2)+(((σD)^2)/(2 (-1+nD)))) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/(((4+nD+nH))^2))+(1/(((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))4 (E^(-((2 x μH)/((σH)^2)))) (nD^2) (nH^2) ((((b0+b1 x))^2)+(((σH)^2)/(2 (-1+nH)))) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(nD^2) (nH^2) ((((b0+b1 x))^2)+(((σH)^2)/nH)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((((((E^(-((x μH)/((σH)^2)))) (((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))))/(μH Gamma[(((μH)^2)/((σH)^2))]))+(1/((σH)^2))2 μH (-((MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))])/(Gamma[(((μH)^2)/((σH)^2))]))+GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (-Log[((x μH)/((σH)^2))]+PolyGamma[0,(((μH)^2)/((σH)^2))]))))^2))/((((1/2) nD Erfc[((-x+μD)/((Sqrt[2]) σD))]+nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^4)),1,(1/2) √((((2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/(π ((σD)^2)))+(1/(π ((σD)^4)))2 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) ((b0^2)+(b1^2) (x^2)+(((σD)^2)/(2 (-1+nD)))) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/(((4+nD+nH))^2))+(1/((-1+nH) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))2 (E^(-((2 x μH)/((σH)^2)))) (nD^2) (nH^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(nD^2) (nH^2) ((b0^2)+(b1^2) (x^2)+(((σH)^2)/nH)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((((((E^(-((x μH)/((σH)^2)))) (((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))))/(μH Gamma[(((μH)^2)/((σH)^2))]))+(1/((σH)^2))2 μH (-((MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))])/(Gamma[(((μH)^2)/((σH)^2))]))+GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (-Log[((x μH)/((σH)^2))]+PolyGamma[0,(((μH)^2)/((σH)^2))]))))^2))/((((1/2) nD Erfc[((-x+μD)/((Sqrt[2]) σD))]+nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^4))]

dfunpvng[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((1/(π ((σD)^2)))2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(1/(π ((σD)^4)))2 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) ((((b0+b1 x))^2)+(((σD)^2)/(2 (-1+nD)))) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/(((4+nD+nH))^2))+(1/(((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))4 (E^(-((2 x μH)/((σH)^2)))) (nD^2) (nH^2) ((((b0+b1 x))^2)+(((σH)^2)/(2 (-1+nH)))) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(nD^2) (nH^2) ((((b0+b1 x))^2)+(((σH)^2)/nH)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((((((E^(-((x μH)/((σH)^2)))) (((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))))/(μH Gamma[(((μH)^2)/((σH)^2))]))+(1/((σH)^2))2 μH (-((MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))])/(Gamma[(((μH)^2)/((σH)^2))]))+GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (-Log[((x μH)/((σH)^2))]+PolyGamma[0,(((μH)^2)/((σH)^2))]))))^2)))^2)/((1/(-1+nU))(nD^2) (nH^4) (((-((2 (E^(-((((x-μD))^2)/((σD)^2)))) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/π)+((2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (((b0+b1 x))^2) (((x-μD))^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/(π ((σD)^4)))+(1/(π ((σD)^2)))2 (E^(-((((x-μD))^2)/((σD)^2)))) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(1/(((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))4 (E^(-((2 x μH)/((σH)^2)))) nD (((b0+b1 x))^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+nD (((b0+b1 x))^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((((((E^(-((x μH)/((σH)^2)))) (((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))))/(μH Gamma[(((μH)^2)/((σH)^2))]))+(1/((σH)^2))2 μH (-((MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))])/(Gamma[(((μH)^2)/((σH)^2))]))+GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (-Log[((x μH)/((σH)^2))]+PolyGamma[0,(((μH)^2)/((σH)^2))]))))^2)))^2)+(1/(-2+nD+nH))(((((2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/π)+(((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/((-1+nD) π ((σD)^2)))+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/(((4+nD+nH))^2))+(2 (E^(-((2 x μH)/((σH)^2)))) (nD^2) (nH^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2))/((-1+nH) ((σH)^4) ((Gamma[(((μH)^2)/((σH)^2))])^2))+(nD^2) nH ((σH)^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((((((E^(-((x μH)/((σH)^2)))) (((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))))/(μH Gamma[(((μH)^2)/((σH)^2))]))+(1/((σH)^2))2 μH (-((MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))])/(Gamma[(((μH)^2)/((σH)^2))]))+GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (-Log[((x μH)/((σH)^2))]+PolyGamma[0,(((μH)^2)/((σH)^2))]))))^2)))^2)),1,(((((2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/(π ((σD)^2)))+(1/(π ((σD)^4)))2 (E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) ((b0^2)+(b1^2) (x^2)+(((σD)^2)/(2 (-1+nD)))) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/(((4+nD+nH))^2))+(1/((-1+nH) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))2 (E^(-((2 x μH)/((σH)^2)))) (nD^2) (nH^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(nD^2) (nH^2) ((b0^2)+(b1^2) (x^2)+(((σH)^2)/nH)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((((((E^(-((x μH)/((σH)^2)))) (((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))))/(μH Gamma[(((μH)^2)/((σH)^2))]))+(1/((σH)^2))2 μH (-((MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))])/(Gamma[(((μH)^2)/((σH)^2))]))+GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (-Log[((x μH)/((σH)^2))]+PolyGamma[0,(((μH)^2)/((σH)^2))]))))^2)))^2)/((1/(-2+nD+nH))(((((2 (E^(-((((x-μD))^2)/((σD)^2)))) nD (nH^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/π)+(((E^(-((((x-μD))^2)/((σD)^2)))) (nD^2) (nH^2) (((x-μD))^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/((-1+nD) π ((σD)^2)))+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/(((4+nD+nH))^2))+(1/((-1+nH) ((σH)^4) ((Gamma[(((μH)^2)/((σH)^2))])^2)))2 (E^(-((2 x μH)/((σH)^2)))) (nD^2) (nH^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(nD^2) nH ((σH)^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((((((E^(-((x μH)/((σH)^2)))) (((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))))/(μH Gamma[(((μH)^2)/((σH)^2))]))+(1/((σH)^2))2 μH (-((MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))])/(Gamma[(((μH)^2)/((σH)^2))]))+GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (-Log[((x μH)/((σH)^2))]+PolyGamma[0,(((μH)^2)/((σH)^2))]))))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) (((-((2 (E^(-((((x-μD))^2)/((σD)^2)))) nH ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/π)-(((E^(-((((x-μD))^2)/((σD)^2)))) nD nH (((x-μD))^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/((-1+nD) π ((σD)^2)))+((2 (E^(-((((x-μD))^2)/((σD)^2)))) nH ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2))/(π ((σD)^2)))+(1/(π ((σD)^4)))2 (E^(-((((x-μD))^2)/((σD)^2)))) nD nH (((x-μD))^2) ((b0^2)+(b1^2) (x^2)+(((σD)^2)/(2 (-1+nD)))) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(1/(((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))4 (b0^2) (E^(-((2 x μH)/((σH)^2)))) nD nH ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(1/(((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))4 (b1^2) (E^(-((2 x μH)/((σH)^2)))) nD nH (x^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-nD ((σH)^2) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((((((E^(-((x μH)/((σH)^2)))) (((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))))/(μH Gamma[(((μH)^2)/((σH)^2))]))+(1/((σH)^2))2 μH (-((MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))])/(Gamma[(((μH)^2)/((σH)^2))]))+GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (-Log[((x μH)/((σH)^2))]+PolyGamma[0,(((μH)^2)/((σH)^2))]))))^2)+nD nH ((b0^2)+(b1^2) (x^2)+(((σH)^2)/nH)) ((Erfc[((-x+μD)/((Sqrt[2]) σD))])^2) ((((((E^(-((x μH)/((σH)^2)))) (((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))))/(μH Gamma[(((μH)^2)/((σH)^2))]))+(1/((σH)^2))2 μH (-((MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))])/(Gamma[(((μH)^2)/((σH)^2))]))+GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (-Log[((x μH)/((σH)^2))]+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]]
npvln[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1-((r Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])/((-1+r) Erfc[((-x+μH)/((Sqrt[2]) σH))]))))
npvln[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])/(nH Erfc[((-x+μH)/((Sqrt[2]) σH))]))))


unpvln[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/2) √(((1/((π-nH π) ((σH)^4)))4 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2)+((8 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH (nH (((b0+b1 x))^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/(π ((σH)^2)))+((4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/(((4+nD+nH))^2))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((π-nD π) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)))/(((nH Erfc[((-x+μH)/((Sqrt[2]) σH))]+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^4)),1,(1/2) √(((1/((-1+nH) π ((σH)^4)))4 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2)+((8 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/(π ((σH)^2)))+((4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/(((4+nD+nH))^2))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3)))/(((nH Erfc[((-x+μH)/((Sqrt[2]) σH))]+nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]))^4))]

dfunpvln[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((1/((π-nH π) ((σH)^4)))4 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2)+((8 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH (nH (((b0+b1 x))^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/(π ((σH)^2)))+((4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/(((4+nD+nH))^2))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((π-nD π) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))))^2)/((1/(-2+nD+nH))(((((8 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/π)+((4 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/((-1+nH) π ((σH)^2)))+((4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/(((4+nD+nH))^2))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^4) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((σD)^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))))^2)+(1/((-1+nU) (π^2)))4 (nD^2) (nH^2) (((-4 (E^(-((((x-μH))^2)/((σH)^2)))) nD ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2)+((4 (E^(-((((x-μH))^2)/((σH)^2)))) nD nH (((b0+b1 x))^2) (((x-μH))^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/((σH)^4))+((4 (E^(-((((x-μH))^2)/((σH)^2)))) nD (nH (((b0+b1 x))^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/((σH)^2))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD nH (((b0+b1 x))^2) ((σD)^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nH ((σD)^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nH ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))))^2)),1,((((1/((-1+nH) π ((σH)^4)))4 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2)+((8 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/(π ((σH)^2)))+((4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/(((4+nD+nH))^2))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))))^2)/((1/(-2+nD+nH))(((((8 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/π)+((4 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/((-1+nH) π ((σH)^2)))+((4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/(((4+nD+nH))^2))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^4) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((σD)^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))))^2)+(1/((-1+nU) (π^2)))4 (nD^2) (nH^2) (((-4 (E^(-((((x-μH))^2)/((σH)^2)))) nD ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2)+((4 (b0^2) (E^(-((((x-μH))^2)/((σH)^2)))) nD nH (((x-μH))^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/((σH)^4))+((4 (b1^2) (E^(-((((x-μH))^2)/((σH)^2)))) nD nH (x^2) (((x-μH))^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/((σH)^4))+((4 (E^(-((((x-μH))^2)/((σH)^2)))) nD ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2))/((σH)^2))+((b0^2) (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD nH ((σD)^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((b1^2) (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD nH (x^2) ((σD)^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nH ((σD)^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nH ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))))^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]]
npvll[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1-((r Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])/((-1+r) Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))))
npvll[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])/(nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))))

unpvll[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/2) √(((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2)+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((π-nD π) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((π-nH π) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)))/(((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^4)),1,(1/2) √(((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2)+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3)))/(((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))^4))]

dfunpvll[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2)+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((π-nD π) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((π-nH π) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))))^2)/((1/(-2+nD+nH))((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2)+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^4) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((σD)^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^4) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((σH)^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))))^2)+(1/((-1+nU) (π^2)))4 (nD^2) (nH^2) (((((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD nH (((b0+b1 x))^2) ((σD)^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nH ((σD)^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nH ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD nH (((b0+b1 x))^2) ((σH)^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((σH)^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))))^2)),1,((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2)+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))))^2)/((1/(-2+nD+nH))((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2)+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^4) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((σD)^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^4) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((σH)^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))))^2)+(1/((-1+nU) (π^2)))4 (nD^2) (nH^2) (((((b0^2) (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD nH ((σD)^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((b1^2) (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD nH (x^2) ((σD)^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nH ((σD)^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nH ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((b0^2) (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD nH ((σH)^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+((b1^2) (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD nH (x^2) ((σH)^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((σH)^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))))^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]]
npvlg[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1-((r Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])/(2 (-1+r) GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))))
npvlg[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])/(2 nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))))

unpvlg[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,(1/4) √(((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((π-nD π) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(1/(((μH)^2) ((σH)^4) ((Gamma[(((μH)^2)/((σH)^2))])^2)))4 (E^(-((2 x μH)/((σH)^2)))) (nD^2) nH (nH (((b0+b1 x))^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(1/((1-nH) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))8 (E^(-((2 x μH)/((σH)^2)))) (nD^2) (nH^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2))/((((1/2) nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^4)),1,(1/4) √(((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(1/(((μH)^2) ((σH)^4) ((Gamma[(((μH)^2)/((σH)^2))])^2)))4 (E^(-((2 x μH)/((σH)^2)))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(1/((-1+nH) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))8 (E^(-((2 x μH)/((σH)^2)))) (nD^2) (nH^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2))/((((1/2) nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^4))]

dfunpvlg[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((π-nD π) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(1/(((μH)^2) ((σH)^4) ((Gamma[(((μH)^2)/((σH)^2))])^2)))4 (E^(-((2 x μH)/((σH)^2)))) (nD^2) nH (nH (((b0+b1 x))^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(1/((1-nH) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))8 (E^(-((2 x μH)/((σH)^2)))) (nD^2) (nH^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/(256 ((((1/2) nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^8) (((nD^2) (nH^2) (((((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD nH (((b0+b1 x))^2) ((σD)^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/(π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nH ((σD)^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nH ((b0^2) nD+2 b0 b1 nD x+(b1^2) nD (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))-(1/(((μH)^2) ((σH)^2) ((Gamma[(((μH)^2)/((σH)^2))])^2)))2 (E^(-((2 x μH)/((σH)^2)))) nD ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(1/(((μH)^2) ((σH)^4) ((Gamma[(((μH)^2)/((σH)^2))])^2)))2 (E^(-((2 x μH)/((σH)^2)))) nD (nH (((b0+b1 x))^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(1/(((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))8 (E^(-((2 x μH)/((σH)^2)))) nD nH (((b0+b1 x))^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2))/(64 (-1+nU) ((((1/2) nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^8))+((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^4) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((σD)^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(1/(((μH)^2) ((σH)^2) ((Gamma[(((μH)^2)/((σH)^2))])^2)))4 (E^(-((2 x μH)/((σH)^2)))) (nD^2) nH ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(1/((-1+nH) ((σH)^4) ((Gamma[(((μH)^2)/((σH)^2))])^2)))8 (E^(-((2 x μH)/((σH)^2)))) (nD^2) (nH^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/(256 (-2+nD+nH) ((((1/2) nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^8)))),1,((((nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+2 nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^8) ((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(1/(((μH)^2) ((σH)^4) ((Gamma[(((μH)^2)/((σH)^2))])^2)))4 (E^(-((2 x μH)/((σH)^2)))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(1/((-1+nH) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))8 (E^(-((2 x μH)/((σH)^2)))) (nD^2) (nH^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2))/(256 ((((1/2) nD Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))]+nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^8) ((1/(-1+nU))4 (nD^2) (nH^2) (((((b0^2) (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD nH ((σD)^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/(π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((b1^2) (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD nH (x^2) ((σD)^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/(π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nH ((σD)^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nH ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))-(1/(((μH)^2) ((σH)^2) ((Gamma[(((μH)^2)/((σH)^2))])^2)))2 (E^(-((2 x μH)/((σH)^2)))) nD ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(1/(((μH)^2) ((σH)^4) ((Gamma[(((μH)^2)/((σH)^2))])^2)))2 (E^(-((2 x μH)/((σH)^2)))) nD ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(1/(((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))8 (b0^2) (E^(-((2 x μH)/((σH)^2)))) nD nH ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(1/(((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2)))8 (b1^2) (E^(-((2 x μH)/((σH)^2)))) nD nH (x^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)+(1/(-2+nD+nH))((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+((E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) (nD^2) (nH^2) ((σD)^4) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 Log[x]+2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2))/((-1+nD) π (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))]))^2)/(4 Log[1+(((σD)^2)/((μD)^2))])))) nD (nH^2) ((σD)^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-2 ((σD)^2) Log[x]+2 ((σD)^2) Log[μD]+(2 ((μD)^2)+3 ((σD)^2)) Log[1+(((σD)^2)/((μD)^2))]))^2))/(π ((μD)^2) (((((μD)^2)+((σD)^2)))^2) ((Log[1+(((σD)^2)/((μD)^2))])^3))+(1/(((μH)^2) ((σH)^2) ((Gamma[(((μH)^2)/((σH)^2))])^2)))4 (E^(-((2 x μH)/((σH)^2)))) (nD^2) nH ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+(1/((-1+nH) ((σH)^4) ((Gamma[(((μH)^2)/((σH)^2))])^2)))8 (E^(-((2 x μH)/((σH)^2)))) (nD^2) (nH^2) ((Erfc[-((2 Log[x]-2 Log[μD]+Log[1+(((σD)^2)/((μD)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σD)^2)/((μD)^2))]])))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-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]]
npvgn[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1-((2 r GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])/((-1+r) Erfc[((-x+μH)/((Sqrt[2]) σH))]))))
npvgn[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+((2 nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])/(nH Erfc[((-x+μH)/((Sqrt[2]) σH))]))))

unpvgn[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,2 √(((1/(π ((σH)^4)))2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) ((((b0+b1 x))^2)+(((σH)^2)/(2 (-1+nH)))) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2)+((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) ((((b0+b1 x))^2)+(((σH)^2)/nH)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(π ((σH)^2)))+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(((4+nD+nH))^2))+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (nD^2) (nH^2) ((((b0+b1 x))^2)+(((σD)^2)/(2 (-1+nD)))) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-(E^(-((x μD)/((σD)^2)))) (((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(nD^2) (nH^2) ((((b0+b1 x))^2)+(((σD)^2)/nD)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((((((E^(-((x μD)/((σD)^2)))) (((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))))/(μD Gamma[(((μD)^2)/((σD)^2))]))+(1/((σD)^2))2 μD (-((MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))])/(Gamma[(((μD)^2)/((σD)^2))]))+GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (-Log[((x μD)/((σD)^2))]+PolyGamma[0,(((μD)^2)/((σD)^2))]))))^2))/(((nH Erfc[((-x+μH)/((Sqrt[2]) σH))]+2 nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^4)),1,2 √((((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(π ((σH)^2)))+(1/(π ((σH)^4)))2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) ((b0^2)+(b1^2) (x^2)+(((σH)^2)/(2 (-1+nH)))) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2)+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(((4+nD+nH))^2))+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((-1+nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2))/(((nH Erfc[((-x+μH)/((Sqrt[2]) σH))]+2 nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^4))]

dfunpvgn[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((1/(π ((σH)^4)))2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) ((((b0+b1 x))^2)+(((σH)^2)/(2 (-1+nH)))) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2)+((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) ((((b0+b1 x))^2)+(((σH)^2)/nH)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(π ((σH)^2)))+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(((4+nD+nH))^2))+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (nD^2) (nH^2) ((((b0+b1 x))^2)+(((σD)^2)/(2 (-1+nD)))) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-(E^(-((x μD)/((σD)^2)))) (((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(nD^2) (nH^2) ((((b0+b1 x))^2)+(((σD)^2)/nD)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((((((E^(-((x μD)/((σD)^2)))) (((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))))/(μD Gamma[(((μD)^2)/((σD)^2))]))+(1/((σD)^2))2 μD (-((MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))])/(Gamma[(((μD)^2)/((σD)^2))]))+GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (-Log[((x μD)/((σD)^2))]+PolyGamma[0,(((μD)^2)/((σD)^2))]))))^2)))^2)/((1/(-1+nU))(nD^4) (nH^4) (((b0+b1 x))^4) (((((2 (E^(-((((x-μH))^2)/((σH)^2)))) (((x-μH))^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(π ((σH)^4)))+((2 (E^(-((((x-μH))^2)/((σH)^2)))) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(π ((σH)^2)))+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-(E^(-((x μD)/((σD)^2)))) (((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((((((E^(-((x μD)/((σD)^2)))) (((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))))/(μD Gamma[(((μD)^2)/((σD)^2))]))+(1/((σD)^2))2 μD (-((MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))])/(Gamma[(((μD)^2)/((σD)^2))]))+GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (-Log[((x μD)/((σD)^2))]+PolyGamma[0,(((μD)^2)/((σD)^2))]))))^2)))^2)+(1/(-2+nD+nH))(((((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/π)+(((E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/((-1+nH) π ((σH)^2)))+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(((4+nD+nH))^2))+(2 (nD^2) (nH^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-(E^(-((x μD)/((σD)^2)))) (((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2))/((-1+nD) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2))+nD (nH^2) ((σD)^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((((((E^(-((x μD)/((σD)^2)))) (((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))))/(μD Gamma[(((μD)^2)/((σD)^2))]))+(1/((σD)^2))2 μD (-((MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))])/(Gamma[(((μD)^2)/((σD)^2))]))+GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (-Log[((x μD)/((σD)^2))]+PolyGamma[0,(((μD)^2)/((σD)^2))]))))^2)))^2)),1,(((((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(π ((σH)^2)))+(1/(π ((σH)^4)))2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) ((b0^2)+(b1^2) (x^2)+(((σH)^2)/(2 (-1+nH)))) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2)+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(((4+nD+nH))^2))+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((-1+nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)/((1/(-1+nU))(nD^2) (nH^2) (((-((2 (E^(-((((x-μH))^2)/((σH)^2)))) nD ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/π)-(((E^(-((((x-μH))^2)/((σH)^2)))) nD nH (((x-μH))^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/((-1+nH) π ((σH)^2)))+((2 (E^(-((((x-μH))^2)/((σH)^2)))) nD ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(π ((σH)^2)))+(1/(π ((σH)^4)))2 (E^(-((((x-μH))^2)/((σH)^2)))) nD nH (((x-μH))^2) ((b0^2)+(b1^2) (x^2)+(((σH)^2)/(2 (-1+nH)))) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2)-(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nH ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nH ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (b0^2) (E^(-((2 x μD)/((σD)^2)))) nD nH ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (b1^2) (E^(-((2 x μD)/((σD)^2)))) nD nH (x^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)+(1/(-2+nD+nH))(((((2 (E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) nH ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/π)+(((E^(-((((x-μH))^2)/((σH)^2)))) (nD^2) (nH^2) (((x-μH))^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/((-1+nH) π ((σH)^2)))+(((2+nD) (2+nH) (((nD+nH))^3) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2))/(((4+nD+nH))^2))+(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))(E^(-((2 x μD)/((σD)^2)))) nD (nH^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) ((Erfc[((-x+μH)/((Sqrt[2]) σH))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2))/((-1+nD) ((σD)^4) ((Gamma[(((μ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]]
npvgl[x_,r_,μD_,μH_,σD_,σH_]:=(1/(1-((2 r GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])/((-1+r) Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))))
npvgl[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=(1/(1+((2 nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])/(nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]))))

unpvgl[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,√(((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2)+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((π-nH π) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (E^(-((2 x μD)/((σD)^2)))) nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((1-nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2))/(((nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]+2 nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^4)),1,√(((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2)+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (E^(-((2 x μD)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((-1+nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2))/(((nH Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))]+2 nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]))^4))]

dfunpvgl[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2)+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (-2 (-1+nH) (((b0+b1 x))^2)-((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((π-nH π) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (E^(-((2 x μD)/((σD)^2)))) nD (nH^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((1-nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)/((1/(-1+nU))4 (nD^2) (nH^2) (((((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD nH (((b0+b1 x))^2) ((σH)^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/(π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((σH)^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))-(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) nH ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) nH (nD (((b0+b1 x))^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) nD nH (((b0+b1 x))^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)+(1/(-2+nD+nH))((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2)+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^4) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((σH)^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (E^(-((2 x μD)/((σD)^2)))) nD (nH^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((-1+nD) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)),1,((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2)+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^2) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (E^(-((2 x μD)/((σD)^2)))) nD (nH^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((-1+nD) ((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)/((1/(-1+nU))4 (nD^2) (nH^2) (((((b0^2) (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD nH ((σH)^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/(π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+((b1^2) (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD nH (x^2) ((σH)^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/(π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))-((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((σH)^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) nD ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))-(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) nH ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((μD)^2) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))2 (E^(-((2 x μD)/((σD)^2)))) nH ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (b0^2) (E^(-((2 x μD)/((σD)^2)))) nD nH ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/(((σD)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (b1^2) (E^(-((2 x μD)/((σD)^2)))) nD nH (x^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)))^2)+(1/(-2+nD+nH))((((1/(((4+nD+nH))^2))4 (2+nD) (2+nH) (((nD+nH))^3) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2)+((E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) (nH^2) ((σH)^4) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 Log[x]+2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2))/((-1+nH) π (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(2 (E^(-((((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))]))^2)/(4 Log[1+(((σH)^2)/((μH)^2))])))) (nD^2) nH ((σH)^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-2 ((σH)^2) Log[x]+2 ((σH)^2) Log[μH]+(2 ((μH)^2)+3 ((σH)^2)) Log[1+(((σH)^2)/((μH)^2))]))^2))/(π ((μH)^2) (((((μH)^2)+((σH)^2)))^2) ((Log[1+(((σH)^2)/((μH)^2))])^3))+(1/(((μD)^2) ((σD)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2)))4 (E^(-((2 x μD)/((σD)^2)))) nD (nH^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(1/((-1+nD) ((σD)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2)))8 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (nH^2) ((Erfc[-((2 Log[x]-2 Log[μH]+Log[1+(((σH)^2)/((μH)^2))])/(2 (Sqrt[2]) (Sqrt[Log[1+(((σH)^2)/((μH)^2))]])))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-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]]
npvgg[x_,r_,μD_,μH_,σD_,σH_]:=((-1+r) GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])/(-r GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]+(-1+r) GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])
npvgg[x_,nD_,nH_,μD_,μH_,σD_,σH_]:=((nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])/(nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]+nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))
unpvgg[x_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_]:=Switch[nl,0,√(((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(E^(-((2 x μD)/((σD)^2)))) (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) ((σD)^6) ((σH)^2) ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) (2 (b0^2) (-1+nH)+4 b0 b1 (-1+nH) x+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]+nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^4))),1,√(((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(E^(-((2 x μD)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) ((σD)^6) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2))/((-1+nD) (-1+nH) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) (((nD GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))]+nH GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))]))^4)))]

dfunpvgg[x_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_]:=Min[Max[Switch[nl,0,((((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(E^(-((2 x μD)/((σD)^2)))) (1-nD) nD (1-nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (1-nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) ((σD)^6) ((σH)^2) ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) (2 (b0^2) (-1+nH)+4 b0 b1 (-1+nH) x+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)/((((4+nD+nH))^4) ((1/((-2+nD+nH) (((4+nD+nH))^4)))((((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(E^(-((2 x μD)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) ((σD)^6) ((σH)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)+(1/(-1+nU))(nD^2) (nH^2) ((((E^(-((2 x μD)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)-(E^(-((2 x μD)/((σD)^2)))) (1-nD) (1-nH) nH ((μH)^2) ((σD)^2) (nD (((b0+b1 x))^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) nD (-1+nH) nH ((μD)^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)-2 (E^(-((2 x μD)/((σD)^2)))) nD (1-nH) nH ((μD)^2) ((μH)^2) (-2 (-1+nD) (((b0+b1 x))^2)-((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) ((μD)^2) ((σD)^6) ((σH)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-(E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) ((μD)^2) ((σD)^6) ((σH)^2) ((b0^2) nH+2 b0 b1 nH x+(b1^2) nH (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD nH ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD nH ((μD)^2) ((μH)^2) ((σD)^6) (2 (b0^2) (-1+nH)+4 b0 b1 (-1+nH) x+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2))),1,-(((-2+nD+nH) (-1+nU) ((((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(E^(-((2 x μD)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) ((σD)^6) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2))/((1-nU) ((((-1+nD) (2+nD) (-1+nH) (2+nH) (((nD+nH))^3) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^6) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2)+(E^(-((2 x μD)/((σD)^2)))) (-1+nD) nD (-1+nH) (nH^2) (((4+nD+nH))^2) ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) (nD^2) (-1+nH) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (-1+nH) nH (((4+nD+nH))^2) ((μD)^2) ((σD)^6) ((σH)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) (nD^2) (nH^2) (((4+nD+nH))^2) ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)))^2)+(nD^2) (2-nD-nH) (nH^2) (((4+nD+nH))^4) ((((E^(-((2 x μD)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^4) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)-(E^(-((2 x μD)/((σD)^2)))) (-1+nD) (-1+nH) nH ((μH)^2) ((σD)^2) ((b0^2) nD+(b1^2) nD (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) ((((((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)-2 (E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]-2 (E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+2 (E^(-((2 x μD)/((σD)^2)))) nD (-1+nH) nH ((μD)^2) ((μH)^2) ((σD)^2) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)-2 (E^(-((2 x μD)/((σD)^2)))) nD (-1+nH) nH ((μD)^2) ((μH)^2) (2 (b0^2) (-1+nD)+2 (b1^2) (-1+nD) (x^2)+((σD)^2)) ((σH)^6) ((Gamma[(((μH)^2)/((σH)^2))])^2) ((GammaRegularized[(((μH)^2)/((σH)^2)),0,((x μH)/((σH)^2))])^2) (((-(((((x μD)/((σD)^2))))^(((μD)^2)/((σD)^2))) ((σD)^2)+(E^((x μD)/((σD)^2))) ((μD)^2) MeijerG[{{},{1,1}},{{0,0,(((μD)^2)/((σD)^2))},{}},((x μD)/((σD)^2))]+(E^((x μD)/((σD)^2))) ((μD)^2) Gamma[(((μD)^2)/((σD)^2))] GammaRegularized[(((μD)^2)/((σD)^2)),((x μD)/((σD)^2))] (Log[((x μD)/((σD)^2))]-PolyGamma[0,(((μD)^2)/((σD)^2))])))^2)+(E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) ((μD)^2) ((σD)^6) ((σH)^4) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-(E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD (-1+nH) ((μD)^2) ((σD)^6) ((σH)^2) ((b0^2) nH+(b1^2) nH (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) ((((((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)-2 (E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]-2 (E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)+2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD nH ((μD)^2) ((μH)^2) ((σD)^6) ((σH)^2) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-PolyGamma[0,(((μH)^2)/((σH)^2))])))^2)-2 (E^(-((2 x μH)/((σH)^2)))) (-1+nD) nD nH ((μD)^2) ((μH)^2) ((σD)^6) (2 (b0^2) (-1+nH)+2 (b1^2) (-1+nH) (x^2)+((σH)^2)) ((Gamma[(((μD)^2)/((σD)^2))])^2) ((GammaRegularized[(((μD)^2)/((σD)^2)),0,((x μD)/((σD)^2))])^2) (((-(((((x μH)/((σH)^2))))^(((μH)^2)/((σH)^2))) ((σH)^2)+(E^((x μH)/((σH)^2))) ((μH)^2) MeijerG[{{},{1,1}},{{0,0,(((μH)^2)/((σH)^2))},{}},((x μH)/((σH)^2))]+(E^((x μH)/((σH)^2))) ((μH)^2) Gamma[(((μH)^2)/((σH)^2))] GammaRegularized[(((μH)^2)/((σH)^2)),((x μH)/((σH)^2))] (Log[((x μH)/((σH)^2))]-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[dm_,dD_,dH_]:=Switch[dm,"bpd",Switch[dD,
"normal",
Switch[dH,"normal",bpdnn,"lognormal",bpdnl,"gamma",bpdng],
"lognormal",
Switch[dH,"normal",bpdln,"lognormal",bpdll,"gamma",bpdlg],
"gamma",
Switch[dH,"normal",bpdgn,"lognormal",bpdgl,"gamma",bpdgg]],"bpn",Switch[dD,
"normal",
Switch[dH,"normal",bpnnn,"lognormal",bpnnl,"gamma",bpnng],
"lognormal",
Switch[dH,"normal",bpnln,"lognormal",bpnll,"gamma",bpnlg],
"gamma",
Switch[dH,"normal",bpngn,"lognormal",bpngl,"gamma",bpngg]],"ppv",Switch[dD,
"normal",
Switch[dH,"normal",ppvnn,"lognormal",ppvnl,"gamma",ppvng],
"lognormal",
Switch[dH,"normal",ppvln,"lognormal",ppvll,"gamma",ppvlg],
"gamma",
Switch[dH,"normal",ppvgn,"lognormal",ppvgl,"gamma",ppvgg]],"npv",Switch[dD,
"normal",
Switch[dH,"normal",npvnn,"lognormal",npvnl,"gamma",npvng],
"lognormal",
Switch[dH,"normal",npvln,"lognormal",npvll,"gamma",npvlg],
"gamma",
Switch[dH,"normal",npvgn,"lognormal",npvgl,"gamma",npvgg]]]
c[dm_,dD_,dH_]:=Switch[dm,"bpd",Switch[dD,
"normal",
Switch[dH,"normal",ubpdnn,"lognormal",ubpdnl,"gamma",ubpdng],
"lognormal",
Switch[dH,"normal",ubpdln,"lognormal",ubpdll,"gamma",ubpdlg],
"gamma",
Switch[dH,"normal",ubpdgn,"lognormal",ubpdgl,"gamma",ubpdgg]],"bpn",Switch[dD,
"normal",
Switch[dH,"normal",ubpnnn,"lognormal",ubpnnl,"gamma",ubpnng],
"lognormal",
Switch[dH,"normal",ubpnln,"lognormal",ubpnll,"gamma",ubpnlg],
"gamma",
Switch[dH,"normal",ubpnng,"lognormal",ubpngl,"gamma",ubpngg]],"ppv",Switch[dD,
"normal",
Switch[dH,"normal",uppvnn,"lognormal",uppvnl,"gamma",uppvng],
"lognormal",
Switch[dH,"normal",uppvln,"lognormal",uppvll,"gamma",uppvlg],
"gamma",
Switch[dH,"normal",uppvgn,"lognormal",uppvgl,"gamma",uppvgg]],"npv",Switch[dD,
"normal",
Switch[dH,"normal",unpvnn,"lognormal",unpvnl,"gamma",unpvng],
"lognormal",
Switch[dH,"normal",unpvln,"lognormal",unpvll,"gamma",unpvlg],
"gamma",
Switch[dH,"normal",unpvgn,"lognormal",unpvgl,"gamma",unpvgg]]]
df[dm_,dD_,dH_]:=Switch[dm,"bpd",Switch[dD,
"normal",
Switch[dH,"normal",dfubpdnn,"lognormal",dfubpdnl,"gamma",dfubpdng],
"lognormal",
Switch[dH,"normal",dfubpdln,"lognormal",dfubpdll,"gamma",dfubpdlg],
"gamma",
Switch[dH,"normal",dfubpdgn,"lognormal",dfubpdgl,"gamma",dfubpdgg]],"bpn",Switch[dD,
"normal",
Switch[dH,"normal",dfubpnnn,"lognormal",dfubpnnl,"gamma",dfubpnng],
"lognormal",
Switch[dH,"normal",dfubpnln,"lognormal",dfubpnll,"gamma",dfubpnlg],
"gamma",
Switch[dH,"normal",dfubpngn,"lognormal",dfubpngl,"gamma",dfubpngg]],"ppv",Switch[dD,
"normal",
Switch[dH,"normal",dfuppvnn,"lognormal",dfuppvnl,"gamma",dfuppvng],
"lognormal",
Switch[dH,"normal",dfuppvln,"lognormal",dfuppvll,"gamma",dfuppvlg],
"gamma",
Switch[dH,"normal",dfuppvgn,"lognormal",dfuppvgl,"gamma",dfuppvgg]],"npv",Switch[dD,
"normal",
Switch[dH,"normal",dfunpvnn,"lognormal",dfunpvnl,"gamma",dfunpvng],
"lognormal",
Switch[dH,"normal",dfunpvln,"lognormal",dfunpvll,"gamma",dfunpvlg],
"gamma",
Switch[dH,"normal",dfunpvgn,"lognormal",dfunpvgl,"gamma",dfunpvgg]]]
txt[dm_]:=Switch[dm,"bpd","P(D|T=t)","bpn","P((OverBar[D])|T=t)","ppv","P(D|T⩾t)","npv","P((OverBar[D])|T<t)"]
lb[pr_,μD_,μH_,σD_,σH_]:=Switch[pr,True,Floor[Max[Min[μH-5σH,μD-5σD],0]],False,Floor[Max[Min[μH-2σH,μD-2σD],0]]]
ub[pr_,μD_,μH_,σD_,σH_]:=Switch[pr,True,Ceiling[Max[μH+5σH,μD+5σD]],False,Ceiling[Max[μH+2σH,μD+2σD]]]
pro[pr_]:=Switch[pr,True,SetOptions[Plot,PlotRange->Full],False,SetOptions[Plot,PlotRange->Automatic]]
dp[t_,r_,μD_,μH_,σD_,σH_,dm_,dD_,dH_]:=Check[Block[{fd},fd=d[dm,dD,dH]@@{t,r,μD,μH,σD,σH};
If[fd>0&&fd<=1,fd,Indeterminate]],Indeterminate]
dp[t_,nD_,nH_,μD_,μH_,σD_,σH_,dm_,dD_,dH_]:=Check[Block[{fd},fd=d[dm,dD,dH]@@{t,nD,nH,μD,μH,σD,σH};
If[fd>0&&fd<=1,fd,Indeterminate]],Indeterminate]
rdp[t_,nD_,nH_,μD_,μH_,σD_,σH_,st_,dD_,dH_]:=Quiet[Block[{fd,fdb},Switch[st,0,fd=d["npv",dD,dH]@@{t,nD,nH,μD,μH,σD,σH};fdb=d["bpn",dD,dH]@@{t,nD,nH,μD,μH,σD,σH},1,fd=d["ppv",dD,dH]@@{t,nD,nH,μD,μH,σD,σH};fdb=d["bpd",dD,dH]@@{t,nD,nH,μD,μH,σD,σH}];
If[fd>=0&&fd<=1&&fdb>0&&fdb<=1,fd/fdb,Indeterminate]]]
rdp[t_,r_,μD_,μH_,σD_,σH_,st_,dD_,dH_]:=Check[Block[{fd,fdb},Switch[st,0,fd=d["npv",dD,dH]@@{t,r,μD,μH,σD,σH};fdb=d["bpn",dD,dH]@@{t,r,μD,μH,σD,σH},1,fd=d["ppv",dD,dH]@@{t,r,μD,μH,σD,σH};fdb=d["bpd",dD,dH]@@{t,r,μD,μH,σD,σH}];
If[fd>=0&&fd<=1&&fdb>0&&fdb<=1,fd/fdb,Indeterminate]],Indeterminate]
dpu[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dm_,dD_,dH_]:=Check[Block[{fc=c[dm,dD,dH]@@{t,nD,nH,μD,μH,σD,σH,b0,b1,nl},fc0=c[dm,dD,dH]@@{t,nD,nH,μD,μH,σD,σH,0,0,nl}},If[fc∈Reals&&fc>=0 &&fc<=1&&fc0∈Reals&&fc0>=0 &&fc0<=fc,{fc,(Sqrt[(fc^2)-(fc0^2)]),fc0},{Indeterminate,Indeterminate,Indeterminate}]],{Indeterminate,Indeterminate,Indeterminate}]
dpru[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dm_,dD_,dH_]:=Check[Block[{fd=d[dm,dD,dH]@@{t,nD,nH,μD,μH,σD,σH},fc=c[dm,dD,dH]@@{t,nD,nH,μD,μH,σD,σH,b0,b1,nl},fc0=c[dm,dD,dH]@@{t,nD,nH,μD,μH,σD,σH,0,0,nl}},If[fd>0&&fd<=1&&fc∈Reals&&fc>=0 &&fc<1&&fc0∈Reals&&fc0>=0 &&fc0<=fc,{fc/fd,(Sqrt[(fc^2)-(fc0^2)])/fd,fc0/fd},{Indeterminate,Indeterminate,Indeterminate}]],{Indeterminate,Indeterminate,Indeterminate}]
dpci[t_,p_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_,dm_,dD_,dH_]:=Check[Block[{fd=d[dm,dD,dH]@@{t,nD,nH,μD,μH,σD,σH},fc=c[dm,dD,dH]@@{t,nD,nH,μD,μH,σD,σH,b0,b1,nl},fdf=df[dm,dD,dH]@@{t,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl},ul,stci},
stci=If[fd>0&&fd<=1&&fc∈Reals&&fc>=0&&fc<1&&fdf∈Reals,StudentTCI[fd,fc,fdf,ConfidenceLevel->p],{Indeterminate,Indeterminate,Indeterminate}];If[fd>0&&fd<=1,
{Max[stci[[1]],0],fd,Min[stci[[2]],1.0]},{Indeterminate,Indeterminate,Indeterminate}]],{Indeterminate,Indeterminate,Indeterminate}]
pcdp[r_,μD_,μH_,σD_,σH_,st_,dD_,dH_,pr_]:=Quiet[Switch[st,0,Text@Labeled[Plot[{dp[t,r,μD,μH,σD,σH,"npv",dD,dH],dp[t,r,μD,μH,σD,σH,"bpn",dD,dH]},{t,lb[pr,μD,μH,σD,σH],ub[pr,μD,μH,σD,σH]},AxesOrigin->{lb[pr,μD,μH,σD,σH],0},FrameLabel->{"t","p"},PlotRange->{{0,1}},Exclusions->"Singularities",PlotTheme->"Scientific",Filling->Axis,PlotLegends->Placed[{"P((OverBar[D])|T<t)","P((OverBar[D])|T=t)"},Right],PlotHighlighting->"Dropline",ImageSize->{600}],"P((OverBar[D])|T<t) and P((OverBar[D])|T=t) vs measurement value t",Top],1, Text@Labeled[Plot[{dp[t,r,μD,μH,σD,σH,"ppv",dD,dH],dp[t,r,μD,μH,σD,σH,"bpd",dD,dH]},{t,lb[pr,μD,μH,σD,σH],ub[pr,μD,μH,σD,σH]},AxesOrigin->{lb[pr,μD,μH,σD,σH],0},FrameLabel->{"t","p"},PlotRange->{{0,1}},Exclusions->"Singularities",PlotTheme->"Scientific",Filling->Axis,PlotLegends->Placed[{"P(D|T⩾t)","P(D|T=t)"},Right],PlotHighlighting->"Dropline",ImageSize->{600}],"P(D|T⩾t) and P(D|T=t) vs measurement value t",Top]]]
pcdpr[t_,μD_,μH_,σD_,σH_,st_,dD_,dH_,pr_]:=Quiet[Switch[st,0,Text@Labeled[Plot[{dp[t,r,μD,μH,σD,σH,"npv",dD,dH],dp[t,r,μD,μH,σD,σH,"bpn",dD,dH]},{r,0.001,Switch[pr,True,0.999,False,0.20]},AxesOrigin->{0,0},FrameLabel->{"v","p"},PlotRange->{{0,1}},Exclusions->"Singularities",PlotTheme->"Scientific",Filling->Axis,PlotLegends->Placed[{"P((OverBar[D])|T<t)","P((OverBar[D])|T=t)"},Right],ImageSize->{600}],"P((OverBar[D])|T<t) and P((OverBar[D])|T=t) vs prevalence of disease v",Top],1, Text@Labeled[Plot[{dp[t,r,μD,μH,σD,σH,"ppv",dD,dH],dp[t,r,μD,μH,σD,σH,"bpd",dD,dH]},{r,0.001,Switch[pr,True,0.999,False,0.20]},AxesOrigin->{0,0},FrameLabel->{"v","p"},PlotRange->{{0,1}},Exclusions->"Singularities",PlotTheme->"Scientific",Filling->Axis,PlotLegends->Placed[{"P(D|T⩾t)","P(D|T=t)"},Right],PlotHighlighting->"Dropline",ImageSize->{600}],"P(D|T⩾t) and P(D|T=t) vs prevalence of disease v",Top]]]
prcdp[r_,μD_,μH_,σD_,σH_,st_,dD_,dH_,pr_]:=Quiet[Switch[st,0,Text@Labeled[Plot[dp[t,r,μD,μH,σD,σH,"npv",dD,dH]/dp[t,r,μD,μH,σD,σH,"bpn",dD,dH],{t,lb[pr,μD,μH,σD,σH],ub[pr,μD,μH,σD,σH]},AxesOrigin->{lb[pr,μD,μH,σD,σH],0},FrameLabel->{"t","P((OverBar[D])|T<t)/P((OverBar[D])|T=t)"},PlotRange->All,Exclusions->"Singularities",PlotTheme->"Scientific",Filling->Axis,PlotHighlighting->"Dropline",ImageSize->{600}],"P((OverBar[D])|T<t)/P((OverBar[D])|T=t) vs measurement value t",Top],1, Text@Labeled[Plot[{dp[t,r,μD,μH,σD,σH,"ppv",dD,dH]/dp[t,r,μD,μH,σD,σH,"bpd",dD,dH]},{t,lb[pr,μD,μH,σD,σH],ub[pr,μD,μH,σD,σH]},AxesOrigin->{lb[pr,μD,μH,σD,σH],0},FrameLabel->{"t","P(D|T⩾t)/P(D|T=t)"},PlotRange->All,Exclusions->"Singularities",PlotTheme->"Scientific",Filling->Axis,PlotHighlighting->"Dropline",ImageSize->{600}],"P(D|T⩾t)/P(D|T=t) vs measurement value t",Top]]]
prcdpr[t_,μD_,μH_,σD_,σH_,st_,dD_,dH_,pr_]:=Quiet[Switch[st,0,Text@Labeled[Plot[dp[t,r,μD,μH,σD,σH,"npv",dD,dH]/dp[t,r,μD,μH,σD,σH,"bpn",dD,dH],{r,0.001,Switch[pr,True,0.999,False,0.20]},AxesOrigin->{0,0},FrameLabel->{"v","P((OverBar[D])|T<t)/P((OverBar[D])|T=t)"},PlotRange->All,Exclusions->"Singularities",PlotTheme->"Scientific",Filling->Axis,PlotHighlighting->"Dropline",ImageSize->{600}],"P((OverBar[D])|T<t)/P((OverBar[D])|T=t) vs prevalence of disease v",Top],1, Text@Labeled[Plot[{dp[t,r,μD,μH,σD,σH,"ppv",dD,dH]/dp[t,r,μD,μH,σD,σH,"bpd",dD,dH]},{r,0.001,Switch[pr,True,0.999,False,0.20]},AxesOrigin->{600},FrameLabel->{"v","P(D|T⩾t)/P(D|T=t)"},PlotRange->All,Exclusions->"Singularities",PlotTheme->"Scientific",Filling->Axis,PlotHighlighting->"Dropline",ImageSize->{600}],"P(D|T⩾t)/P(D|T=t) vs prevalence of disease v",Top]]]
pcdpu[nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[1]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[2]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[3]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[1]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[2]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",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},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"t","u"},PlotLegends->Placed[{"(Subscript[u, c])[P((OverBar[D])|T<t)]","(Subscript[u, m])[P((OverBar[D])|T<t)]","(Subscript[u, s])[P((OverBar[D])|T<t)]","(Subscript[u, c])[P((OverBar[D])|T=t)]","(Subscript[u, m])[P((OverBar[D])|T=t)]","(Subscript[u, s])[P((OverBar[D])|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"standard uncertainty vs measurement value t"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[1]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[2]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[3]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[1]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[2]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",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}, PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"t","u"},PlotLegends->Placed[{"(Subscript[u, c])[P(D|T⩾t)]","(Subscript[u, m])[P(D|T⩾t)]","(Subscript[u, s])[P(D|T⩾t)]","(Subscript[u, c])[P(D|T=t)]","(Subscript[u, m])[P(D|T=t)]","(Subscript[u, s])[P(D|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"standard uncertainty vs measurement value t"},Center],Top]]
pcdpru[nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[1]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[2]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[3]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[1]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[2]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",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},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"t","u(p)/p"},PlotLegends->Placed[{"(Subscript[u, c])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, m])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, s])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, c])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)","(Subscript[u, m])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)","(Subscript[u, s])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"relative standard uncertainty vs measurement value t"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[1]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[2]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[3]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[1]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[2]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",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}, PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"t","u(p)/p"},PlotLegends->Placed[{"(Subscript[u, c])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, m])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, s])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, c])[P(D|T=t)]/P(D|T=t)","(Subscript[u, m])[P(D|T=t)]/P(D|T=t)","(Subscript[u, s])[P(D|T=t)]/P(D|T=t)"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"relative standard uncertainty vs measurement value t"},Center],Top]]
pcdpci[p_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[1]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[2]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[3]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[1]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[2]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpn",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},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{{Dashing[{Large,Small}],Orange,Thickness[0.002]},{Dashing[{}],Orange},{Dashing[{Medium,Small}],Orange,Thickness[0.002]},{Dashing[{Large,Small}],Lighter[Blue,0.5],Thickness[0.002]},{Dashing[{}],Lighter[Blue,0.5]},{Dashing[{Medium,Small}],Lighter[Blue,0.5],Thickness[0.002]}},Filling->{1->{{2},Opacity[0.5,Lighter[Orange,0.5]]},2->{{3},Opacity[0.5,Lighter[Orange,0.5]]},4->{{5},Opacity[0.5,Lighter[Blue,0.5]]},5->{{6},Opacity[0.5,Lighter[Blue,0.5]]}},FrameLabel->{"t","p"},PlotLegends->Placed[{"inf[P((OverBar[D])|T<t)]","P((OverBar[D])|T<t)","sup[P((OverBar[D])|T<t)]","inf[P((OverBar[D])|T=t)]","P((OverBar[D])|T=t)","sup[P((OverBar[D])|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{ToString[NumberForm[N[100 p],{4,2}]]<>" % confidence intervals of P((OverBar[D])|T<t) and P((OverBar[D])|T=t) vs measurement value t"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[1]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[2]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[3]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[1]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[2]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpd",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}, PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{{Dashing[{Large,Small}],Orange,Thickness[0.002]},{Dashing[{}],Orange},{Dashing[{Medium,Small}],Orange,Thickness[0.002]},{Dashing[{Large,Small}],Lighter[Blue,0.5],Thickness[0.002]},{Dashing[{}],Lighter[Blue,0.5]},{Dashing[{Medium,Small}],Lighter[Blue,0.5],Thickness[0.002]}},Filling->{1->{{2},Opacity[0.5,Lighter[Orange,0.5]]},2->{{3},Opacity[0.5,Lighter[Orange,0.5]]},4->{{5},Opacity[0.5,Lighter[Blue,0.5]]},5->{{6},Opacity[0.5,Lighter[Blue,0.5]]}},FrameLabel->{"t","p"},PlotLegends->Placed[{"inf[P(D|T⩾t)]","P(D|T⩾t)","sup[P(D|T⩾t)]","inf[P(D|T=t)]","P(D|T=t)","sup[P(D|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{ToString[NumberForm[N[100 p],{4,2}]]<>" % confidence intervals of P(D|T⩾t) and P(D|T=t) vs measurement value t"},Center],Top]]
pcdpub0[t_,nD_,nH_,μD_,μH_,σD_,σH_,b1_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[1]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[2]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[3]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[1]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[2]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[3]]},{b0,0,Switch[pr,True,0.5σH,False,0.15 σH]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"(Subscript[b, 0])","u"},PlotLegends->Placed[{"(Subscript[u, c])[P((OverBar[D])|T<t)]","(Subscript[u, m])[P((OverBar[D])|T<t)]","(Subscript[u, s])[P((OverBar[D])|T<t)]","(Subscript[u, c])[P((OverBar[D])|T=t)]","(Subscript[u, m])[P((OverBar[D])|T=t)]","(Subscript[u, s])[P((OverBar[D])|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"standard uncertainty vs constant contribution (Subscript[b, 0]) to measurement uncertainty"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[1]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[2]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[3]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[1]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[2]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[3]]},{b0,0,Switch[pr,True,0.5σH,False,0.15 σH]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"(Subscript[b, 0])","u"},PlotLegends->Placed[{"(Subscript[u, c])[P(D|T⩾t)]","(Subscript[u, m])[P(D|T⩾t)]","(Subscript[u, s])[P(D|T⩾t)]","(Subscript[u, c])[P(D|T=t)]","(Subscript[u, m])[P(D|T=t)]","(Subscript[u, s])[P(D|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"standard uncertainty vs constant contribution (Subscript[b, 0]) to measurement uncertainty"},Center],Top]]
pcdprub0[t_,nD_,nH_,μD_,μH_,σD_,σH_,b1_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[1]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[2]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[3]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[1]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[2]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[3]]},{b0,0,Switch[pr,True,0.5σH,False,0.15 σH]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"(Subscript[b, 0])","u(p)/p"},PlotLegends->Placed[{"(Subscript[u, c])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, m])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, s])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, c])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)","(Subscript[u, m])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)","(Subscript[u, s])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"relative standard uncertainty vs constant contribution (Subscript[b, 0]) to measurement uncertainty"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[1]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[2]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[3]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[1]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[2]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[3]]},{b0,0,Switch[pr,True,0.5σH,False,0.15 σH]},Exclusions->"Singularities", AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"(Subscript[b, 0])","u(p)/p"},PlotLegends->Placed[{"(Subscript[u, c])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, m])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, s])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, c])[P(D|T=t)]/P(D|T=t)","(Subscript[u, m])[P(D|T=t)]/P(D|T=t)","(Subscript[u, s])[P(D|T=t)]/P(D|T=t)"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"relative standard uncertainty vs constant contribution (Subscript[b, 0]) to measurement uncertainty"},Center],Top]]
pcdpcib0[t_,p_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b1_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[1]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[2]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[3]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[1]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[2]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[3]]},{b0,0,Switch[pr,True,0.5σH,False,0.15 σH]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{{Dashing[{Large,Small}],Orange,Thickness[0.002]},{Dashing[{}],Orange},{Dashing[{Medium,Small}],Orange,Thickness[0.002]},{Dashing[{Large,Small}],Lighter[Blue,0.5],Thickness[0.002]},{Dashing[{}],Lighter[Blue,0.5]},{Dashing[{Medium,Small}],Lighter[Blue,0.5],Thickness[0.002]}},Filling->{1->{{2},Opacity[0.5,Lighter[Orange,0.5]]},2->{{3},Opacity[0.5,Lighter[Orange,0.5]]},4->{{5},Opacity[0.5,Lighter[Blue,0.5]]},5->{{6},Opacity[0.5,Lighter[Blue,0.5]]}},FrameLabel->{"(Subscript[b, 0])","p"},PlotLegends->Placed[{"inf[P((OverBar[D])|T<t)]","P((OverBar[D])|T<t)","sup[P((OverBar[D])|T<t)]","inf[P((OverBar[D])|T=t)]","P((OverBar[D])|T=t)","sup[P((OverBar[D])|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{ToString[NumberForm[N[100 p],{4,2}]]<>" % confidence intervals of P((OverBar[D])|T=t) and P((OverBar[D])|T<t) vs constant contribution (Subscript[b, 0]) to measurement uncertainty"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[1]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[2]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[3]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[1]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[2]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[3]]},{b0,0,Switch[pr,True,0.5σH,False,0.15 σH]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{{Dashing[{Large,Small}],Orange,Thickness[0.002]},{Dashing[{}],Orange},{Dashing[{Medium,Small}],Orange,Thickness[0.002]},{Dashing[{Large,Small}],Lighter[Blue,0.5],Thickness[0.002]},{Dashing[{}],Lighter[Blue,0.5]},{Dashing[{Medium,Small}],Lighter[Blue,0.5],Thickness[0.002]}},Filling->{1->{{2},Opacity[0.5,Lighter[Orange,0.5]]},2->{{3},Opacity[0.5,Lighter[Orange,0.5]]},4->{{5},Opacity[0.5,Lighter[Blue,0.5]]},5->{{6},Opacity[0.5,Lighter[Blue,0.5]]}},FrameLabel->{"(Subscript[b, 0])","p"},PlotLegends->Placed[{"inf[P(D|T⩾t)]","P(D|T⩾t)","sup[P(D|T⩾t)]","inf[P(D|T=t)]","P(D|T=t)","sup[P(D|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{ToString[NumberForm[N[100 p],{4,2}]]<>" % confidence intervals of P(D|T⩾t) and P(D|T=t) vs constant contribution (Subscript[b, 0]) to measurement uncertainty"},Center],Top]]
pcdpub1[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[1]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[2]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[3]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[1]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[2]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[3]]},{b1,0,Switch[pr,True,0.05,False,0.01 ]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"(Subscript[b, 1])","u"},PlotLegends->Placed[{"(Subscript[u, c])[P((OverBar[D])|T<t)]","(Subscript[u, m])[P((OverBar[D])|T<t)]","(Subscript[u, s])[P((OverBar[D])|T<t)]","(Subscript[u, c])[P((OverBar[D])|T=t)]","(Subscript[u, m])[P((OverBar[D])|T=t)]","(Subscript[u, s])[P((OverBar[D])|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"standard uncertainty vs measurement uncertainty proportionality constant (Subscript[b, 1])"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[1]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[2]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[3]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[1]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[2]],dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[3]]},{b1,0,Switch[pr,True,0.05,False,0.01 ]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"(Subscript[b, 1])","u"},PlotLegends->Placed[{"(Subscript[u, c])[P(D|T⩾t)]","(Subscript[u, m])[P(D|T⩾t)]","(Subscript[u, s])[P(D|T⩾t)]","(Subscript[u, c])[P(D|T=t)]","(Subscript[u, m])[P(D|T=t)]","(Subscript[u, s])[P(D|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"standard uncertainty vs measurement uncertainty proportionality constant (Subscript[b, 1])"},Center],Top]]
pcdprub1[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[1]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[2]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[3]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[1]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[2]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[3]]},{b1,0,Switch[pr,True,0.05,False,0.01 ]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"(Subscript[b, 1])","u(p)/p"},PlotLegends->Placed[{"(Subscript[u, c])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, m])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, s])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, c])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)","(Subscript[u, m])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)","(Subscript[u, s])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"relative standard uncertainty vs measurement uncertainty proportionality constant (Subscript[b, 1])"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[1]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[2]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[3]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[1]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[2]],dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[3]]},{b1,0,Switch[pr,True,0.05,False,0.01 ]},Exclusions->"Singularities", AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"(Subscript[b, 1])","u(p)/p"},PlotLegends->Placed[{"(Subscript[u, c])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, m])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, s])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, c])[P(D|T=t)]/P(D|T=t)","(Subscript[u, m])[P(D|T=t)]/P(D|T=t)","(Subscript[u, s])[P(D|T=t)]/P(D|T=t)"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"relative standard uncertainty vs measurement uncertainty proportionality constant (Subscript[b, 1])"},Center],Top]]
pcdpcib1[t_,p_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[1]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[2]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[3]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[1]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[2]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[3]]},{b1,0,Switch[pr,True,0.05,False,0.01 ]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{{Dashing[{Large,Small}],Orange,Thickness[0.002]},{Dashing[{}],Orange},{Dashing[{Medium,Small}],Orange,Thickness[0.002]},{Dashing[{Large,Small}],Lighter[Blue,0.5],Thickness[0.002]},{Dashing[{}],Lighter[Blue,0.5]},{Dashing[{Medium,Small}],Lighter[Blue,0.5],Thickness[0.002]}},Filling->{1->{{2},Opacity[0.5,Lighter[Orange,0.5]]},2->{{3},Opacity[0.5,Lighter[Orange,0.5]]},4->{{5},Opacity[0.5,Lighter[Blue,0.5]]},5->{{6},Opacity[0.5,Lighter[Blue,0.5]]}},FrameLabel->{"(Subscript[b, 1])","p"},PlotLegends->Placed[{"inf[P((OverBar[D])|T<t)]","P((OverBar[D])|T<t)","sup[P((OverBar[D])|T<t)]","inf[P((OverBar[D])|T=t)]","P((OverBar[D])|T=t)","sup[P((OverBar[D])|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{ToString[NumberForm[N[100 p],{4,2}]]<>" % confidence intervals of P((OverBar[D])|T=t) and P((OverBar[D])|T<t) vs measurement uncertainty proportionality constant (Subscript[b, 1])"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[1]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[2]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[3]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[1]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[2]],dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[3]]},{b1,0,Switch[pr,True,0.05,False,0.01 ]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{{Dashing[{Large,Small}],Orange,Thickness[0.002]},{Dashing[{}],Orange},{Dashing[{Medium,Small}],Orange,Thickness[0.002]},{Dashing[{Large,Small}],Lighter[Blue,0.5],Thickness[0.002]},{Dashing[{}],Lighter[Blue,0.5]},{Dashing[{Medium,Small}],Lighter[Blue,0.5],Thickness[0.002]}},Filling->{1->{{2},Opacity[0.5,Lighter[Orange,0.5]]},2->{{3},Opacity[0.5,Lighter[Orange,0.5]]},4->{{5},Opacity[0.5,Lighter[Blue,0.5]]},5->{{6},Opacity[0.5,Lighter[Blue,0.5]]}},FrameLabel->{"(Subscript[b, 1])","p"},PlotLegends->Placed[{"inf[P(D|T⩾t)]","P(D|T⩾t)","sup[P(D|T⩾t)]","inf[P(D|T=t)]","P(D|T=t)","sup[P(D|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{ToString[NumberForm[N[100 p],{4,2}]]<>" % confidence intervals of P(D|T⩾t) and P(D|T=t) vs measurement uncertainty proportionality constant (Subscript[b, 1])"},Center],Top]]
pcdpun[t_,r_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[1]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[2]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[3]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[1]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[2]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpn",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)],20000],False,Max[5Ceiling[2/r],5Ceiling[2/(1-r)],2000]]},Exclusions->"Singularities",AxesOrigin->{Max[Ceiling[2/r],Ceiling[2/(1-r)],20],0},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"n","u"},PlotLegends->Placed[{"(Subscript[u, c])[P((OverBar[D])|T<t)]","(Subscript[u, m])[P((OverBar[D])|T<t)]","(Subscript[u, s])[P((OverBar[D])|T<t)]","(Subscript[u, c])[P((OverBar[D])|T=t)]","(Subscript[u, m])[P((OverBar[D])|T=t)]","(Subscript[u, s])[P((OverBar[D])|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"standard uncertainty vs total population sample size n"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[1]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[2]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[3]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[1]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[2]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpd",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)],20000],False,Max[5Ceiling[2/r],5Ceiling[2/(1-r)],2000]]},Exclusions->"Singularities",AxesOrigin->{Max[Ceiling[2/r],Ceiling[2/(1-r)],20],0},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"n","u"},PlotLegends->Placed[{"(Subscript[u, c])[P(D|T⩾t)]","(Subscript[u, m])[P(D|T⩾t)]","(Subscript[u, s])[P(D|T⩾t)]","(Subscript[u, c])[P(D|T=t)]","(Subscript[u, m])[P(D|T=t)]","(Subscript[u, s])[P(D|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"standard uncertainty vs total population sample size n"},Center],Top]]
pcdprun[t_,r_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[1]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[2]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[3]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[1]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[2]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpn",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)],20000],False,Max[5Ceiling[2/r],5Ceiling[2/(1-r)],2000]]},Exclusions->"Singularities",AxesOrigin->{Max[Ceiling[2/r],Ceiling[2/(1-r)],20],0},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"n","u(p)/p"},PlotLegends->Placed[{"(Subscript[u, c])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, m])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, s])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, c])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)","(Subscript[u, m])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)","(Subscript[u, s])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"relative standard uncertainty vs total population sample size n"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[1]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[2]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[3]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[1]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[2]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpd",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)],20000],False,Max[5Ceiling[2/r],5Ceiling[2/(1-r)],2000]]},Exclusions->"Singularities",AxesOrigin->{Max[Ceiling[2/r],Ceiling[2/(1-r)],20],0},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"n","u(p)/p"},PlotLegends->Placed[{"(Subscript[u, c])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, m])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, s])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, c])[P(D|T=t)]/P(D|T=t)","(Subscript[u, m])[P(D|T=t)]/P(D|T=t)","(Subscript[u, s])[P(D|T=t)]/P(D|T=t)"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"relative standard uncertainty vs total population sample size n"},Center],Top]]
pcdpcin[t_,p_,r_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[1]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[2]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[3]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[1]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[2]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"bpn",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)],20000],False,Max[5Ceiling[2/r],5Ceiling[2/(1-r)],2000]]},Exclusions->"Singularities",AxesOrigin->{Max[Ceiling[2/r],Ceiling[2/(1-r)],20],0},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{{Dashing[{Large,Small}],Orange,Thickness[0.002]},{Dashing[{}],Orange},{Dashing[{Medium,Small}],Orange,Thickness[0.002]},{Dashing[{Large,Small}],Lighter[Blue,0.5],Thickness[0.002]},{Dashing[{}],Lighter[Blue,0.5]},{Dashing[{Medium,Small}],Lighter[Blue,0.5],Thickness[0.002]}},Filling->{1->{{2},Opacity[0.5,Lighter[Orange,0.5]]},2->{{3},Opacity[0.5,Lighter[Orange,0.5]]},4->{{5},Opacity[0.5,Lighter[Blue,0.5]]},5->{{6},Opacity[0.5,Lighter[Blue,0.5]]}},FrameLabel->{"n","p"},PlotLegends->Placed[{"inf[P((OverBar[D])|T<t)]","P((OverBar[D])|T<t)","sup[P((OverBar[D])|T<t)]","inf[P((OverBar[D])|T=t)]","P((OverBar[D])|T=t)","sup[P((OverBar[D])|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{ToString[NumberForm[N[100 p],{4,2}]]<>" % confidence intervals of P((OverBar[D])|T<t) and P((OverBar[D])|T=t) vs total population sample size n"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[1]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[2]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[3]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[1]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[2]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"bpd",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)],20000],False,Max[5Ceiling[2/r],5Ceiling[2/(1-r)],2000]]},Exclusions->"Singularities",AxesOrigin->{Max[Ceiling[2/r],Ceiling[2/(1-r)],20],0},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{{Dashing[{Large,Small}],Orange,Thickness[0.002]},{Dashing[{}],Orange},{Dashing[{Medium,Small}],Orange,Thickness[0.002]},{Dashing[{Large,Small}],Lighter[Blue,0.5],Thickness[0.002]},{Dashing[{}],Lighter[Blue,0.5]},{Dashing[{Medium,Small}],Lighter[Blue,0.5],Thickness[0.002]}},Filling->{1->{{2},Opacity[0.5,Lighter[Orange,0.5]]},2->{{3},Opacity[0.5,Lighter[Orange,0.5]]},4->{{5},Opacity[0.5,Lighter[Blue,0.5]]},5->{{6},Opacity[0.5,Lighter[Blue,0.5]]}},FrameLabel->{"n","p"},PlotLegends->Placed[{"inf[P(D|T⩾t)]","P(D|T⩾t)","sup[P(D|T⩾t)]","inf[P(D|T=t)]","P(D|T=t)","sup[P(D|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{ToString[NumberForm[N[100 p],{4,2}]]<>" % confidence intervals of P(D|T⩾t) and P(D|T=t) vs total population sample size n"},Center],Top]]
pcdpur[t_,n_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[1]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[2]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[3]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[1]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[2]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[3]]},{r,0.001,Switch[pr,True,0.999,False,0.20]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"v","u"},PlotLegends->Placed[{"(Subscript[u, c])[P((OverBar[D])|T<t)]","(Subscript[u, m])[P((OverBar[D])|T<t)]","(Subscript[u, s])[P((OverBar[D])|T<t)]","(Subscript[u, c])[P((OverBar[D])|T=t)]","(Subscript[u, m])[P((OverBar[D])|T=t)]","(Subscript[u, s])[P((OverBar[D])|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"standard uncertainty vs prevalence of disease v"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[1]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[2]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[3]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[1]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[2]],dpu[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[3]]},{r,0.001,Switch[pr,True,0.999,False,0.20]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"v","u"},PlotLegends->Placed[{"(Subscript[u, c])[P(D|T⩾t)]","(Subscript[u, m])[P(D|T⩾t)]","(Subscript[u, s])[P(D|T⩾t)]","(Subscript[u, c])[P(D|T=t)]","(Subscript[u, m])[P(D|T=t)]","(Subscript[u, s])[P(D|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"standard uncertainty vs prevalence of disease v"},Center],Top]]
pcdprur[t_,n_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[1]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[2]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[3]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[1]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[2]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[3]]},{r,0.001,Switch[pr,True,0.999,False,0.20]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific", PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"v","u(p)/p"},PlotLegends->Placed[{"(Subscript[u, c])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, m])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, s])[P((OverBar[D])|T<t)]/P((OverBar[D])|T<t)","(Subscript[u, c])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)","(Subscript[u, m])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)","(Subscript[u, s])[P((OverBar[D])|T=t)]/P((OverBar[D])|T=t)"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"relative standard uncertainty vs prevalence of disease v"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[1]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[2]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[3]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[1]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[2]],dpru[t,n r, n(1-r), μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[3]]},{r,0.001,Switch[pr,True,0.999,False,0.20]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{ Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}], Dashing[{}],Dashing[{Large,Small}],Dashing[{Medium,Small}]},FrameLabel->{"v","u(p)/p"},PlotLegends->Placed[{"(Subscript[u, c])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, m])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, s])[P(D|T⩾t)]/P(D|T⩾t)","(Subscript[u, c])[P(D|T=t)]/P(D|T=t)","(Subscript[u, m])[P(D|T=t)]/P(D|T=t)","(Subscript[u, s])[P(D|T=t)]/P(D|T=t)"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{"relative standard uncertainty vs prevalence of disease v"},Center],Top]]
pcdpcir[t_,p_,n_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_,dst_,dD_,dH_,pr_]:=Switch[dst,0,Text@Labeled[Quiet[Plot[{dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[1]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[2]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[3]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[1]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[2]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[3]]},{r,0.001,Switch[pr,True,0.999,False,0.20]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{{Dashing[{Large,Small}],Orange,Thickness[0.002]},{Dashing[{}],Orange},{Dashing[{Medium,Small}],Orange,Thickness[0.002]},{Dashing[{Large,Small}],Lighter[Blue,0.5],Thickness[0.002]},{Dashing[{}],Lighter[Blue,0.5]},{Dashing[{Medium,Small}],Lighter[Blue,0.5],Thickness[0.002]}},Filling->{1->{{2},Opacity[0.5,Lighter[Orange,0.5]]},2->{{3},Opacity[0.5,Lighter[Orange,0.5]]},4->{{5},Opacity[0.5,Lighter[Blue,0.5]]},5->{{6},Opacity[0.5,Lighter[Blue,0.5]]}},FrameLabel->{"v","p"},PlotLegends->Placed[{"inf[P((OverBar[D])|T<t)]","P((OverBar[D])|T<t)","sup[P((OverBar[D])|T<t)]","inf[P((OverBar[D])|T=t)]","P((OverBar[D])|T=t)","sup[P((OverBar[D])|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{ToString[NumberForm[N[100 p],{4,2}]]<>" % confidence intervals of P((OverBar[D])|T=t) and P((OverBar[D])|T<t) vs prevalence of disease v"},Center],Top],1,Text@Labeled[Quiet[Plot[{dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[1]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[2]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[3]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[1]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[2]],dpci[t,p,n r, n(1-r),μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[3]]},{r,0.001,Switch[pr,True,0.999,False,0.20]},Exclusions->"Singularities",AxesOrigin->{0,0},PlotRange->Full,PlotTheme->"Scientific",PlotStyle->{{Dashing[{Large,Small}],Orange,Thickness[0.002]},{Dashing[{}],Orange},{Dashing[{Medium,Small}],Orange,Thickness[0.002]},{Dashing[{Large,Small}],Lighter[Blue,0.5],Thickness[0.002]},{Dashing[{}],Lighter[Blue,0.5]},{Dashing[{Medium,Small}],Lighter[Blue,0.5],Thickness[0.002]}},Filling->{1->{{2},Opacity[0.5,Lighter[Orange,0.5]]},2->{{3},Opacity[0.5,Lighter[Orange,0.5]]},4->{{5},Opacity[0.5,Lighter[Blue,0.5]]},5->{{6},Opacity[0.5,Lighter[Blue,0.5]]}},FrameLabel->{"v","p"},PlotLegends->Placed[{"inf[P(D|T⩾t)]","P(D|T⩾t)","sup[P(D|T⩾t)]","inf[P(D|T=t)]","P(D|T=t)","sup[P(D|T=t)]"},Right],PlotHighlighting->"Dropline", ImageSize->{600}]],
Column[{ToString[NumberForm[N[100 p],{4,2}]]<>" % confidence intervals of P(D|T⩾t) and P(D|T=t) vs prevalence of disease v"},Center],Top]]
tdpr[t_,r_,μD_,μH_,σD_,σH_,dig_]:=
Text@Grid[Quiet[Transpose[
{{Style["diagnostic measures",Bold],"measurements distribution","diseased","normal",SpanFromAbove,SpanFromAbove,"lognormal",SpanFromAbove,SpanFromAbove,"gamma",SpanFromAbove,SpanFromAbove},
{SpanFromLeft,SpanFromLeft,"nondiseased","normal","lognormal","gamma","normal","lognormal","gamma","normal","lognormal","gamma"},
{SpanFromLeft,"measure",
"P(D|T⩾t)",
NumberForm[N@dp[t,r,μD,μH,σD,σH,"ppv","normal","normal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"ppv","normal","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"ppv","normal","gamma"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"ppv","lognormal","normal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"ppv","lognormal","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"ppv","lognormal","gamma"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"ppv","gamma","normal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"ppv","gamma","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"ppv","gamma","gamma"],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,
"P(D|T=t)",
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpd","normal","normal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpd","normal","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpd","normal","gamma"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpd","lognormal","normal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpd","lognormal","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpd","lognormal","gamma"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpd","gamma","normal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpd","gamma","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpd","gamma","gamma"],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,
"P((OverBar[D])|T<t)",
NumberForm[N@dp[t,r,μD,μH,σD,σH,"npv","normal","normal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"npv","normal","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"npv","normal","gamma"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"npv","lognormal","normal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"npv","lognormal","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"npv","lognormal","gamma"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"npv","gamma","normal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"npv","gamma","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"npv","gamma","gamma"],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,
"P((OverBar[D])|T=t)",
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpn","normal","normal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpn","normal","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpn","normal","gamma"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpn","lognormal","normal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpn","lognormal","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpn","lognormal","gamma"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpn","gamma","normal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpn","gamma","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,r,μD,μH,σD,σH,"bpn","gamma","gamma"],{dig+2,dig}]}}]],
Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->Automatic]
trdpr[t_,r_,μD_,μH_,σD_,σH_,dig_]:=
Text@Grid[Quiet[Transpose[
{{Style["diagnostic measures ratios",Bold],"measurements distribution","diseased","normal",SpanFromAbove,SpanFromAbove,"lognormal",SpanFromAbove,SpanFromAbove,"gamma",SpanFromAbove,SpanFromAbove},
{SpanFromLeft,SpanFromLeft,"nondiseased","normal","lognormal","gamma","normal","lognormal","gamma","normal","lognormal","gamma"},
{SpanFromLeft,"diagnostic measures ratio",
"P(D|T⩾t)/P(D|T=t)",
NumberForm[N@rdp[t,r,μD,μH,σD,σH,1,"normal","normal"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,1,"normal","lognormal"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,1,"normal","gamma"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,1,"lognormal","normal"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,1,"lognormal","lognormal"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,1,"lognormal","gamma"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,1,"gamma","normal"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,1,"gamma","lognormal"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,1,"gamma","gamma"],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,
"P((OverBar[D])|T<t)/P((OverBar[D])|T=t)",
NumberForm[N@rdp[t,r,μD,μH,σD,σH,0,"normal","normal"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,0,"normal","lognormal"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,0,"normal","gamma"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,0,"lognormal","normal"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,0,"lognormal","lognormal"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,0,"lognormal","gamma"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,0,"gamma","normal"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,0,"gamma","lognormal"],{dig+2,dig}],
NumberForm[N@rdp[t,r,μD,μH,σD,σH,0,"gamma","gamma"],{dig+2,dig}]}}]],
Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->Automatic]
tdpu[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dm_,dig_]:=
Text@Grid[Quiet[Transpose[
{{Style["standard uncertainty of "<>txt[dm],Bold],StringJoin["prevalence of disease v = ",ToString[NumberForm[N[(nD/(nD+nH))],{4,3}]]],"measurements distribution","diseased","normal",SpanFromAbove,SpanFromAbove,"lognormal",SpanFromAbove,SpanFromAbove,"gamma",SpanFromAbove,SpanFromAbove},
{SpanFromLeft,SpanFromLeft,SpanFromLeft,"nondiseased","normal","lognormal","gamma","normal","lognormal","gamma","normal","lognormal","gamma"},
{SpanFromLeft,SpanFromLeft,"point estimation",
SpanFromAbove,
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"normal","normal"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"normal","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"normal","gamma"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"lognormal","normal"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"lognormal","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"lognormal","gamma"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"gamma","normal"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"gamma","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"gamma","gamma"],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,"standard uncertainty",
"combined",
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","normal"][[1]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","lognormal"][[1]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","gamma"][[1]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","normal"][[1]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","lognormal"][[1]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","gamma"][[1]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","normal"][[1]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","lognormal"][[1]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","gamma"][[1]],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,SpanFromLeft,
"measurement",
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","normal"][[2]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","lognormal"][[2]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","gamma"][[2]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","normal"][[2]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","lognormal"][[2]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","gamma"][[2]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","normal"][[2]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","lognormal"][[2]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","gamma"][[2]],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,SpanFromLeft,
"sampling",
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","normal"][[3]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","lognormal"][[3]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","gamma"][[3]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","normal"][[3]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","lognormal"][[3]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","gamma"][[3]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","normal"][[3]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","lognormal"][[3]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","gamma"][[3]],{dig+2,dig}]}}]],
Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->Automatic]
tdpru[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dm_,dig_]:=
Text@Grid[Quiet[Transpose[
{{Style["relative standard uncertainty of "<>txt[dm],Bold],StringJoin["prevalence of disease v = ",ToString[NumberForm[N[(nD/(nD+nH))],{4,3}]]],"measurements distribution","diseased","normal",SpanFromAbove,SpanFromAbove,"lognormal",SpanFromAbove,SpanFromAbove,"gamma",SpanFromAbove,SpanFromAbove},
{SpanFromLeft,SpanFromLeft,SpanFromLeft,"nondiseased","normal","lognormal","gamma","normal","lognormal","gamma","normal","lognormal","gamma"},
{SpanFromLeft,SpanFromLeft,"point estimation",
SpanFromAbove,
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"normal","normal"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"normal","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"normal","gamma"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"lognormal","normal"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"lognormal","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"lognormal","gamma"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"gamma","normal"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"gamma","lognormal"],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,dm,"gamma","gamma"],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,"relative standard uncertainty",
"combined",
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","normal"][[1]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","lognormal"][[1]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","gamma"][[1]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","normal"][[1]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","lognormal"][[1]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","gamma"][[1]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","normal"][[1]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","lognormal"][[1]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","gamma"][[1]],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,SpanFromLeft,
"measurement",
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","normal"][[2]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","lognormal"][[2]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","gamma"][[2]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","normal"][[2]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","lognormal"][[2]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","gamma"][[2]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","normal"][[2]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","lognormal"][[2]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","gamma"][[2]],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,SpanFromLeft,
"sampling",
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","normal"][[3]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","lognormal"][[3]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"normal","gamma"][[3]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","normal"][[3]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","lognormal"][[3]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"lognormal","gamma"][[3]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","normal"][[3]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","lognormal"][[3]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,dm,"gamma","gamma"][[3]],{dig+2,dig}]}}]],
Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->Automatic]
tdpci[t_,p_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_,dm_,dig_]:=
Text@Grid[Quiet[Transpose[
{{Style[Style[StringJoin[ToString[NumberForm[N[100 p],{4,2}]], "% confidence intervals of ",txt[dm]]],Bold],StringJoin["prevalence of disease v = ",ToString[NumberForm[N[(nD/(nD+nH))],{4,3}]]],"measurements distribution","diseased","normal",SpanFromAbove,SpanFromAbove,"lognormal",SpanFromAbove,SpanFromAbove,"gamma",SpanFromAbove,SpanFromAbove},
{SpanFromLeft,SpanFromLeft,SpanFromLeft,"nondiseased","normal","lognormal","gamma","normal","lognormal","gamma","normal","lognormal","gamma"},
{SpanFromLeft,SpanFromLeft,
"point estimation",SpanFromAbove,
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"normal","normal"][[2]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"normal","lognormal"][[2]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"normal","gamma"][[2]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"lognormal","normal"][[2]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"lognormal","lognormal"][[2]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"lognormal","gamma"][[2]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"gamma","normal"][[2]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"gamma","lognormal"][[2]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"gamma","gamma"][[2]],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,
"lower bound",SpanFromAbove,
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"normal","normal"][[1]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"normal","lognormal"][[1]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"normal","gamma"][[1]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"lognormal","normal"][[1]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"lognormal","lognormal"][[1]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"lognormal","gamma"][[1]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"gamma","normal"][[1]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"gamma","lognormal"][[1]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"gamma","gamma"][[1]],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,
"upper bound",SpanFromAbove,
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"normal","normal"][[3]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"normal","lognormal"][[3]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"normal","gamma"][[3]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"lognormal","normal"][[3]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"lognormal","lognormal"][[3]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"lognormal","gamma"][[3]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"gamma","normal"][[3]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"gamma","lognormal"][[3]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,dm,"gamma","gamma"][[3]],{dig+2,dig}]}}]],
Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->Automatic]
tcdpu[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dD_,dH_,dig_]:=
Text@Grid[Quiet[Transpose[
{{Style["standard uncertainty",Bold],StringJoin["prevalence of disease v = ",ToString[NumberForm[N[(nD/(nD+nH))],{4,3}]]],"measure",SpanFromAbove,"P(D|T⩾t)","P(D|T=t)","P((OverBar[D])|T<t)","P((OverBar[D])|T=t)"},
{SpanFromLeft,SpanFromLeft,"point estimation",SpanFromAbove,
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,"ppv",dD,dH],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,"bpd",dD,dH],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,"npv",dD,dH],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,"bpn",dD,dH],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,"standard uncertainty",
"combined",
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[1]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[1]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[1]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[1]],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,SpanFromLeft,
"measurement",
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[2]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[2]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[2]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[2]],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,SpanFromLeft,
"sampling",
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[3]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[3]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[3]],{dig+2,dig}],
NumberForm[N@dpu[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[3]],{dig+2,dig}]}}]],
Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->Automatic]
tcdpru[t_,nD_,nH_,μD_,μH_,σD_,σH_,b0_,b1_,nl_,dD_,dH_,dig_]:=
Text@Grid[Transpose[
{{Style["relative standard uncertainty",Bold],StringJoin["prevalence of disease v = ",ToString[NumberForm[N[(nD/(nD+nH))],{4,3}]]],"measure",SpanFromAbove,"P(D|T⩾t)","P(D|T=t)","P((OverBar[D])|T<t)","P((OverBar[D])|T=t)"},
{SpanFromLeft,SpanFromLeft,"point estimation",SpanFromAbove,
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,"ppv",dD,dH],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,"bpd",dD,dH],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,"npv",dD,dH],{dig+2,dig}],
NumberForm[N@dp[t,nD,nH,μD,μH,σD,σH,"bpn",dD,dH],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,"relative standard uncertainty",
"combined",
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[1]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[1]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[1]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[1]],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,SpanFromLeft,
"measurement",
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[2]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[2]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[2]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[2]],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,SpanFromLeft,
"sampling",
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"ppv",dD,dH][[3]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpd",dD,dH][[3]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"npv",dD,dH][[3]],{dig+2,dig}],
NumberForm[N@dpru[t,nD,nH,μD,μH,σD,σH,b0,b1,nl,"bpn",dD,dH][[3]],{dig+2,dig}]}}],
Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->Automatic]
tcdpci[t_,p_,nD_,nH_,μD_,μH_,σD_,σH_,nU_,b0_,b1_,nl_,dD_,dH_,dig_]:=
Text@Grid[Transpose[
{{Style[StringJoin[ToString[NumberForm[N[100 p],{4,2}]], "% confidence intervals"],Bold],StringJoin["prevalence of disease v = ",ToString[NumberForm[N[(nD/(nD+nH))],{4,3}]]],"measure","P(D|T⩾t)","P(D|T=t)","P((OverBar[D])|T<t)","P((OverBar[D])|T=t)"},
{SpanFromLeft,SpanFromLeft,"point estimation",
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[2]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[2]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[2]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[2]],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,
"lower bound",
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[1]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[1]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[1]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[1]],{dig+2,dig}]},
{SpanFromLeft,SpanFromLeft,
"upper bound",
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"ppv",dD,dH][[3]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpd",dD,dH][[3]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"npv",dD,dH][[3]],{dig+2,dig}],
NumberForm[N@dpci[t,p,nD,nH,μD,μH,σD,σH,nU,b0,b1,nl,"bpn",dD,dH][[3]],{dig+2,dig}]}}],
Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->Automatic]

TabView[{"diagnostic measures plots"->
TabView[{"diagnostic measures"->
TabView[{"vs measurement value"->
Manipulate[
pcdp[r,mD,mH,sD,sH,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["diagnostic measures plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["prevalence of disease",Bold],
{{r,0.158,"v"},0.001,0.999,.001,ImageSize->Tiny,
Appearance->"Labeled"},
Delimiter,
Style["diseased population",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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population",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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"vs prevalence of disease"->
Manipulate[
pcdpr[t,mD,mH,sD,sH,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["diagnostic measures plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["diseased population",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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population",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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center]}],
"diagnostic measures ratios"->
TabView[{"vs measurement value"->
Manipulate[
prcdp[r,mD,mH,sD,sH,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["diagnostic measures ratio plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["prevalence of disease",Bold],
{{r,0.158,"v"},0.001,0.999,.001,ImageSize->Tiny,
Appearance->"Labeled"},
Delimiter,
Style["diseased population",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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population",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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"vs prevalence of disease"->
Manipulate[
prcdpr[t,mD,mH,sD,sH,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["diagnostic measures ratio plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["diseased population",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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["nondiseased population",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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center]}]}],
"diagnostic measures tables"->
TabView[{"diagnostic measures"->
Manipulate[
tdpr[t,r,mD,mH,sD,sH,dig],
Style["number of decimal digits of results",Bold],
{{dig,3,"digits"},1,10,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["prevalence of disease",Bold],
{{r,0.158,"v"},0.001,0.999,.001,ImageSize->Tiny,
Appearance->"Labeled"},
Delimiter,
Style["diseased population",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"},
Delimiter,
Style["nondiseased population",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"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"diagnostic measures ratios"->
Manipulate[
trdpr[t,r,mD,mH,sD,sH,dig],
Style["number of decimal digits of results",Bold],
{{dig,3,"digits"},1,10,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["prevalence of disease",Bold],
{{r,0.158,"v"},0.001,0.999,.001,ImageSize->Tiny,
Appearance->"Labeled"},
Delimiter,
Style["diseased population",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"},
Delimiter,
Style["nondiseased population",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"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center]}],
"uncertainty plots"->
TabView[{"vs measurement value"->
TabView[{
"standard uncertainty"->
Manipulate[pro[pr];
pcdpu[nD,nH,mD,mH,sD,sH,b0,b1,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["standard uncertainty plot range",Bold],
{{pr,True,""},{True->"extended",False->"limited"},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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"relative standard uncertainty"->
Manipulate[pro[pr];
pcdpru[nD,nH,mD,mH,sD,sH,b0,b1,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["relative standard uncertainty plot range",Bold],
{{pr,True,""},{True->"extended",False->"limited"},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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"confidence intervals"->
Manipulate[pro[pr];
pcdpci[p,nD,nH,mD,mH,sD,sH,nU,b0,b1,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["confidence intervals plot range",Bold],
{{pr,True,""},{True->"extended",False->"limited"},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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"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->Center]}],
"vs constant contribution to measurement uncertainty"->
TabView[{
"standard uncertainty"->
Manipulate[pro[pr];
pcdpub0[t,nD,nH,mD,mH,sD,sH,b1,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["standard uncertainty plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b1,0.0119,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"relative standard uncertainty"->
Manipulate[pro[pr];
pcdprub0[t,nD,nH,mD,mH,sD,sH,b1,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["relative standard uncertainty plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b1,0.0119,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"confidence intervals"->
Manipulate[pro[pr];
pcdpcib0[t,p,nD,nH,mD,mH,sD,sH,nU,b1,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["confidence intervals plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["confidence level",Bold],
{{p,0.95,"p"},0.900,0.999,0.001,Appearance->"Labeled",ImageSize->Tiny},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b1,0.0119,"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->Center]}],
"vs measurement uncertainty proportionality constant"->
TabView[{
"standard uncertainty"->
Manipulate[pro[pr];
pcdpub1[t,nD,nH,mD,mH,sD,sH,b0,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["standard uncertainty plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"relative standard uncertainty"->
Manipulate[pro[pr];
pcdprub1[t,nD,nH,mD,mH,sD,sH,b0,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["relative standard uncertainty plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"confidence intervals"->
Manipulate[pro[pr];
pcdpcib1[t,p,nD,nH,mD,mH,sD,sH,nU,b0,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["confidence intervals plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["confidence level",Bold],
{{p,0.95,"p"},0.900,0.999,0.001,Appearance->"Labeled",ImageSize->Tiny},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"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->Center]}],
"vs population sample size"->
TabView[{
"standard uncertainty"->
Manipulate[pro[pr];
pcdpun[t,r,mD,mH,sD,sH,b0,b1,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["standard uncertainty plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["prevalence of disease",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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"relative standard uncertainty"->
Manipulate[pro[pr];
pcdprun[t,r,mD,mH,sD,sH,b0,b1,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["relative standard uncertainty plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["prevalence of disease",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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"confidence intervals"->
Manipulate[pro[pr];
pcdpcin[t,p,r,mD,mH,sD,sH,nU,b0,b1,nl,dst,dD,dH, pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["confidence interval plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["confidence level",Bold],
{{p,0.95,"p"},0.900,0.999,0.001,Appearance->"Labeled",ImageSize->Tiny},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["prevalence rate of disease",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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"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->Center]}],
"vs prevalence"->
TabView[{
"standard uncertainty"->
Manipulate[pro[pr];
pcdpur[t,n,mD,mH,sD,sH,b0,b1,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["standard uncertainty plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["total population sample size",Bold],
{{n,976,"n"},20,20000,1,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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"relative standard uncertainty"->
Manipulate[pro[pr];
pcdprur[t,n,mD,mH,sD,sH,b0,b1,nl,dst,dD,dH,pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["relative standard uncertainty plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["total population sample size",Bold],
{{n,976,"n"},20,20000,1,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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"confidence intervals"->
Manipulate[pro[pr];
pcdpcir[t,p,n,mD,mH,sD,sH,nU,b0,b1,nl,dst,dD,dH, pr],
Style["diagnostic measures",Bold],
{{dst,1,""},{1->"P(D|T⩾t) and P(D|T=t)",0->"P((OverBar[D])|T<t) and P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["confidence interval plot range",Bold],
{{pr,False,""},{True->"extended",False->"limited"},ControlPlacement->Left},
Delimiter,
Style["confidence level",Bold],
{{p,0.95,"p"},0.900,0.999,0.001,Appearance->"Labeled",ImageSize->Tiny},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["total population sample size",Bold],
{{n,976,"n"},20,20000,1,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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"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->Center]}]}],
"uncertainty tables"->
TabView[{"all distributions"->
TabView[{"standard uncertainty"->
Manipulate[
tdpu[t,nD,nH,mD,mH,sD,sH,b0,b1,nl,dm,dig],
Style["diagnostic measure",Bold],
{{dm,"bpd",""},{"ppv"->"P(D|T⩾t)","bpd"->"P(D|T=t)","npv"->"P((OverBar[D])|T<t)","bpn"->"P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["number of decimal digits of results",Bold],
{{dig,3,"digits"},1,10,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},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])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"relative standard uncertainty"->
Manipulate[
tdpru[t,nD,nH,mD,mH,sD,sH,b0,b1,nl,dm,dig],
Style["diagnostic measure",Bold],
{{dm,"bpd",""},{"ppv"->"P(D|T⩾t)","bpd"->"P(D|T=t)","npv"->"P((OverBar[D])|T<t)","bpn"->"P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["number of decimal digits of results",Bold],
{{dig,3,"digits"},1,10,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.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])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"confidence intervals"->
Manipulate[
tdpci[t,p,nD,nH,mD,mH,sD,sH,nU,b0,b1,nl,dm,dig],
Style["diagnostic measure",Bold],
{{dm,"bpd",""},{"ppv"->"P(D|T⩾t)","bpd"->"P(D|T=t)","npv"->"P((OverBar[D])|T<t)","bpn"->"P((OverBar[D])|T=t)"},ControlPlacement->Left},
Delimiter,
Style["number of decimal digits of results",Bold],
{{dig,3,"digits"},1,10,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["confidence level",Bold],
{{p,0.95,"p"},0.900,0.999,0.001,Appearance->"Labeled",ImageSize->Tiny},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.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])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"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->Center]}],
"all measures"->
TabView[{"standard uncertainty"->
Manipulate[
tcdpu[t,nD,nH,mD,mH,sD,sH,b0,b1,nl,dD,dH,dig],
Style["number of decimal digits of results",Bold],
{{dig,3,"digits"},1,10,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"relative standard uncertainty"->
Manipulate[
tcdpru[t,nD,nH,mD,mH,sD,sH,b0,b1,nl,dD,dH,dig],
Style["number of decimal digits of results",Bold],
{{dig,3,"digits"},1,10,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"proportionality constant (Subscript[b, 1])"},0,0.1,.0001,ImageSize->Tiny,Appearance->"Labeled"},
SaveDefinitions->True,ContinuousAction->False,TrackedSymbols->True,ControlPlacement->Left,Alignment->Center],
"confidence intervals"->
Manipulate[
tcdpci[t,p,nD,nH,mD,mH,sD,sH,nU,b0,b1,nl,dD,dH,dig],
Style["confidence level",Bold],
{{p,0.95,"p"},0.900,0.999,0.001,Appearance->"Labeled",ImageSize->Tiny},
Delimiter,
Style["number of decimal digits of results",Bold],
{{dig,3,"digits"},1,10,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["measurement value",Bold],
{{t,126,"t"},Max[Min[mH-6sH,mD-6sD],0],Max[mH+6sH,mD+6sD],.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","measurements 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","measurements distribution"},{"normal"->"normal","lognormal"->"lognormal","gamma"->"gamma"}} ,
Delimiter,
Style["measurement uncertainty",Bold],
{{nl,1,"(Subscript[u, m])(t) = "},{0->"(Subscript[b, 0])+(Subscript[b, 1])t",1->"(Sqrt[(Subscript[b, 0]^2) + (Subscript[b, 1]^2) (t^2)])"},ImageSize->Tiny},
{{b0,0.812,"constant contribution (Subscript[b, 0])"},0,sH,.001,ImageSize->Tiny,Appearance->"Labeled"},
{{b1,0.0119,"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->Center]}]}]},
ImageSize->Automatic]

Notation
P(D|T⩾t): positive predictive value
P((OverBar[D])|T<t):  negative predictive value
P(D|T=t): Bayesian probability for disease
P((OverBar[D])|T=t): Bayesian probability for the absence of disease
(Subscript[u, c])(z): standard combined uncertainty of z
(Subscript[u, m])(z): standard measurement uncertainty of z
(Subscript[u, s])(z): standard sampling uncertainty of z
n: sample size
r: ratio
v: prevalence or prior probability for disease
(Subscript[b, 0]):  constant contribution to measurement uncertainty
(Subscript[b, 1]):  measurement uncertainty proportionality constant
inf[f]: lower bound of f
sup[f]: upper bound of f

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 Insights
Version 1.2.5
Hellenic Complex Systems Laboratory 2024
This notebook is distributed under  an Attribution - NonCommercial - ShareAlike 4.0 International Creative Commons License.