Rubrik: Variablen/Strings · Algorithmen/Mathematik | VB-Versionen: VB5, VB6 | 18.04.05 |
Integration der Standard-Normalverteilung Berechnung des Integrals der Standard-Normalverteilung | ||
Autor: Manfred Bohn | Bewertung: | Views: 17.664 |
ohne Homepage | System: Win9x, WinNT, Win2k, WinXP, Win7, Win8, Win10, Win11 | Beispielprojekt auf CD |
Die Integration der Normalverteilung ist nicht analytisch lösbar.
Im Internet findet sich eine Vielzahl von Vorschlägen zur numerischen Integration dieser statistischen Verteilungsfunktion. Einfache Verfahren erreichen dabei nur eine Genauigkeit von 2-3 Stellen.
Die hier vorgestellte VB6-Funktion erreicht für das Integral eine Präzision von 4 Stellen.
Das entspricht den statistischen Tabellen, die in Formelsammlungen und Statistik-Lehrbüchern veröffentlicht werden.
Fundstelle des Verfahrens:
H. Fillbrandt; Verteilungsfreie Methoden in der Biostatistik (EDV-Band); Meisenheim, 1986; S. 17
Eingabeparameter: Standardwert (z-Wert)
Rückgabe: Integral von -unendlich bis Standardwert
' ----------------------------- Beginn des Quellcodes ------------------------- Function Integral_der_Normalverteilung(ByVal Standardwert As Double) As Double ' Berechnung des Integrals der Standard-Normalverteilung ' im Intervall von -unendlich bis zum vorgegebenen Standardwert ' Behandlung der Extrembereiche für Standardwerte: ' Standardwert <= -4.2 ---> Integral wird auf .00001 gesetzt ' Standardwert => 4.2 ---> Integral wird auf .99999 gesetzt ' erforderliche Hilfskonstanten Const a1 As Double = 0.000124818987 Const b1 As Double = 0.001075204047 Const c1 As Double = 0.005198775019 Const d1 As Double = 0.019198292004 Const e1 As Double = 0.059054035642 Const f1 As Double = 0.151968751364 Const g1 As Double = 0.319152932694 Const h1 As Double = 0.5319230073 Const i1 As Double = 0.797884560593 Const a2 As Double = 0.000045255659 Const b2 As Double = 0.00015252929 Const c2 As Double = 0.000019538132 Const d2 As Double = 0.000676904986 Const e2 As Double = 0.001390604284 Const f2 As Double = 0.00079462082 Const g2 As Double = 0.002034254874 Const h2 As Double = 0.006549791214 Const i2 As Double = 0.010557625006 Const j2 As Double = 0.011630447319 Const k2 As Double = 0.009279453341 Const l2 As Double = 0.005353579108 Const m2 As Double = 0.002141268741 Const n2 As Double = 0.000535310849 Const o2 As Double = 0.999936657524 ' Hilfsvariable Dim z As Double, y As Double, h As Double, v As Double, w As Double ' Speicher für interne Zwischenergebnisse Dim term1 As Double, term2 As Double, term3 As Double If Standardwert >= 4.2 Then Integral_der_Normalverteilung = 0.99999: Exit Function If Standardwert <= -4.2 Then Integral_der_Normalverteilung = 0.00001: Exit Function ' Näherungsverfahren If Standardwert = 0 Then z = 0 Else y = Abs(Standardwert) / 2 If y >= 3 Then z = 1 ElseIf y < 1 Then w = y * y term1 = ((((a1 * w - b1) * w + c1) * w - d1) * w + e1) * w - f1 z = (((term1 * w + g1) * w - h1) * w + i1) * y * 2 Else y = y - 2 term1 = ((((-a2 * y + b2) * y - c2) * y - d2) * y + e2) * y - f2 term2 = (term1 * y - g2) * y + h2 term3 = ((term2 * y - i2) * y + j2) * y - k2 z = (((term3 * y + l2) * y - m2) * y + n2) * y + o2 End If End If If Standardwert > 0 Then Integral_der_Normalverteilung = (z + 1) / 2 Else Integral_der_Normalverteilung = (1 - z) / 2 End If End Function ' ----------------------------- Ende des Quellcodes ---------------------------