| |
|
|
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 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/30/21 ▲ |
|
|
|