Attribute VB_Name = "modMethod"
Option Explicit
'求正态分布的分位数
'Q:上侧概率
'x:分位数
Public Sub PNorm(Q, x)
Dim p As Double, y As Double, z As Double
Dim b0 As Double, b1 As Double, b2 As Double
Dim b3 As Double, b4 As Double, b5 As Double
Dim b6 As Double, b7 As Double, b8 As Double
Dim b9 As Double, b10 As Double, b As Double
b0 = 1.570796288
b1 = 0.03706987906
b2 = -0.0008364353589
b3 = -0.0002250947176
b4 = 0.000006841218299
b5 = 0.000005824238515
b6 = -0.00000104527497
b7 = 8.360937017E-08
b8 = -3.231081277E-09
b9 = 3.657763036E-11
b10 = 6.936233982E-13
If Q = 0.5 Then
x = 0: GoTo PN01
End If
If Q > 0.5 Then p = 1 - Q Else p = Q
y = -Log(4 * p * (1 - p))
b = y * (b9 + y * b10)
b = y * (b8 + b)
b = y * (b7 + b)
b = y * (b6 + b)
b = y * (b5 + b)
b = y * (b4 + b)
b = y * (b3 + b)
b = y * (b2 + b)
b = y * (b1 + b)
z = y * (b0 + b)
x = Sqr(z)
If Q > 0.5 Then x = -x
PN01:
End Sub