English
Source / code snippets

Hypergeometrische distribution

 

p.specht

in the Statistik can with small Stückzahlen and Sample-sizes not the Gauss-schen Normalverteilung works, because by the "Diskretisierung" count here others Gesetzlichkeiten.

If a package with 100 screwing 5 code contains, what about me entnehme 20: How probably is it then, that in this 20 : No, a, two, three, four or any five defective are? here helps The Hypergeometrische distribution moreover, from the known Formel "Gesuchte_Fälle / Überhaupt_gleichmögliche_Fälle" develops watts.


enclosed - without each Gewähr - one small Program moreover. it contains yet no check, whether The Eingabewerte meaningfully sind; to that rumspielen reicht But.
Window Title "Hypergeometrische Verteilung"
Window Style 24:set("decimals",15):font 2
Window %maxx/10,0 - %maxx/2,%maxy-40

Proc BinCoeff :parameters N&,k&:var h!=1

    'Pascalsches Dreieck: Binärkoeffizient = ´N over k ´

    whileloop k&,1,-1:h!=h!*(N&-&Loop+1)/&Loop

        endwhile:return h!

    ENDPROC

    Proc HypGFormel :parameters N&,P!,s&,x&'P(x) = (p x)*(q s-x)/(n s)

        Case p!<0:p!=abs(p!/100):Case (p!>=0) and (p!<1):P!=int(p!*N&)
        Return BinCoeff(P!,x&)/BinCoeff(N&,s&) * BinCoeff(N&-P!,s&-x&)

    ENDPROC

    Proc Hyp0 :parameters N&,P!,s&'Startwert x=0 the Rekursionsformel

        'P!=Stückzahl | If p=0..1 Wahrscheinlichkeitsfaktor, if <0: Prozentanteil
        'probability, in a Sample s from n Elementen with P particular
        'keines the particular items to find
        case p!<0:p!=abs(p!/100):Case (p!>=0) and (p!<1):P!=int(p!*N&)
        var H!=1
        var Q&=N&-P!

        WhileLoop s&,1,-1

            H!=H!*(Q&-&Loop+1)/(N&-&Loop+1)

        Endwhile

        Return H!

    ENDPROC

    Proc HypGNext :parameters N&,P!,s&,x&,f_lastx!'REKURSIONSFORMEL

        Case p!<0:p!=abs(p!/100):Case (p!>=0) and (p!<1):P!=int(p!*N&)
        case (x&<0) or (x&>s&):return 0
        var Q&=N&-P!
        return f_lastx!*(P!-x&)/(x&+1)*(s&-x&)/(Q&-(s&-x&)+1)

    ENDPROC

    'Main
    Declare f!,Addf!,w$,N&,P!,s&,x&
    Lup:
    CLS
    print "\n amount Grundgesamtheit: ";:input w$:case w$>"":N&=val(w$)

    if N&<1:N&=100:P!=5:s&=20:x&=0:CLS:print "\n TESTWERTE 100,5,20":goto "skip":endif

        print " amount particular Elem.: ";:input w$:case w$>"":P!=val(w$)
        print "           Sample-Size: ";:input w$:case w$>"":s&=val(w$)
        print "    particular in the Sample: ";:input w$:case w$>"":x&=val(w$)
        Skip:
        print "\n                      Verteilungsdichte"
        Print " HyperGVtlg-Rekursionsformel:      Check with BinCoeff-Formel:\n"

        Whileloop 0,P!

            if &Loop : f!=HypGNext(N&,P!,s&,&Loop-1,f!)

                else     : f!=Hyp0(N&,P!,s&)

            endif

            Print " x =";&Loop;": P(x)= ";stature$("%g",f!);
            print tab(44);HypGFormel(N&,P!,s&,&Loop)

        Endwhile

        Waitinput
        cls
        print "\n Verteilungsfunktion moreover:\n"
        Addf!=0

        Whileloop 0,P!

            if &Loop : f!=HypGNext(N&,P!,s&,&Loop-1,f!)

                else     : f!=Hyp0(N&,P!,s&)

            endif

            Addf!=Addf!+f!
            Print " x_max = ";&Loop;": P(x<=";&Loop;")= ";stature$("%g",Addf!)

        Endwhile

        waitinput
        Goto "Lup"
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/30/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.415 Views

Untitledvor 0 min.
p.specht11/21/21
R.Schneider11/20/21
Uwe Lang11/20/21
Manfred Barei11/19/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie