def nvmDensity(v,x,myA,whichModel): t1 = np.divide(1,np.sqrt(2*math.pi*v)) t2 = np.exp(-np.divide(x**2,2*v)) if whichModel==0: return t1*t2*util.gammaDensity(v,myA,myA) elif whichModel==1: return t1*t2*util.gigDensity(v,myA)
def jointIntegrandNVM(g,v,p,q,myRho,myA,invCdf,whichModel): p1 = computeP_NVM(p,myRho,g,v,myA,invCdf) p2 = computeP_NVM(q,myRho,g,v,myA,invCdf) density1 = util.gaussianDensity(g,0,1) if whichModel==0: density2 = util.gammaDensity(v,myA,myA) elif whichModel==1: density2 = util.gigDensity(v,myA) return p1*p2*density1*density2
def thresholdMoment(g, w, p1, p2, myP, whichModel, myMoment, invCdf=0): d1 = util.gaussianDensity(g, 0, 1) if whichModel == 1: # t d2 = util.chi2Density(w, p2) integrand = np.power(th.computeP_t(myP, p1, g, w, p2), myMoment) if whichModel == 2: # Variance-gamma d2 = util.gammaDensity(w, p2, p2) integrand = np.power(th.computeP_NVM(myP, p1, g, w, p2, invCdf), myMoment) if whichModel == 3: # Generalized hyperbolic d2 = util.gigDensity(w, p2) integrand = np.power(th.computeP_NVM(myP, p1, g, w, p2, invCdf), myMoment) return integrand * d1 * d2