Repository navigation
Expand file tree
/
Copy pathDistribution_Lab.html
More file actions
3036 lines (2818 loc) · 267 KB
/
Copy pathDistribution_Lab.html
File metadata and controls
3036 lines (2818 loc) · 267 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="de" data-theme="dark">
<head>
<meta charset="UTF-8">
<script>(function(){var t=localStorage.getItem('btl-theme');if(t)document.documentElement.setAttribute('data-theme',t);if(t==='light')document.addEventListener('DOMContentLoaded',function(){['btn-theme','btn-th','btn-th-nav','themeBtn'].forEach(function(id){var b=document.getElementById(id);if(b)b.textContent='🌙 Dark';});});})()</script>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Wahrscheinlichkeitsverteilungen interaktiv: Normal, Gamma, Beta, Poisson, Binomial, Negative Binomial und mehr — Vorbereitung auf GLMs und bayesianische Modelle in brms.">
<meta name="keywords" content="Wahrscheinlichkeitsverteilungen, GLM, brms, Normal, Gamma, Beta, Poisson, Binomial, Bayesianisch, Statistik interaktiv">
<meta property="og:title" content="Distribution Lab — Bayes Thinking Lab">
<meta property="og:description" content="Wahrscheinlichkeitsverteilungen interaktiv: Normal, Gamma, Beta, Poisson und mehr — Vorbereitung auf GLMs in brms.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Bayes Thinking Lab">
<title>Distribution Lab — Bayes Thinking Lab</title>
<link href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,400;0,500;1,400&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,600;1,9..144,300;1,9..144,400&display=swap" rel="stylesheet">
<style>
html{font-size:18px}
:root{
--bg:#f2ede3;--paper:#faf6ee;--ink:#18130e;--ink2:#5a4f42;
--a1:#c94a2a;--a2:#2a6e8a;--a3:#5a8a2a;--a4:#7a3a8a;--a5:#b85c00;--a6:#6E2646;
--density-color:#0e7c7b;
--grid:#ddd5c6;--panel:#ece5d5;--border:#c5bba8;--shadow:#c0b8a4;--header-h:180px;
}
[data-theme="dark"]{
--bg:#0f1117;--paper:#171b25;--ink:#e8e2d8;--ink2:#9a9080;
--a1:#e8614a;--a2:#4ab0d8;--a3:#80cb52;--a4:#c87ad8;--a5:#e07830;--a6:#812C52;
--density-color:#2bc7c4;
--grid:#252a36;--panel:#1e2230;--border:#333a4a;--shadow:#080b10;
}
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:'Fraunces',Georgia,serif;background:var(--bg);color:var(--ink);
min-height:100vh;transition:background .25s,color .25s}
/* ── HEADER (einheitlich, identisch zu Bayesian_model_architect) ── */
#topbar{position:sticky;top:0;z-index:200;background:var(--paper);border-bottom:1.5px solid var(--border);
padding:.5rem 1.1rem;display:flex;align-items:center;justify-content:space-between;flex-shrink:0;gap:.5rem;line-height:normal}
.hdr-h1{font-family:'Fraunces',Georgia,serif;font-size:1.55rem;font-weight:300;letter-spacing:-.02em;line-height:1.2}
.hdr-h1 em{font-style:italic;color:var(--a6)}
.hdr-sub2{font-family:'DM Mono',monospace;font-size:.75rem;color:var(--ink2);margin-top:.2rem;letter-spacing:.03em}
.hdr-auth{font-family:'DM Mono',monospace;font-size:.75rem;color:var(--ink2);opacity:.5;margin-top:.1rem}
.hdr-btns{display:flex;gap:.4rem;align-items:center}
.hbtn{font-family:'DM Mono',monospace;font-size:.75rem;background:var(--panel);border:1.5px solid var(--border);color:var(--ink2);padding:.22rem .6rem;cursor:pointer;transition:all .15s}
.hbtn:hover{border-color:var(--a2);color:var(--a2)}
.hbtn.act{background:var(--a2);color:var(--paper);border-color:var(--a2)}
.glo-link{color:inherit;text-decoration:underline;text-decoration-style:dotted;text-underline-offset:3px;cursor:pointer}
.glo-link:hover{color:var(--a2)}
/* ── INTRO STRIP ── */
.intro-strip{display:flex;align-items:center;justify-content:space-between;gap:1rem;
padding:.45rem 1.4rem;background:var(--panel);border-bottom:1px solid var(--border);
font-family:'DM Mono',monospace;font-size:.75rem;color:var(--ink2)}
.intro-strip em{color:var(--a6);font-style:normal}
.intro-strip strong{color:var(--ink)}
.intro-strip .tbtn{font-family:'DM Mono',monospace;font-size:.75rem;padding:.3rem .7rem;
border:1.5px solid var(--a2);background:transparent;cursor:pointer;color:var(--a2);
transition:all .15s;white-space:nowrap;flex-shrink:0}
.intro-strip .tbtn:hover{background:var(--a2);color:var(--paper)}
/* ── INTRO BOX (collapsible) ── */
.intro-box{background:var(--paper);border-bottom:1.5px solid var(--a2);
padding:1rem 1.4rem;font-family:'DM Mono',monospace;
font-size:.75rem;color:var(--ink2);line-height:1.9}
.intro-box .ib-head{font-size:.82rem;font-weight:500;color:var(--ink);margin-bottom:.55rem;
border-bottom:1px solid var(--grid);padding-bottom:.35rem;font-family:'Fraunces',Georgia,serif}
.intro-box .ib-head.ib-head2{margin-top:.9rem}
.intro-box .ib-head em{color:var(--a2);font-style:italic}
.intro-box b, .intro-box strong{color:var(--ink)}
.intro-box em{color:var(--a2);font-style:normal}
.intro-box code{background:var(--panel);border:1px solid var(--border);color:var(--a2);padding:.02rem .3rem;font-size:.75rem}
/* ── CATEGORY TABS ── */
#cat-tabs{display:flex;background:var(--grid);border-bottom:1px solid var(--border)}
.cat-tab{flex:1;font-family:'DM Mono',monospace;font-size:.75rem;padding:.58rem .5rem;
background:var(--paper);cursor:pointer;text-align:center;border:none;
color:var(--ink2);transition:all .13s;border-right:1px solid var(--grid);line-height:1.35}
.cat-tab:last-child{border-right:none}
.cat-tab:hover{background:var(--panel);color:var(--ink)}
.cat-tab.sel{background:var(--panel);color:var(--a6);box-shadow:inset 0 -2.5px 0 var(--a6)}
/* ── DIST STRIP ── */
#dist-strip{display:flex;flex-wrap:wrap;gap:0;background:var(--grid);
border-bottom:1.5px solid var(--border)}
.dist-btn{font-family:'DM Mono',monospace;font-size:.75rem;padding:.4rem .78rem;
background:var(--paper);cursor:pointer;border:none;border-right:1px solid var(--grid);
color:var(--ink2);transition:all .13s}
.dist-btn:hover{background:var(--panel);color:var(--ink)}
.dist-btn.sel{background:var(--a6);color:var(--paper)}
/* ── MAIN LAYOUT ── */
#dl-outer{display:grid;grid-template-columns:300px 1fr;
height:calc(100vh - var(--header-h))}
#dl-sidebar{overflow-y:auto;height:100%;border-right:1px solid var(--border);
padding:.85rem .9rem;display:flex;flex-direction:column;gap:.6rem;
scrollbar-width:thin;scrollbar-color:var(--border) var(--bg)}
#dl-sidebar::-webkit-scrollbar{width:5px}
#dl-sidebar::-webkit-scrollbar-track{background:var(--bg)}
#dl-sidebar::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}
#dl-right{overflow-y:auto;height:100%;display:flex;flex-direction:column}
/* ── SIDEBAR CONTENT ── */
.dl-dist-name{font-family:'Fraunces',serif;font-size:.95rem;font-weight:600;
color:var(--ink);margin-bottom:.15rem}
.dl-notation{font-family:'DM Mono',monospace;font-size:.67rem;color:var(--a6);
margin-bottom:.2rem;padding-bottom:.45rem;border-bottom:1px solid var(--grid)}
.scard{background:var(--paper);border:1.5px solid var(--border);padding:.85rem 1rem;
box-shadow:2px 2px 0 var(--shadow)}
.dl-sect-lbl{font-family:'DM Mono',monospace;font-size:.58rem;letter-spacing:.1em;
text-transform:uppercase;color:var(--ink2);margin-bottom:.55rem;
padding-bottom:.25rem;border-bottom:1px solid var(--grid)}
.param-row{margin-bottom:.58rem}
.param-row:last-child{margin-bottom:0}
.param-top{display:flex;justify-content:space-between;align-items:baseline;
font-family:'DM Mono',monospace;font-size:.67rem;color:var(--ink2);margin-bottom:.2rem}
.param-val{color:var(--a6);font-weight:500;min-width:2.5rem;text-align:right}
input[type=range]{-webkit-appearance:none;height:3px;background:var(--grid);
outline:none;cursor:pointer;border-radius:2px;width:100%;display:block}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:12px;height:12px;
background:var(--a6);border-radius:50%;cursor:pointer}
input[type=range]::-moz-range-thumb{width:12px;height:12px;background:var(--a6);
border-radius:50%;border:none;cursor:pointer}
/* Clickable examples — small button woven right into the prose, after the parameter
values it applies (e.g. "...bei erwachsenen Frauen [anwenden]),"). */
.inline-ex-btn{display:inline-block;font-family:'DM Mono',monospace;font-size:.62rem;
padding:.06rem .4rem;margin-left:.2rem;background:var(--paper);border:1.2px solid var(--a6);
color:var(--a6);border-radius:3px;cursor:pointer;vertical-align:.05em;line-height:1.4;
transition:all .13s;white-space:nowrap}
.inline-ex-btn:hover{background:var(--a6);color:var(--paper)}
/* brms toggle */
.brms-row{display:flex;gap:1px;background:var(--grid);margin:.28rem 0 .65rem}
.brms-btn{flex:1;padding:.32rem .3rem;border:none;background:var(--paper);
cursor:pointer;color:var(--ink2);font-family:'DM Mono',monospace;
transition:all .13s;display:flex;flex-direction:column;align-items:center;justify-content:center;
gap:.15rem;min-height:2.7em;line-height:1.2;text-align:center}
.brms-btn-type{font-size:.67rem;font-weight:600;letter-spacing:.01em}
.brms-btn-params{font-size:.6rem;opacity:.8}
.brms-btn:hover{background:var(--panel)}
/* Farbcodierung passend zu den Parametrisierungs-Boxen weiter unten:
brms/Likelihood = teal, Klassisch/Prior = weinrot. */
.brms-btn.sel{color:var(--paper)}
#btn-brms.sel{background:var(--density-color)}
#btn-classic.sel{background:var(--a6)}
/* moments */
.moments-col{display:flex;flex-direction:column;gap:.32rem}
.moment-chk{display:flex;align-items:center;gap:.48rem;
font-family:'DM Mono',monospace;font-size:.67rem;color:var(--ink2);cursor:pointer}
.moment-chk input[type=checkbox]{width:12px;height:12px;cursor:pointer;accent-color:var(--a6)}
.mdot{display:inline-block;width:18px;height:2px;border-radius:1px;vertical-align:middle}
.mdot.mn{background:var(--a2)} .mdot.md{background:var(--a3)} .mdot.mo{background:var(--a5)}
.mdot.ci{height:9px;border-radius:2px;background:var(--density-color);opacity:.6}
/* stats */
.stats-block{}
.stat-r{display:flex;justify-content:space-between;font-family:'DM Mono',monospace;
font-size:.65rem;padding:.13rem 0;border-bottom:1px solid var(--grid)}
.stat-r:last-child{border-bottom:none}
.sk{color:var(--ink2)} .sv{font-weight:500;color:var(--ink)}
/* ── CANVAS AREA ── */
#canvas-wrap{padding:.8rem 1rem 0;flex-shrink:0}
canvas#dist-canvas{display:block;width:100%}
.canvas-toolbar{display:flex;justify-content:flex-end;gap:.5rem;margin-bottom:.5rem}
.xfix-btn{font-family:'DM Mono',monospace;font-size:.8rem;font-weight:600;
padding:.4rem 1rem;border:1.5px solid var(--border);border-radius:4px;
background:var(--panel);color:var(--ink2);cursor:pointer;transition:all .15s}
.xfix-btn:hover:not(:disabled){border-color:var(--a6);color:var(--a6)}
.xfix-btn.on{border-color:var(--a6);color:var(--a6);
background:color-mix(in srgb,var(--a6) 14%,var(--panel));
box-shadow:0 0 0 1px var(--a6)}
.xfix-btn:disabled{opacity:.4;cursor:not-allowed;pointer-events:none}
/* ── INFO TEXT ── */
#dist-info{padding:.75rem 1rem 1.5rem;flex:1;min-height:0}
.info-block{margin-bottom:.75rem}
.info-h{font-family:'DM Mono',monospace;font-size:.75rem;letter-spacing:.1em;
text-transform:uppercase;color:var(--a6);margin-bottom:.22rem;
padding-bottom:.16rem;border-bottom:1px solid var(--grid)}
.info-body{font-family:'DM Mono',monospace;font-size:.75rem;
color:var(--ink2);line-height:1.78}
.info-body strong{color:var(--ink)}
.info-body em{color:var(--a6);font-style:normal}
.info-body code{background:var(--panel);border:1px solid var(--border);
color:var(--a2);padding:.02rem .3rem;font-size:.68rem}
/* "Hat"/"bar" accents (β̂, ȳ, …) — plain Unicode combining diacritics render visibly
offset from the letter in several fonts, especially monospace (DM Mono). Standard
fix reused across BTL/MethodsLab tools: wrap the bare letter and let CSS ::before
draw a centered accent. top/font-size tuned+verified for THIS file's .info-body
context (.75rem, line-height 1.78) via live-injection zoom screenshots — these
values are not universal, re-verify per tool rather than trusting copied numbers. */
.gk{position:relative;display:inline-block;font-family:'Fraunces',serif;line-height:1}
.gk-hat::before{content:'^';position:absolute;top:-.12em;left:0;right:0;
text-align:center;font-size:.72em;line-height:1;pointer-events:none;
transform:scale(1.8)}
.gk-bar::before{content:'–';position:absolute;top:-.12em;left:0;right:0;
text-align:center;font-size:.65em;line-height:1;pointer-events:none;
transform:scale(1.5)}
/* ── PARAMETRISIERUNGS-BOXEN ──────────────────────────────────────
Zwei nebeneinanderliegende, farbcodierte Karten für Verteilungen mit
zwei Parametrisierungen. Die Farben sind bewusst dieselben wie beim
brms/Klassisch-Umschalter in der Seitenleiste (teal = brms/Likelihood,
weinrot = klassisch/Prior), damit Umschalter und Erklärung visuell
zusammengehören. */
.par-grid{display:grid;grid-template-columns:1fr 1fr;gap:.7rem;margin-top:.5rem}
@media(max-width:900px){.par-grid{grid-template-columns:1fr}}
.par-card{border:1.5px solid;border-radius:5px;padding:0 0 .6rem;overflow:hidden}
.par-card.brms{border-color:var(--density-color)}
.par-card.classic{border-color:var(--a6)}
.par-card-h{display:flex;align-items:center;gap:.5rem;padding:.45rem .7rem;
font-family:'DM Mono',monospace;font-size:.75rem;font-weight:600;
border-bottom:1.5px solid;margin-bottom:.5rem}
.par-card.brms .par-card-h{border-color:var(--density-color);color:var(--density-color);
background:color-mix(in srgb,var(--density-color) 12%,transparent)}
.par-card.classic .par-card-h{border-color:var(--a6);color:var(--a6);
background:color-mix(in srgb,var(--a6) 12%,transparent)}
.par-num{display:inline-flex;align-items:center;justify-content:center;
width:1.35rem;height:1.35rem;flex:0 0 auto;border-radius:50%;border:1.5px solid currentColor;
font-size:.7rem;line-height:1}
.par-card ul{list-style:none;margin:0;padding:0 .7rem}
.par-card li{position:relative;padding-left:.85rem;margin-bottom:.42rem;
font-family:'DM Mono',monospace;font-size:.7rem;color:var(--ink2);line-height:1.7}
.par-card li:last-child{margin-bottom:0}
.par-card li::before{content:'•';position:absolute;left:0;top:0}
.par-card li strong{color:var(--ink)}
.par-card.brms li em{color:var(--density-color);font-style:normal}
.par-card.classic li em{color:var(--a6);font-style:normal}
.par-card code{background:var(--panel);border:1px solid var(--border);
color:var(--a2);padding:.02rem .3rem;font-size:.66rem}
.par-note{font-family:'DM Mono',monospace;font-size:.7rem;color:var(--ink2);
line-height:1.7;margin-top:.6rem}
.par-note strong{color:var(--ink)}
/* ── OVERLAY KARTE ── */
#overlay-karte{display:none;position:fixed;inset:0;z-index:700;background:rgba(0,0,0,.55);
align-items:center;justify-content:center}
#overlay-karte.open{display:flex}
.ok-box{background:var(--paper);border:1.5px solid var(--border);max-width:1560px;width:98vw;
max-height:95vh;overflow-y:auto;box-shadow:6px 6px 0 rgba(0,0,0,.25)}
.ok-head{display:flex;justify-content:space-between;align-items:center;
padding:.65rem 1.1rem;border-bottom:1px solid var(--grid);position:sticky;top:0;background:var(--paper);z-index:1}
.ok-title{font-family:'DM Mono',monospace;font-size:.78rem;letter-spacing:.1em;
text-transform:uppercase;font-weight:500;color:var(--a4)}
.ok-close{font-family:'DM Mono',monospace;font-size:1.2rem;background:transparent;
border:none;cursor:pointer;color:var(--ink2);line-height:1}
.ok-close:hover{color:var(--ink)}
.ok-body{padding:1.4rem 1.7rem}
.ok-body svg{width:100%;height:auto;display:block}
/* info brms block */
.info-h-brms{color:var(--a4) !important}
.brms-block{background:var(--panel);border:1px solid var(--border);
padding:.45rem .65rem;margin-top:.25rem;border-left:3px solid var(--a4)}
.brms-role{font-family:'DM Mono',monospace;font-size:.65rem;color:var(--ink2);
margin-bottom:.2rem;line-height:1.7}
.brms-role strong{color:var(--ink)}
.brms-role em{color:var(--a4);font-style:normal}
.brms-role code{background:var(--bg);border:1px solid var(--border);color:var(--a2);
padding:.02rem .3rem;font-size:.65rem}
/* tool links */
.tool-links{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.3rem}
.tool-link{font-family:'DM Mono',monospace;font-size:.65rem;padding:.18rem .55rem;
border:1px solid var(--a6);color:var(--a6);text-decoration:none;
transition:all .13s;background:transparent}
.tool-link:hover{background:var(--a6);color:var(--paper)}
/* ── CHEAT SHEET (eigenständiges Overlay) + Symbole-Kurzform im Beziehungen-Overlay ──
Teilen sich dieselbe Symbol-Tabelle (per JS aus GK_SYMBOLS gerendert, in beide
Container injiziert) — keine Duplikat-Pflege, keine Drift zwischen den zwei Stellen. */
#overlay-cheat{display:none;position:fixed;inset:0;z-index:700;background:rgba(0,0,0,.55);
align-items:center;justify-content:center}
#overlay-cheat.open{display:flex}
.oc-body{padding:1.4rem 1.7rem;font-family:'DM Mono',monospace;font-size:.75rem;
color:var(--ink2);line-height:1.6}
.oc-sect-title{font-family:'DM Mono',monospace;font-size:.72rem;letter-spacing:.1em;
text-transform:uppercase;color:var(--a3);margin:1.5rem 0 .6rem;padding-bottom:.25rem;
border-bottom:1px solid var(--grid)}
.oc-sect-title:first-child{margin-top:0}
.oc-group-h{font-family:'DM Mono',monospace;font-size:.68rem;letter-spacing:.08em;
color:var(--ink2);opacity:.75;margin:1rem 0 .35rem}
.oc-group-h:first-child{margin-top:0}
.oc-tbl-wrap{overflow-x:auto}
.cheat-tbl{width:100%;border-collapse:collapse;font-size:.72rem}
.cheat-tbl th{text-align:left;color:var(--a6);font-weight:500;padding:.3rem .6rem;
border-bottom:1.5px solid var(--border);white-space:nowrap}
.cheat-tbl td{padding:.3rem .6rem;border-bottom:1px solid var(--grid);vertical-align:top}
.cheat-tbl tr:hover td{background:var(--panel)}
.cheat-sym{font-family:'Fraunces',serif;font-size:1.05em;text-align:center;color:var(--ink);white-space:nowrap}
.cheat-tbl td.cheat-brms{min-width:19rem;color:var(--ink2)}
.cheat-tbl td.cheat-brms code{background:var(--bg);border:1px solid var(--border);color:var(--a2);padding:.02rem .3rem;font-size:.66rem}
.cheat-tbl td.cheat-brms b{color:var(--ink)}
.cheat-note{font-size:.68rem;color:var(--ink2);opacity:.8;margin-top:.4rem}
.cheat-src{font-size:.65rem;color:var(--ink2);opacity:.65;margin-top:1.6rem;text-align:center}
/* Symbole-Kurzform, eingeklappt im Kopf des Beziehungen-Overlays */
.ok-toggle{font-family:'DM Mono',monospace;font-size:.68rem;background:transparent;
border:1px solid var(--border);color:var(--ink2);padding:.15rem .55rem;cursor:pointer;
transition:all .15s}
.ok-toggle:hover{border-color:var(--a4);color:var(--a4)}
.ok-toggle.act{background:var(--a4);color:var(--paper);border-color:var(--a4)}
.sym-mini{display:none;padding:.8rem 1.1rem;border-bottom:1px solid var(--grid);background:var(--panel)}
.sym-mini.open{display:block}
.sym-mini-link{display:inline-block;margin-top:.55rem;font-family:'DM Mono',monospace;
font-size:.68rem;color:var(--a4);background:transparent;border:1px solid var(--a4);
padding:.18rem .55rem;cursor:pointer}
.sym-mini-link:hover{background:var(--a4);color:var(--paper)}
/* ── HELP PANEL ── */
/* Centered, larger modal (same backdrop+flex-centering pattern as #overlay-karte below) —
switched from the old narrow right-docked panel because the "Warum zwei
Parametrisierungen?" section alone is longer than the whole old panel used to be. */
#help-panel{display:none;position:fixed;inset:0;z-index:600;background:rgba(0,0,0,.55);
align-items:center;justify-content:center}
#help-panel.open{display:flex}
.hp-box{background:var(--paper);border:1.5px solid var(--border);max-width:760px;width:92vw;
max-height:88vh;display:flex;flex-direction:column;box-shadow:4px 4px 0 rgba(0,0,0,.18)}
.hp-head{display:flex;justify-content:space-between;align-items:center;flex:none;
padding:.5rem .85rem;border-bottom:1px solid var(--grid)}
.hp-title{font-family:'DM Mono',monospace;font-size:.58rem;letter-spacing:.1em;
text-transform:uppercase;font-weight:500;color:var(--a1)}
.hp-close{font-family:'DM Mono',monospace;font-size:.85rem;background:transparent;
border:none;cursor:pointer;color:var(--ink2);line-height:1;padding:0 .1rem}
.hp-close:hover{color:var(--ink)}
.hp-body{padding:.8rem 1.1rem 1.1rem;font-family:'DM Mono',monospace;font-size:.67rem;
line-height:1.8;color:var(--ink2);flex:1;min-height:0;overflow-y:auto}
.hp-sect{font-size:.52rem;letter-spacing:.1em;text-transform:uppercase;color:var(--ink2);
margin-top:.85rem;margin-bottom:.22rem;border-bottom:1px solid var(--grid);padding-bottom:.15rem}
.hp-sect:first-child{margin-top:0}
.hp-body strong{color:var(--ink)}
#intro-toggle-btn .tarr{display:inline-block;width:1em;text-align:center}
html{scrollbar-gutter:stable}
</style>
</head>
<body>
<div id="topbar">
<div>
<div class="hdr-h1">Distribution <em>Lab</em></div>
<div class="hdr-sub2">Normal · Gamma · Beta · Poisson · Binomial · GLM-Vorbereitung</div>
<div class="hdr-auth">© Dr. Rainer Düsing · Interactive Tools by Claude</div>
</div>
<div class="hdr-btns">
<button class="hbtn" onclick="window.open('index_de.html','_self')" style="border-color:var(--a5);color:var(--a5)">← Übersicht</button>
<button class="hbtn" id="btn-cheat" onclick="toggleCheat()" style="border-color:var(--a3);color:var(--a3)">📋 Cheat Sheet</button>
<button class="hbtn" id="btn-karte" onclick="toggleKarte()" style="border-color:var(--a4);color:var(--a4)">⊞ Beziehungen</button>
<button class="hbtn" onclick="toggleHelp()" style="border-color:var(--a1);color:var(--a1)">ℹ Hilfe</button>
<button class="hbtn" id="btn-theme" onclick="toggleTheme()">☀ Light</button>
</div>
</div>
<div class="intro-strip">
<div>
<strong>Distribution Lab</strong> — Wahrscheinlichkeitsverteilungen interaktiv erkunden.
· Parameter verschieben · Momente einblenden · brms-Rollen & Parametrisierung · X-Achse fixierbar · Ordinalmodelle
</div>
<button class="tbtn" id="intro-toggle-btn" onclick="toggleIntroDetail()">Konzept erklären <span class="tarr">▸</span></button>
</div>
<div id="intro-detail" style="display:none">
<div class="intro-box">
<div class="ib-head">Warum Verteilungen kennen?</div>
Jedes statistische Modell — ob klassisches <a class="glo-link" href="Glossar.html#gl-glm" target="_blank" title="Das Generalisierte Lineare Modell erweitert die gewöhnliche lineare Regression auf nicht-normalverteilte Outcomes." style="color:inherit">GLM</a> oder Bayesianisches Modell in <code>brms</code> — trifft eine <strong>Annahme über die Verteilung der abhängigen Variable</strong>, die <a class="glo-link" href="Glossar.html#gl-likelihood" target="_blank" title="Die Likelihood-Funktion L(θ; D) beschreibt, wie wahrscheinlich die beobachteten Daten D unter verschiedenen Parameterwerten θ wären." style="color:inherit">Likelihood</a>. Bevor du diese Annahme für eigene Daten begründet treffen kannst, hilft es, die gängigen Verteilungen aus eigener Anschauung zu kennen — wie sie aussehen, welche Parameter sie haben, für welche Art von Daten sie plausibel sind. Genau das ist der Zweck dieses Tools. Steht eine konkrete Entscheidung zwischen mehreren Kandidaten für einen eigenen Datensatz an, führt der <a class="glo-link" href="Likelihood_Compass.html" target="_blank" style="color:inherit">Likelihood Compass</a> dich geführt dorthin — inklusive Fit-Vergleich per <a class="glo-link" href="Glossar.html#gl-mle" target="_blank" title="Die Maximum-Likelihood-Schätzung sucht denjenigen Parameterwert θ̂, der die Wahrscheinlichkeit der beobachteten Daten maximiert: θ̂ = argmax p(D | θ)." style="color:inherit">Maximum Likelihood</a>.
<div class="ib-head ib-head2">Was haben die brms-Angaben hier schon zu suchen?</div>
Zu jeder Verteilung siehst du hier bereits ihre <strong><a class="glo-link" href="Glossar.html#gl-brms" target="_blank" title="brms ist ein R-Paket, das eine vertraute Formelschnittstelle für Bayesianische Regressionsmodelle bietet — die intern in Stan kompiliert und mit HMC/NUTS gesamplet werden." style="color:inherit">brms</a>-Rolle</strong> — Parametrisierung (z.B. μ, φ statt α, β) und <a class="glo-link" href="Glossar.html#gl-link-funktion" target="_blank" title="Die Link-Funktion g verbindet im Generalisierten Linearen Modell den linearen Prädiktor η = Xβ mit dem Erwartungswert μ = E[Y]: g(μ) = η, bzw. μ = g⁻¹(η)." style="color:inherit">Link-Funktion</a> —, obwohl <a class="glo-link" href="Glossar.html#gl-prior" target="_blank" title="Der Prior p(θ) ist die Wahrscheinlichkeitsverteilung über Modellparameter θ, die unser Vorwissen über diese Parameter vor Betrachtung der Daten ausdrückt." style="color:inherit">Priors</a>, Modellformeln & Co. an dieser Stelle noch gar nicht eingeführt wurden. Das ist Absicht: Diese Angaben greifen vorweg, was du später beim eigenen Modellbau brauchst, und müssen jetzt noch nicht vollständig verständlich sein. Sobald du im weiteren Workflow — etwa im <a class="glo-link" href="Brms_model_builder.html" target="_blank" style="color:inherit">brms Model Builder</a> — eigene Modelle baust, kannst du jederzeit hierher zurückkehren, um dich ausführlich über eine einzelne Verteilung samt ihrer brms-Parametrisierung zu informieren.
<div class="ib-head ib-head2">Praktische Extras</div>
<strong>📋 Cheat Sheet</strong> (oben) ist eine vollständige Referenz zum Nachschlagen — alle Symbole (Name, Aussprache, Merke) und die Parameterbedeutung jeder Verteilung gruppiert nach Kategorie, ohne dass du erst eine einzelne Verteilung auswählen musst. <strong>⊞ Beziehungen</strong> zeigt dagegen eine große Übersichtskarte mit allen Verteilungen dieses Tools und ihren Zusammenhängen — Spezialfälle, Grenzwerte, Konstruktionen —, zur Orientierung im „Verteilungs-Zoo".
</div>
</div>
<div id="cat-tabs"></div>
<div id="dist-strip"></div>
<div id="dl-outer">
<div id="dl-sidebar">
<div class="dl-dist-name" id="sb-name">Normal</div>
<div class="dl-notation" id="sb-notation">Y ~ Normal(μ, σ)</div>
<div class="scard" id="brms-toggle-wrap" style="display:none">
<div class="dl-sect-lbl">Parametrisierung</div>
<div class="brms-row">
<button class="brms-btn sel" id="btn-brms" onclick="setBrms(true)">brms (μ, φ)</button>
<button class="brms-btn" id="btn-classic" onclick="setBrms(false)">Klassisch (α, β)</button>
</div>
</div>
<div class="scard">
<div class="dl-sect-lbl">Parameter</div>
<div id="param-sliders"></div>
</div>
<div class="scard">
<div class="dl-sect-lbl">Momente einblenden</div>
<div class="moments-col">
<label class="moment-chk">
<input type="checkbox" id="chk-mean" checked onchange="renderDist()">
<span class="mdot mn"></span> Mittelwert E[Y]
</label>
<label class="moment-chk">
<input type="checkbox" id="chk-median" onchange="renderDist()">
<span class="mdot md"></span> Median
</label>
<label class="moment-chk">
<input type="checkbox" id="chk-mode" onchange="renderDist()">
<span class="mdot mo"></span> Modus
</label>
</div>
</div>
<div class="scard">
<div class="dl-sect-lbl">Kennwerte</div>
<div class="stats-block" id="stats-block"></div>
</div>
<div class="scard">
<div class="dl-sect-lbl">Zusätzliche Darstellung</div>
<label class="moment-chk">
<input type="checkbox" id="chk-ci95" onchange="renderDist()">
<span class="mdot ci"></span> Mittlere 95% (Wahrscheinlichkeitsmasse)
</label>
</div>
</div>
<div id="dl-right">
<div id="canvas-wrap">
<div class="canvas-toolbar">
<button class="xfix-btn" id="btn-reset" onclick="resetToDefault()" title="Parameter, Reglerbereiche und Achse auf die Standardwerte dieser Verteilung zurücksetzen">↺ Reset</button>
<button class="xfix-btn" id="btn-xfix" onclick="toggleXFix()">X fixiert</button>
</div>
<canvas id="dist-canvas" height="480"></canvas>
</div>
<div id="dist-info"></div>
</div>
</div>
<!-- Overlay Karte: Verteilungsbeziehungen -->
<div id="overlay-karte">
<div class="ok-box">
<div class="ok-head">
<span class="ok-title">Beziehungen zwischen Verteilungen</span>
<div style="display:flex;gap:.5rem;align-items:center">
<button class="ok-toggle" id="btn-symmini" onclick="toggleSymMini()">📖 Symbole</button>
<button class="ok-close" onclick="toggleKarte()">✕</button>
</div>
</div>
<div id="sym-mini" class="sym-mini">
<div class="oc-tbl-wrap" id="cheat-symbols-mini"></div>
<button class="sym-mini-link" onclick="toggleKarte();toggleCheat();">→ vollständiges Cheat Sheet</button>
</div>
<div class="ok-body">
<svg viewBox="0 0 1360 930" xmlns="http://www.w3.org/2000/svg" font-family="DM Mono,monospace" font-size="12">
<defs>
<marker id="arr" markerWidth="9" markerHeight="9" refX="8" refY="4" orient="auto">
<path d="M0,0 L9,4 L0,8 Z" fill="#888"/>
</marker>
<marker id="arr-grau" markerWidth="9" markerHeight="9" refX="8" refY="4" orient="auto">
<path d="M0,0 L9,4 L0,8 Z" fill="#aaa"/>
</marker>
<marker id="arr-cyan" markerWidth="9" markerHeight="9" refX="8" refY="4" orient="auto">
<path d="M0,0 L9,4 L0,8 Z" fill="#2bc7c4"/>
</marker>
<marker id="arr-orange" markerWidth="9" markerHeight="9" refX="8" refY="4" orient="auto">
<path d="M0,0 L9,4 L0,8 Z" fill="#e07830"/>
</marker>
<marker id="arr-green" markerWidth="9" markerHeight="9" refX="8" refY="4" orient="auto">
<path d="M0,0 L9,4 L0,8 Z" fill="#80cb52"/>
</marker>
<marker id="arr-blue" markerWidth="9" markerHeight="9" refX="8" refY="4" orient="auto">
<path d="M0,0 L9,4 L0,8 Z" fill="#4ab0d8"/>
</marker>
<marker id="arr-indigo" markerWidth="9" markerHeight="9" refX="8" refY="4" orient="auto">
<path d="M0,0 L9,4 L0,8 Z" fill="#6c5ce7"/>
</marker>
<marker id="arr-pink" markerWidth="9" markerHeight="9" refX="8" refY="4" orient="auto">
<path d="M0,0 L9,4 L0,8 Z" fill="#e0507a"/>
</marker>
</defs>
<!-- Legende -->
<text x="10" y="22" fill="#888" letter-spacing="1">LEGENDE:</text>
<line x1="95" y1="17" x2="140" y2="17" stroke="#888" stroke-width="2" marker-end="url(#arr)"/>
<text x="145" y="22" fill="#888">Grenzwert / Spezialfall</text>
<line x1="360" y1="17" x2="405" y2="17" stroke="#888" stroke-width="2" stroke-dasharray="5,3" marker-end="url(#arr)"/>
<text x="410" y="22" fill="#888">Konstruiert aus</text>
<line x1="580" y1="17" x2="625" y2="17" stroke="#aaa" stroke-width="1.5" stroke-dasharray="1.5,3.5" stroke-linecap="round" marker-end="url(#arr-grau)" opacity=".7"/>
<text x="630" y="22" fill="#888">Gruppenübergreifende Verwandtschaft</text>
<text x="910" y="23" font-size="14" fill="#888">⊕</text>
<text x="928" y="22" fill="#888">Faltung (Summe zweier Zufallsvariablen)</text>
<!-- ═══ GRUPPE 1: Kontinuierlich unbegrenzt ═══ -->
<rect x="10" y="36" width="1340" height="120" rx="4" fill="none" stroke="#2bc7c4" stroke-width="1.3" stroke-dasharray="5,4" opacity=".45"/>
<text x="20" y="54" fill="#2bc7c4" letter-spacing="1.5" opacity=".85">KONTINUIERLICH UNBEGRENZT</text>
<!-- Cauchy -->
<rect x="55" y="70" width="240" height="56" rx="5" fill="#2bc7c4" fill-opacity=".1" stroke="#2bc7c4" stroke-width="1.3"/>
<text x="175" y="96" text-anchor="middle" fill="#2bc7c4" font-size="15">Cauchy</text>
<text x="175" y="116" text-anchor="middle" fill="#2bc7c4" font-size="13">Cauchy(μ, σ)</text>
<!-- Student-t -->
<rect x="382" y="70" width="240" height="56" rx="5" fill="#2bc7c4" fill-opacity=".1" stroke="#2bc7c4" stroke-width="1.3"/>
<text x="502" y="96" text-anchor="middle" fill="#2bc7c4" font-size="15">Student-t</text>
<text x="502" y="116" text-anchor="middle" fill="#2bc7c4" font-size="13">Student-t(ν, μ, σ)</text>
<!-- Normal (primary) -->
<rect x="709" y="70" width="240" height="56" rx="5" fill="#2bc7c4" fill-opacity=".15" stroke="#2bc7c4" stroke-width="2"/>
<text x="829" y="97" text-anchor="middle" font-weight="bold" fill="#2bc7c4" font-size="17">Normal</text>
<text x="829" y="117" text-anchor="middle" fill="#2bc7c4" font-size="13">Normal(μ, σ)</text>
<!-- Skew-Normal -->
<rect x="1036" y="70" width="240" height="56" rx="5" fill="#2bc7c4" fill-opacity=".1" stroke="#2bc7c4" stroke-width="1.3"/>
<text x="1156" y="96" text-anchor="middle" fill="#2bc7c4" font-size="15">Skew-Normal</text>
<text x="1156" y="116" text-anchor="middle" fill="#2bc7c4" font-size="13">Skew-Normal(ξ, ω, α)</text>
<line x1="382" y1="98" x2="295" y2="98" stroke="#2bc7c4" stroke-width="2" marker-end="url(#arr-cyan)"/>
<text x="338" y="90" text-anchor="middle" fill="#2bc7c4">ν = 1</text>
<line x1="622" y1="98" x2="709" y2="98" stroke="#2bc7c4" stroke-width="2" marker-end="url(#arr-cyan)"/>
<text x="665" y="90" text-anchor="middle" fill="#2bc7c4">ν → ∞</text>
<line x1="1036" y1="98" x2="949" y2="98" stroke="#2bc7c4" stroke-width="2" marker-end="url(#arr-cyan)"/>
<text x="992" y="90" text-anchor="middle" fill="#2bc7c4">α = 0</text>
<!-- ═══ GRUPPE 2: Kontinuierlich positiv ═══ -->
<rect x="10" y="176" width="1340" height="186" rx="4" fill="none" stroke="#e07830" stroke-width="1.3" stroke-dasharray="5,4" opacity=".45"/>
<text x="20" y="194" fill="#e07830" letter-spacing="1.5" opacity=".85">KONTINUIERLICH POSITIV</text>
<!-- Row 1: Gamma, Exponential, ExGaussian, Log-Normal — Exponential/ExGaussian now
adjacent so their own σ→0 relationship can be shown directly. -->
<rect x="55" y="204" width="240" height="56" rx="5" fill="#e07830" fill-opacity=".15" stroke="#e07830" stroke-width="2"/>
<text x="175" y="231" text-anchor="middle" font-weight="bold" fill="#e07830" font-size="17">Gamma</text>
<text x="175" y="251" text-anchor="middle" fill="#e07830" font-size="13">Gamma(α, β)</text>
<rect x="382" y="204" width="240" height="56" rx="5" fill="#e07830" fill-opacity=".1" stroke="#e07830" stroke-width="1.3"/>
<text x="502" y="230" text-anchor="middle" fill="#e07830" font-size="15">Exponential</text>
<text x="502" y="250" text-anchor="middle" fill="#e07830" font-size="13">Exponential(λ)</text>
<rect x="709" y="204" width="240" height="56" rx="5" fill="#e07830" fill-opacity=".1" stroke="#e07830" stroke-width="1.3" stroke-dasharray="5,4"/>
<text x="829" y="230" text-anchor="middle" fill="#e07830" font-size="15">ExGaussian</text>
<text x="829" y="250" text-anchor="middle" fill="#e07830" font-size="13">ExGauss(μ, σ, β)</text>
<text x="829" y="274" text-anchor="middle" fill="#e07830" font-size="11.5" opacity=".85">= Normal(μ,σ) ⊕ Exponential(β)</text>
<rect x="1036" y="204" width="240" height="56" rx="5" fill="#e07830" fill-opacity=".1" stroke="#e07830" stroke-width="1.3"/>
<text x="1156" y="230" text-anchor="middle" fill="#e07830" font-size="15">Log-Normal</text>
<text x="1156" y="250" text-anchor="middle" fill="#e07830" font-size="13">LogNormal(μ, σ)</text>
<line x1="295" y1="232" x2="382" y2="232" stroke="#e07830" stroke-width="2" marker-end="url(#arr-orange)"/>
<text x="338" y="224" text-anchor="middle" fill="#e07830">α = 1</text>
<line x1="709" y1="232" x2="622" y2="232" stroke="#e07830" stroke-width="2" marker-end="url(#arr-orange)"/>
<text x="665" y="224" text-anchor="middle" fill="#e07830">σ → 0</text>
<!-- Row 2: Chi², F-Verteilung, Weibull, Inverse Gauß, Shifted LogNormal — 5 narrower
boxes (200 instead of 240) to make room for Weibull, which was missing. -->
<rect x="55" y="292" width="200" height="56" rx="5" fill="#e07830" fill-opacity=".1" stroke="#e07830" stroke-width="1.3"/>
<text x="155" y="318" text-anchor="middle" fill="#e07830" font-size="15">Chi²</text>
<text x="155" y="338" text-anchor="middle" fill="#e07830" font-size="13">χ²(k)</text>
<rect x="310" y="292" width="200" height="56" rx="5" fill="#e07830" fill-opacity=".1" stroke="#e07830" stroke-width="1.3"/>
<text x="410" y="318" text-anchor="middle" fill="#e07830" font-size="14">F-Verteilung</text>
<text x="410" y="338" text-anchor="middle" fill="#e07830" font-size="13">F(d₁, d₂)</text>
<rect x="565" y="292" width="200" height="56" rx="5" fill="#e07830" fill-opacity=".1" stroke="#e07830" stroke-width="1.3"/>
<text x="665" y="318" text-anchor="middle" fill="#e07830" font-size="15">Weibull</text>
<text x="665" y="338" text-anchor="middle" fill="#e07830" font-size="13">Weibull(k, λ)</text>
<rect x="820" y="292" width="200" height="56" rx="5" fill="#e07830" fill-opacity=".1" stroke="#e07830" stroke-width="1.3"/>
<text x="920" y="318" text-anchor="middle" fill="#e07830" font-size="14">Inverse Gauß</text>
<text x="920" y="338" text-anchor="middle" fill="#e07830" font-size="13">InvGauß(μ, λ)</text>
<rect x="1075" y="292" width="200" height="56" rx="5" fill="#e07830" fill-opacity=".1" stroke="#e07830" stroke-width="1.3" stroke-dasharray="5,4"/>
<text x="1175" y="317" text-anchor="middle" fill="#e07830" font-size="13">Shifted LogNormal</text>
<text x="1175" y="337" text-anchor="middle" fill="#e07830" font-size="11.5">ShiftedLogNormal(μ,σ,δ)</text>
<line x1="175" y1="260" x2="155" y2="292" stroke="#e07830" stroke-width="2" marker-end="url(#arr-orange)"/>
<text x="200" y="280" fill="#e07830">= Gamma(k/2, ½)</text>
<line x1="255" y1="320" x2="310" y2="320" stroke="#e07830" stroke-width="2" stroke-dasharray="5,3" marker-end="url(#arr-orange)"/>
<text x="282" y="311" text-anchor="middle" fill="#e07830">χ²∕χ²</text>
<line x1="665" y1="292" x2="502" y2="260" stroke="#e07830" stroke-width="2" marker-end="url(#arr-orange)"/>
<text x="540" y="288" text-anchor="middle" fill="#e07830" font-size="11.5">k = 1</text>
<line x1="1156" y1="260" x2="1175" y2="292" stroke="#e07830" stroke-width="2" stroke-dasharray="5,3" marker-end="url(#arr-orange)"/>
<text x="1195" y="280" text-anchor="start" fill="#e07830" font-size="11.5">+ δ (Shift)</text>
<!-- Cross-group: Normal → ExGaussian, Normal → Log-Normal
Both arrows are long diagonals that pass directly through their own
label text — a paper-colored halo rect behind each label (drawn
after the lines, before the text) keeps the arrow from cutting
through the letters while still reading as "the same line". -->
<line x1="829" y1="126" x2="829" y2="204" stroke="#6c5ce7" stroke-width="1.5" stroke-dasharray="1.5,3.5" stroke-linecap="round" marker-end="url(#arr-indigo)" opacity=".65"/>
<line x1="829" y1="126" x2="1150" y2="204" stroke="#e0507a" stroke-width="1.5" stroke-dasharray="1.5,3.5" stroke-linecap="round" marker-end="url(#arr-pink)" opacity=".65"/>
<rect x="547" y="156" width="268" height="16" style="fill:var(--paper)"/>
<text x="815" y="168" text-anchor="end" fill="#6c5ce7">⊕ Exponential (gruppenübergreifend)</text>
<rect x="986" y="183" width="254" height="16" style="fill:var(--paper)"/>
<text x="1113" y="195" text-anchor="middle" fill="#e0507a">Y = exp(X) (gruppenübergreifend)</text>
<!-- ═══ GRUPPE 3: Begrenzt ═══ -->
<rect x="10" y="382" width="1340" height="130" rx="4" fill="none" stroke="#80cb52" stroke-width="1.3" stroke-dasharray="5,4" opacity=".45"/>
<text x="20" y="400" fill="#80cb52" letter-spacing="1.5" opacity=".85">BEGRENZT</text>
<rect x="55" y="420" width="200" height="76" rx="5" fill="#80cb52" fill-opacity=".15" stroke="#80cb52" stroke-width="2"/>
<text x="155" y="447" text-anchor="middle" font-weight="bold" fill="#80cb52" font-size="17">Beta</text>
<text x="155" y="467" text-anchor="middle" fill="#80cb52" font-size="13">Beta(α, β)</text>
<text x="155" y="487" text-anchor="middle" fill="#80cb52" font-size="11">Beta(1,1) = Uniform[0,1]</text>
<rect x="310" y="420" width="200" height="76" rx="5" fill="#80cb52" fill-opacity=".1" stroke="#80cb52" stroke-width="1.3"/>
<text x="410" y="452" text-anchor="middle" fill="#80cb52" font-size="15">ZI-Beta</text>
<text x="410" y="472" text-anchor="middle" fill="#80cb52" font-size="12.5">ZI-Beta(μ, φ, zi)</text>
<rect x="565" y="420" width="200" height="76" rx="5" fill="#80cb52" fill-opacity=".1" stroke="#80cb52" stroke-width="1.3"/>
<text x="665" y="452" text-anchor="middle" fill="#80cb52" font-size="15">ZOIB</text>
<text x="665" y="472" text-anchor="middle" fill="#80cb52" font-size="12">ZOIB(μ, φ, zoi, coi)</text>
<rect x="820" y="420" width="200" height="76" rx="5" fill="#80cb52" fill-opacity=".1" stroke="#80cb52" stroke-width="1.3"/>
<text x="920" y="447" text-anchor="middle" fill="#80cb52" font-size="15">Bernoulli</text>
<text x="920" y="467" text-anchor="middle" fill="#80cb52" font-size="13">Bernoulli(p)</text>
<text x="920" y="487" text-anchor="middle" fill="#80cb52" font-size="11">Beta = konj. Prior für p</text>
<rect x="1075" y="420" width="200" height="76" rx="5" fill="#80cb52" fill-opacity=".1" stroke="#80cb52" stroke-width="1.3"/>
<text x="1175" y="447" text-anchor="middle" fill="#80cb52" font-size="15">LKJ</text>
<text x="1175" y="467" text-anchor="middle" fill="#80cb52" font-size="13">LKJ(η)</text>
<text x="1175" y="487" text-anchor="middle" fill="#80cb52" font-size="11">ρ = 2·Beta(η,η) − 1</text>
<line x1="255" y1="458" x2="310" y2="458" stroke="#80cb52" stroke-width="2" stroke-dasharray="5,3" marker-end="url(#arr-green)"/>
<text x="282" y="450" text-anchor="middle" fill="#80cb52" font-size="11">+ 0 (zi)</text>
<line x1="510" y1="458" x2="565" y2="458" stroke="#80cb52" stroke-width="2" stroke-dasharray="5,3" marker-end="url(#arr-green)"/>
<text x="537" y="450" text-anchor="middle" fill="#80cb52" font-size="11">+ 1 (zoi)</text>
<!-- ═══ GRUPPE 4: Zähldaten ═══ -->
<rect x="10" y="532" width="1340" height="130" rx="4" fill="none" stroke="#4ab0d8" stroke-width="1.3" stroke-dasharray="5,4" opacity=".45"/>
<text x="20" y="550" fill="#4ab0d8" letter-spacing="1.5" opacity=".85">ZÄHLDATEN (DISKRET)</text>
<rect x="55" y="570" width="240" height="56" rx="5" fill="#4ab0d8" fill-opacity=".1" stroke="#4ab0d8" stroke-width="1.3"/>
<text x="175" y="596" text-anchor="middle" fill="#4ab0d8" font-size="14">Beta-Binomial</text>
<text x="175" y="616" text-anchor="middle" fill="#4ab0d8" font-size="12">BetaBin(n, μ, φ)</text>
<rect x="382" y="570" width="240" height="56" rx="5" fill="#4ab0d8" fill-opacity=".1" stroke="#4ab0d8" stroke-width="1.3"/>
<text x="502" y="596" text-anchor="middle" fill="#4ab0d8" font-size="15">Binomial</text>
<text x="502" y="616" text-anchor="middle" fill="#4ab0d8" font-size="13">Binomial(n, p)</text>
<rect x="709" y="570" width="240" height="56" rx="5" fill="#4ab0d8" fill-opacity=".15" stroke="#4ab0d8" stroke-width="2"/>
<text x="829" y="597" text-anchor="middle" font-weight="bold" fill="#4ab0d8" font-size="17">Poisson</text>
<text x="829" y="617" text-anchor="middle" fill="#4ab0d8" font-size="13">Poisson(λ)</text>
<rect x="1036" y="570" width="240" height="56" rx="5" fill="#4ab0d8" fill-opacity=".1" stroke="#4ab0d8" stroke-width="1.3"/>
<text x="1156" y="596" text-anchor="middle" fill="#4ab0d8" font-size="14">Neg. Binomial</text>
<text x="1156" y="616" text-anchor="middle" fill="#4ab0d8" font-size="12.5">NegBin(μ, shape)</text>
<line x1="295" y1="598" x2="382" y2="598" stroke="#4ab0d8" stroke-width="2" marker-end="url(#arr-blue)"/>
<text x="338" y="583" text-anchor="middle" fill="#4ab0d8">φ → ∞</text>
<line x1="622" y1="598" x2="709" y2="598" stroke="#4ab0d8" stroke-width="2" marker-end="url(#arr-blue)"/>
<text x="665" y="583" text-anchor="middle" fill="#4ab0d8">n→∞, p→0</text>
<line x1="1036" y1="598" x2="949" y2="598" stroke="#4ab0d8" stroke-width="2" marker-end="url(#arr-blue)"/>
<text x="992" y="583" text-anchor="middle" fill="#4ab0d8">shape → ∞</text>
<!-- Cross-group: Beta → Beta-Binomial, Bernoulli → Binomial — same halo
treatment as the two cross-group arrows above. -->
<line x1="155" y1="496" x2="155" y2="570" stroke="#aaa" stroke-width="1.5" stroke-dasharray="1.5,3.5" stroke-linecap="round" marker-end="url(#arr-grau)" opacity=".55"/>
<line x1="502" y1="570" x2="920" y2="496" stroke="#aaa" stroke-width="1.5" stroke-dasharray="1.5,3.5" stroke-linecap="round" marker-end="url(#arr-grau)" opacity=".55"/>
<rect x="170" y="521" width="70" height="16" style="fill:var(--paper)"/>
<text x="175" y="533" fill="#888">p ~ Beta</text>
<rect x="755" y="521" width="48" height="16" style="fill:var(--paper)"/>
<text x="779" y="533" text-anchor="middle" fill="#888">n = 1</text>
<!-- ═══ GRUPPE 5: Ordinal ═══ -->
<rect x="10" y="682" width="1340" height="140" rx="4" fill="none" stroke="#b57edb" stroke-width="1.3" stroke-dasharray="5,4" opacity=".45"/>
<text x="20" y="700" fill="#b57edb" letter-spacing="1.5" opacity=".85">GEORDNETE KATEGORIEN (ORDINAL)</text>
<text x="680" y="714" text-anchor="middle" fill="#b57edb" font-size="11.5">gleiche latente Struktur, unterschiedliche Link-Funktion (Normal ↔ Logistisch)</text>
<rect x="350" y="724" width="280" height="56" rx="5" fill="#b57edb" fill-opacity=".12" stroke="#b57edb" stroke-width="1.6"/>
<text x="490" y="751" text-anchor="middle" fill="#b57edb" font-size="16">Kum. Probit</text>
<text x="490" y="771" text-anchor="middle" fill="#b57edb" font-size="12.5">OrderedProbit(η,τ,Δ,K)</text>
<rect x="730" y="724" width="280" height="56" rx="5" fill="#b57edb" fill-opacity=".12" stroke="#b57edb" stroke-width="1.6"/>
<text x="870" y="751" text-anchor="middle" fill="#b57edb" font-size="16">Kum. Logit</text>
<text x="870" y="771" text-anchor="middle" fill="#b57edb" font-size="12.5">OrderedLogit(η,τ,Δ,K)</text>
<line x1="630" y1="752" x2="730" y2="752" stroke="#b57edb" stroke-width="2" stroke-dasharray="2,3"/>
<text x="680" y="800" text-anchor="middle" fill="#888">Bei K=2 Kategorien ≈ binäre Logit-/Probit-Regression (Gruppen „Zähldaten"/„Begrenzt")</text>
<!-- ═══ HINWEIS ═══ -->
<text x="680" y="846" text-anchor="middle" fill="#888">Normal = Grenzwert von Student-t (ν→∞), Skew-Normal (α=0), Gamma (α→∞) und Binomial (n→∞, p→0)</text>
<text x="680" y="866" text-anchor="middle" fill="#888">χ²(k) = Z₁² + … + Zₖ² (Zᵢ ~ Normal(0,1)) — zugleich Spezialfall Gamma(k/2, ½)</text>
<text x="680" y="886" text-anchor="middle" fill="#888">Fett = Referenzverteilung je Gruppe · gestrichelter Rahmen = „konstruierte" Verteilung (ExGaussian, Shifted LogNormal)</text>
<text x="680" y="906" text-anchor="middle" fill="#888" font-size="11" opacity=".8">Alle Verteilungen des Distribution Lab · Quelle: Ben Lambert, A Student's Guide to Bayesian Statistics (2018), S. 225</text>
</svg>
</div>
</div>
</div>
<!-- Overlay Cheat Sheet: Symbole & Parameter -->
<div id="overlay-cheat">
<div class="ok-box">
<div class="ok-head">
<span class="ok-title">Cheat Sheet — Symbole & Parameter</span>
<div style="display:flex;gap:.5rem;align-items:center">
<button class="ok-toggle" onclick="toggleCheat();toggleKarte();">⊞ Beziehungen</button>
<button class="ok-close" onclick="toggleCheat()">✕</button>
</div>
</div>
<div class="oc-body">
<div class="oc-sect-title">1. Wie heißen die Symbole?</div>
<div class="oc-tbl-wrap" id="cheat-symbols-full"></div>
<div class="oc-sect-title">2. Parameter je Verteilung</div>
<div class="cheat-note" style="margin:0 0 .6rem">Die letzte Spalte zeigt, wie dieselbe Verteilung in <strong>brms</strong> parametrisiert wird (in Klammern: Link-Funktion des jeweiligen Parameters). <strong>Fett</strong> markiert, wo brms von der Schreibweise in den Spalten davor abweicht.</div>
<div class="oc-group-h">Kontinuierlich unbegrenzt</div>
<div class="oc-tbl-wrap"><table class="cheat-tbl"><thead><tr><th>Verteilung</th><th>Schreibweise</th><th>Bedeutung der Parameter</th><th>In brms</th></tr></thead><tbody>
<tr><td>Cauchy</td><td>Cauchy(μ, σ)</td><td>μ: Lageparameter; entspricht Median und Modus. Ein Mittelwert existiert bei Cauchy nicht.<br>σ: Skalenparameter (Breite) — keine Standardabweichung; auch die Varianz ist nicht definiert.</td><td class="cheat-brms">Keine eigene Familie. Likelihood: <code>student()</code> mit festem ν = 1 (<code>prior(constant(1), class = nu)</code>). Als Prior: <code>cauchy(μ, σ)</code>.</td></tr>
<tr><td>Student-t</td><td>Student-t(ν, μ, σ)</td><td>ν (Nu): Freiheitsgrade, bei Kruschke <a class="glo-link" href="Glossar.html#gl-normalitaetsparameter" target="_blank" title="Kruschkes Bezeichnung für den Parameter ν der Student-t-Verteilung (sonst Freiheitsgrade). Für ν → ∞ wird sie zur Normalverteilung, kleine ν bedeuten schwere Ränder und mehr Ausreißer.">Normalitätsparameter</a>; kleine ν → schwerere Tails, große ν → Annäherung an Normal.<br>μ: Lageparameter; bei ν > 1 auch der Mittelwert.<br>σ: Skalenparameter, nicht generell die tatsächliche SD. Für ν > 2 gilt SD = σ·√(ν/(ν−2)).</td><td class="cheat-brms"><code>student()</code> — μ (Link: identity), σ = <code>sigma</code>, ν = <code>nu</code>. Gleiche Parametrisierung wie hier; σ und ν lassen sich auch per Formel modellieren, z. B. <code>sigma ~ gruppe</code>.</td></tr>
<tr><td>Normal</td><td>Normal(μ, σ)</td><td>μ: Mittelwert / Lage.<br>σ: Standardabweichung.</td><td class="cheat-brms"><code>gaussian()</code> — μ (identity), σ = <code>sigma</code>. Identisch zur Schreibweise hier.</td></tr>
<tr><td>Skew-Normal</td><td>Skew-Normal(ξ, ω, α)</td><td>ξ (Xi): Lageparameter.<br>ω (Omega): Skalenparameter (> 0).<br>α: Shape-/Schiefeparameter; α = 0 ergibt die Normalverteilung. ξ und ω sind bei Schiefe nicht einfach identisch mit Mittelwert und SD.</td><td class="cheat-brms"><code>skew_normal()</code> — <b>μ ist der tatsächliche Mittelwert, σ die tatsächliche SD</b> (nicht ξ und ω), α = <code>alpha</code>. Umrechnung: ω = σ/√(1 − 2δ²/π) mit δ = α/√(1+α²), ξ = μ − ω·δ·√(2/π).</td></tr>
</tbody></table></div>
<div class="oc-group-h">Kontinuierlich positiv</div>
<div class="oc-tbl-wrap"><table class="cheat-tbl"><thead><tr><th>Verteilung</th><th>Schreibweise</th><th>Bedeutung der Parameter</th><th>In brms</th></tr></thead><tbody>
<tr><td>Gamma</td><td>Gamma(α, β)</td><td>α: Shape-Parameter; bestimmt die Form der Verteilung.<br>β: Rate-Parameter in der hier gezeigten klassischen Shape-Rate-Parametrisierung. Mittelwert = α/β. Achtung: β wird anderswo auch als Scale verwendet.</td><td class="cheat-brms"><code>Gamma(link = "log")</code> — <b>μ = Mittelwert</b> (Link: log), α = <code>shape</code>. Die Rate ist β = shape/μ. (Der brms-Standardlink wäre inverse; log ist gebräuchlicher.)</td></tr>
<tr><td>Exponential</td><td>Exponential(λ)</td><td>λ (Lambda): Rate/Ereignisrate. Mittelwert der Wartezeit = 1/λ. In brms wird die Likelihood häufig über den Mittelwert μ parametrisiert — das ist eine andere Schreibweise.</td><td class="cheat-brms"><code>exponential(link = "log")</code> — <b>μ = Mittelwert = 1/λ</b> (Link: log). Kein weiterer Parameter.</td></tr>
<tr><td>ExGaussian</td><td>ExGauss(μ, σ, β)</td><td>μ: Mittelwert der Normal-Komponente.<br>σ: SD der Normal-Komponente.<br>β: Mittelwert/Scale der Exponential-Komponente; deren Rate ist 1/β. Gesamtmittelwert: E[Y] = μ + β.</td><td class="cheat-brms"><code>exgaussian()</code> — <b>μ = Gesamtmittelwert E[Y]</b> (identity), σ = <code>sigma</code>, β = <code>beta</code>. Die Normalkomponente hat den Mittelwert μ<sub>brms</sub> − β, d. h. μ<sub>hier</sub> = μ<sub>brms</sub> − β.</td></tr>
<tr><td>Log-Normal</td><td>Lognormal(μ, σ)</td><td>μ: Mittelwert von log(Y), nicht der Mittelwert von Y auf Originalskala.<br>σ: SD von log(Y), nicht die SD von Y auf Originalskala.</td><td class="cheat-brms"><code>lognormal()</code> — μ = Mittelwert von log(Y) (identity), σ = <code>sigma</code> (SD von log(Y)). Identisch zur Schreibweise hier.</td></tr>
<tr><td>Shifted LogNormal</td><td>ShiftedLogNormal(μ, σ, δ)</td><td>μ: Mittelwert der Log-Werte des unverschobenen positiven Anteils.<br>σ: SD der Log-Werte.<br>δ (Delta, klein): additiver Shift / untere Grenze; verschiebt die Verteilung nach rechts. <em>Nicht zu verwechseln mit Δ (groß) bei den Ordinalmodellen unten.</em></td><td class="cheat-brms"><code>shifted_lognormal()</code> — μ und σ wie bei Log-Normal, δ = <code>ndt</code> (Non-Decision-Time; muss kleiner als min(Y) sein).</td></tr>
<tr><td>Chi²</td><td>χ²(k)</td><td>k: Freiheitsgrade. Eine χ²-Verteilung mit k Freiheitsgraden ist ein Spezialfall der Gamma-Verteilung: Gamma(shape = k/2, rate = 1/2).</td><td class="cheat-brms">Keine brms-Familie. Spezialfall von Gamma: shape = k/2, rate = 1/2. Als Prior selten: <code>chi_square(k)</code>.</td></tr>
<tr><td>F-Verteilung</td><td>F(d₁, d₂)</td><td>d₁: Freiheitsgrade im Zähler.<br>d₂: Freiheitsgrade im Nenner. Die F-Verteilung entsteht aus dem Verhältnis zweier passend skalierter Chi²-Variablen.</td><td class="cheat-brms">Keine brms-Familie. In Bayes-Analysen ersetzt durch Modellvergleich, z. B. mit <code>loo()</code>.</td></tr>
<tr><td>Weibull</td><td>Weibull(k, λ)</td><td>k: Shape-Parameter; steuert Form und Verlauf der Hazard-Funktion.<br>λ (Lambda): Scale-Parameter. Bei k = 1 entsteht eine Exponentialverteilung; wenn dort λ als Rate geschrieben wird, gilt Rate = 1/λ (Weibull-Scale).</td><td class="cheat-brms"><code>weibull()</code> — <b>μ = Mittelwert</b> (Link: log), k = <code>shape</code>. Die Scale ist λ = μ/Γ(1 + 1/k).</td></tr>
<tr><td>Inverse Gauß</td><td>InvGauss(μ, λ)</td><td>μ: Mittelwert (> 0).<br>λ (Lambda): Shape-/Präzisionsparameter; größere λ → geringere relative Streuung. Varianz = μ³/λ.</td><td class="cheat-brms"><code>inverse.gaussian()</code> — μ (Link: <code>1/mu^2</code>, alternativ log), λ = <code>shape</code>.</td></tr>
<tr><td>Hurdle-Gamma</td><td>HurdleGamma(μ, φ, hu)</td><td>μ: Mittelwert der Gamma-Komponente für Y > 0.<br>φ (Phi): Shape/Präzision; Var = μ²/φ.<br>hu: Wahrscheinlichkeit der Hürde, P(Y = 0).</td><td class="cheat-brms"><code>hurdle_gamma()</code> — μ (Link: log), φ = <code>shape</code> (log), <code>hu</code> (logit; per Formel modellierbar, z. B. <code>hu ~ x2</code>).</td></tr>
<tr><td>Hurdle-Lognormal</td><td>HurdleLogNormal(μ, σ, hu)</td><td>μ: Mittelwert von log(Y) für Y > 0.<br>σ: SD von log(Y).<br>hu: Wahrscheinlichkeit der Hürde, P(Y = 0).</td><td class="cheat-brms"><code>hurdle_lognormal()</code> — μ (identity), σ = <code>sigma</code> (log), <code>hu</code> (logit).</td></tr>
</tbody></table></div>
<div class="oc-group-h">Begrenzt</div>
<div class="oc-tbl-wrap"><table class="cheat-tbl"><thead><tr><th>Verteilung</th><th>Schreibweise</th><th>Bedeutung der Parameter</th><th>In brms</th></tr></thead><tbody>
<tr><td>Beta</td><td>Beta(α, β)</td><td>α, β: zwei positive Shape-Parameter. Gemeinsam bestimmen sie Lage und Form. Mittelwert = α/(α+β). Beta(1,1) = Uniform(0,1).</td><td class="cheat-brms"><code>Beta()</code> — μ (Link: logit), φ = <code>phi</code> (log). Umrechnung: α = μ·φ, β = (1−μ)·φ.</td></tr>
<tr><td>ZI-Beta</td><td>ZI-Beta(μ, φ, zi)</td><td>μ: Mittelwert des kontinuierlichen Beta-Anteils (zwischen 0 und 1).<br>φ (Phi): Präzision/Konzentration des Beta-Anteils; größer φ → stärkere Bündelung um μ.<br>zi: Wahrscheinlichkeit einer zusätzlichen Punktmasse bei 0 (Zero Inflation).</td><td class="cheat-brms"><code>zero_inflated_beta()</code> — μ (logit), φ = <code>phi</code> (log), <code>zi</code> (logit; per Formel modellierbar).</td></tr>
<tr><td>ZOIB</td><td>ZOIB(μ, φ, zoi, coi)</td><td>μ: Mittelwert des kontinuierlichen Beta-Anteils.<br>φ: Präzision des Beta-Anteils.<br>zoi: Gesamtwahrscheinlichkeit für eine zusätzliche 0-oder-1-Punktmasse.<br>coi: bedingte Wahrscheinlichkeit für 1 innerhalb dieser 0/1-Punktmasse. Damit: P(0) = zoi·(1−coi), P(1) = zoi·coi.</td><td class="cheat-brms"><code>zero_one_inflated_beta()</code> — μ (logit), φ = <code>phi</code> (log), <code>zoi</code> und <code>coi</code> (beide logit; per Formel modellierbar).</td></tr>
<tr><td>Bernoulli</td><td>Bernoulli(p)</td><td>p: Erfolgswahrscheinlichkeit P(Y=1). Y kann nur 0 oder 1 annehmen. Beta ist der konjugierte Prior für p.</td><td class="cheat-brms"><code>bernoulli()</code> — p = μ, Link: logit: p = 1/(1+e<sup>−Xβ</sup>).</td></tr>
<tr><td>LKJ <span class="cheat-note" style="margin:0">(Verteilung über Korrelationsmatrizen, nicht über [0,1])</span></td><td>LKJ(η)</td><td>η (Eta): einziger Parameter, Konzentration um die Identitätsmatrix. η=1: uniform über alle Korrelationsmatrizen. η>1: reguliert Richtung ρ=0. Gezeigt wird die Randverteilung einer einzelnen Korrelation ρ ∈ (−1,1) im 2×2-Fall.</td><td class="cheat-brms">Nie Likelihood, nur Prior: <code>prior(lkj(2), class = cor)</code>, wobei η das Argument von <code>lkj()</code> ist.</td></tr>
</tbody></table></div>
<div class="oc-group-h">Zähldaten (diskret)</div>
<div class="oc-tbl-wrap"><table class="cheat-tbl"><thead><tr><th>Verteilung</th><th>Schreibweise</th><th>Bedeutung der Parameter</th><th>In brms</th></tr></thead><tbody>
<tr><td>Beta-Binomial</td><td>BetaBin(n, μ, φ)</td><td>n: Anzahl der Versuche.<br>μ: mittlere Erfolgswahrscheinlichkeit.<br>φ: Präzision/Konzentration der zugrunde liegenden Beta-Verteilung; kleiner φ → mehr Heterogenität/Überdispersion, φ → ∞ → Binomial.</td><td class="cheat-brms"><code>beta_binomial()</code> mit <code>k | trials(n) ~ …</code> — μ (Link: logit), φ = <code>phi</code> (log). Umrechnung: α = μ·φ, β = (1−μ)·φ.</td></tr>
<tr><td>Binomial</td><td>Binomial(n, p)</td><td>n: Anzahl unabhängiger Versuche.<br>p: Erfolgswahrscheinlichkeit pro Versuch.</td><td class="cheat-brms"><code>binomial()</code> mit <code>k | trials(n) ~ …</code> — p (Link: logit).</td></tr>
<tr><td>Poisson</td><td>Poisson(λ)</td><td>λ (Lambda): erwartete Ereigniszahl / Rate im betrachteten Intervall. Bei der Poisson-Verteilung gilt E[Y] = Var(Y) = λ.</td><td class="cheat-brms"><code>poisson()</code> — λ = exp(Xβ) (Link: log).</td></tr>
<tr><td>Neg. Binomial</td><td>NegBin(μ, shape)</td><td>μ: erwartete Ereigniszahl.<br>shape: Dispersions-/Shape-Parameter. Größerer shape → weniger zusätzliche Streuung; shape → ∞ → Poisson. In dieser Parametrisierung: Var(Y) = μ + μ²/shape.</td><td class="cheat-brms"><code>negbinomial()</code> — μ (Link: log), <code>shape</code> (log). Heißt in brms <code>shape</code>, nicht φ; Var(Y) = μ + μ²/shape. Gleiche Parametrisierung wie hier.</td></tr>
<tr><td>ZI-Poisson</td><td>ZIPoisson(λ, zi)</td><td>λ: Rate der Poisson-Komponente.<br>zi: Wahrscheinlichkeit einer zusätzlichen strukturellen Null.</td><td class="cheat-brms"><code>zero_inflated_poisson()</code> — λ = μ (Link: log), <code>zi</code> (logit).</td></tr>
<tr><td>ZI-NegBinomial</td><td>ZINegBin(μ, φ, zi)</td><td>μ: Mittelwert der NegBin-Komponente.<br>φ: Überdispersion (shape).<br>zi: Wahrscheinlichkeit einer zusätzlichen strukturellen Null.</td><td class="cheat-brms"><code>zero_inflated_negbinomial()</code> — μ (log), φ = <code>shape</code> (log), <code>zi</code> (logit).</td></tr>
<tr><td>ZI-Binomial</td><td>ZIBinomial(n, p, zi)</td><td>n: Anzahl der Versuche.<br>p: Erfolgswahrscheinlichkeit.<br>zi: Wahrscheinlichkeit einer zusätzlichen strukturellen Null.</td><td class="cheat-brms"><code>zero_inflated_binomial()</code> mit <code>trials(n)</code> — p = μ (logit), <code>zi</code> (logit).</td></tr>
<tr><td>Hurdle-Poisson</td><td>HurdlePoisson(λ, hu)</td><td>λ: Rate der ungestutzten Poisson-Basisverteilung.<br>hu: Wahrscheinlichkeit der Hürde, P(Y = 0); positive Werte folgen der bei 0 gestutzten Poisson.</td><td class="cheat-brms"><code>hurdle_poisson()</code> — λ = μ (Link: log), <code>hu</code> (logit). Achtung: E[Y] = (1−hu)·μ/(1−e<sup>−μ</sup>).</td></tr>
<tr><td>Hurdle-NegBinomial</td><td>HurdleNegBin(μ, φ, hu)</td><td>μ: Mittelwert der ungestutzten NegBin-Basisverteilung.<br>φ: Überdispersion (shape).<br>hu: Wahrscheinlichkeit der Hürde, P(Y = 0).</td><td class="cheat-brms"><code>hurdle_negbinomial()</code> — μ (log), φ = <code>shape</code> (log), <code>hu</code> (logit).</td></tr>
</tbody></table></div>
<div class="oc-group-h">Geordnete Kategorien (ordinal)</div>
<div class="oc-tbl-wrap"><table class="cheat-tbl"><thead><tr><th>Modell</th><th>Schreibweise</th><th>Bedeutung der Parameter</th><th>In brms</th></tr></thead><tbody>
<tr><td>Kumulatives Probit</td><td>OrderedProbit(η, τ, Δ, K)</td><td>η (Eta): linearer Prädiktor / Position auf der latenten kontinuierlichen Skala.<br>τ (Tau): geordnete Schwellenwerte (Cutpoints), die die Kategorien trennen.<br>Δ (Delta, groß): Abstand zwischen den Schwellenwerten (hier gleichmäßig angenommen, nur zur Illustration). <em>Nicht zu verwechseln mit δ (klein) bei Shifted LogNormal oben.</em><br>K: Anzahl der ordinalen Kategorien. Probit nutzt die Normal-CDF als Link.</td><td class="cheat-brms"><code>cumulative("probit")</code> — η = Formelterm ohne Intercept. Die K−1 Schwellen werden einzeln geschätzt (<code>Intercept[1]</code>, <code>Intercept[2]</code>, …), nicht über ein gemeinsames Δ. <code>disc</code> ist auf 1 fixiert.</td></tr>
<tr><td>Kumulatives Logit</td><td>OrderedLogit(η, τ, Δ, K)</td><td>η: linearer Prädiktor / Position auf der latenten Skala.<br>τ: geordnete Schwellenwerte.<br>Δ: Abstand zwischen den Schwellenwerten (hier gleichmäßig angenommen, nur zur Illustration).<br>K: Anzahl der Kategorien. Logit nutzt die logistische CDF als Link.</td><td class="cheat-brms"><code>cumulative("logit")</code> — η = Formelterm ohne Intercept. Die K−1 Schwellen werden einzeln geschätzt (<code>Intercept[1]</code>, …), nicht über ein gemeinsames Δ. <code>disc</code> ist auf 1 fixiert.</td></tr>
</tbody></table></div>
<div class="oc-sect-title">3. Was bedeuten die Pfeile und Zusatzzeichen?</div>
<div class="oc-tbl-wrap"><table class="cheat-tbl"><thead><tr><th>Zeichen / Beschriftung</th><th>Bedeutung in der Grafik</th></tr></thead><tbody>
<tr><td>ν = 1</td><td>Student-t mit einem Freiheitsgrad ist die Cauchy-Verteilung.</td></tr>
<tr><td>ν → ∞</td><td>Mit sehr großen Freiheitsgraden nähert sich Student-t der Normalverteilung. Daher nennt Kruschke ν den <a class="glo-link" href="Glossar.html#gl-normalitaetsparameter" target="_blank" title="Kruschkes Bezeichnung für den Parameter ν der Student-t-Verteilung (sonst Freiheitsgrade). Für ν → ∞ wird sie zur Normalverteilung, kleine ν bedeuten schwere Ränder und mehr Ausreißer.">Normalitätsparameter</a>.</td></tr>
<tr><td>α = 0</td><td>Bei Skew-Normal verschwindet die Schiefe; es bleibt die Normalverteilung.</td></tr>
<tr><td>α = 1</td><td>Gamma mit Shape α = 1 wird zur Exponentialverteilung (bei passender Rate-Parametrisierung).</td></tr>
<tr><td>k = 1</td><td>Weibull wird zur Exponentialverteilung. Bei Scale-vs.-Rate muss die Parameterumrechnung beachtet werden.</td></tr>
<tr><td>σ → 0</td><td>Bei ExGaussian verschwindet die Normal-Streuung; übrig bleibt im Grenzfall ein verschobener Exponentialanteil. Nur bei μ = 0 entspricht das direkt einer unverschobenen Exponentialverteilung.</td></tr>
<tr><td>Y = exp(X)</td><td>Exponentiert man eine normalverteilte Variable X, erhält man eine Log-Normal-Verteilung für Y.</td></tr>
<tr><td>+ δ (Shift)</td><td>Ein additiver Shift δ verschiebt eine Log-Normal-Verteilung und erzeugt eine Shifted LogNormal.</td></tr>
<tr><td>⊕</td><td>Faltung: Summe zweier unabhängiger Zufallsvariablen. Normal ⊕ Exponential = ExGaussian.</td></tr>
<tr><td>p ~ Beta</td><td>Die Erfolgswahrscheinlichkeit p erhält eine Beta-Verteilung; daraus entsteht die Beta-Binomial-Mischung.</td></tr>
<tr><td>φ → ∞</td><td>Beim Beta-Binomial verschwindet die zusätzliche Heterogenität; Grenzfall ist Binomial.</td></tr>
<tr><td>n = 1</td><td>Binomial mit genau einem Versuch ist Bernoulli.</td></tr>
<tr><td>n → ∞, p → 0</td><td>Poisson-Grenzfall der Binomialverteilung, sofern np = λ endlich/konstant bleibt.</td></tr>
<tr><td>shape → ∞</td><td>Negative Binomial nähert sich der Poisson-Verteilung an.</td></tr>
<tr><td>+ 0 (zi)</td><td>Zur Beta-Verteilung wird eine zusätzliche Punktmasse bei 0 ergänzt (Zero Inflation).</td></tr>
<tr><td>+ 1 / Zero-One-Inflation</td><td>Zusätzlich können Punktmassen bei 0 und 1 modelliert werden; bei ZOIB steuern zoi und coi deren Gesamt- bzw. Aufteilung.</td></tr>
<tr><td>χ² ∕ χ²</td><td>Die F-Verteilung lässt sich als Verhältnis zweier durch ihre Freiheitsgrade skalierter Chi²-Variablen konstruieren.</td></tr>
<tr><td>→</td><td>Grenzwert oder Spezialfall (je nach Beschriftung am Pfeil).</td></tr>
<tr><td>farbig gestrichelter Pfeil</td><td>„Konstruiert aus" — die Zielverteilung entsteht durch eine Operation (Faltung, Shift, Mixtur) auf der Quellverteilung, innerhalb derselben Gruppe.</td></tr>
<tr><td>grau gepunkteter Pfeil</td><td>Gruppenübergreifende Verwandtschaft — eine Beziehung zwischen zwei verschiedenen Verteilungsgruppen, kein Spezialfall im engeren Sinn. Bewusst gepunktet statt gestrichelt, damit die Verwechslung mit „konstruiert aus" ausgeschlossen ist.</td></tr>
<tr><td>∞</td><td>Unendlich; z.B. „ν → ∞" bedeutet: ν wird immer größer.</td></tr>
<tr><td>~</td><td>„ist verteilt wie" / „folgt der Verteilung", z.B. p ~ Beta.</td></tr>
<tr><td>≈</td><td>ungefähr / näherungsweise gleich.</td></tr>
</tbody></table></div>
<div class="cheat-src">Quelle (Grafik & Grundstruktur): Ben Lambert, A Student's Guide to Bayesian Statistics (2018), S. 225.</div>
</div>
</div>
</div>
<!-- Help Panel -->
<div id="help-panel">
<div class="hp-box">
<div class="hp-head">
<span class="hp-title">Hilfe — Distribution Lab</span>
<button class="hp-close" onclick="toggleHelp()">✕</button>
</div>
<div class="hp-body">
<div class="hp-sect">Überblick</div>
<strong>Distribution Lab</strong> zeigt Wahrscheinlichkeitsverteilungen interaktiv — als Vorbereitung auf <a class="glo-link" href="Glossar.html#gl-glm" target="_blank" title="Das Generalisierte Lineare Modell erweitert die gewöhnliche lineare Regression auf nicht-normalverteilte Outcomes.">GLMs</a> und bayesianische Modelle in <a class="glo-link" href="Glossar.html#gl-brms" target="_blank" title="brms ist ein R-Paket, das eine vertraute Formelschnittstelle für Bayesianische Regressionsmodelle bietet — intern kompiliert in Stan.">brms</a>. Welche Verteilung passt zu welchen Daten? Für jede Verteilung: Beschreibung, Einsatzszenarien, Parameter-Erklärung, brms-Verwendung und Technische Details.
<div class="hp-sect">Navigation</div>
<strong>Kategorie-Tabs</strong> (oben) wählen die Verteilungsgruppe.<br>
<strong>Verteilungs-Buttons</strong> darunter wählen die konkrete Verteilung.<br>
<strong>Schieberegler</strong> links passen die Parameter in Echtzeit an.
<div class="hp-sect">Momente</div>
<strong>Mittelwert</strong> (blau), <strong>Median</strong> (grün), <strong>Modus</strong> (orange) als vertikale gestrichelte Linien. Jedes Moment unabhängig ein-/ausschaltbar.
<div class="hp-sect">Warum zwei Parametrisierungen?</div>
<strong>Das ist der häufigste Stolperstein — und er hat einen guten Grund.</strong><br><br>
Für ein und dieselbe Verteilung existieren in der Statistik <em>mehrere gleichwertige Schreibweisen</em>. Die Gamma-Verteilung etwa lässt sich über (shape, rate), über (shape, scale) oder über (Mittelwert, shape) beschreiben — dieselbe Verteilung, nur andere „Stellschrauben". Welche man wählt, ist reine Konvention.<br><br>
<strong>Paul Bürkner, der Autor von <a class="glo-link" href="Referenzen.html#ref-buerkner-2017" target="_blank" title="Bürkner, P.-C. (2017). brms: An R Package for Bayesian Multilevel Models Using Stan. Journal of Statistical Software, 80(1).">brms</a>, ist hier bewusst einen anderen Weg gegangen als die meisten:</strong> Er hat sich gefragt, was Anwenderinnen und Anwender in einem Regressionsmodell eigentlich vorhersagen wollen — und die Antwort ist fast immer <em>der Mittelwert</em>. Deshalb hat er <em>alle</em> Verteilungen, die als Likelihood in Frage kommen, so parametrisiert, dass das Ziel der Regression immer <strong>μ</strong> ist. Egal ob Gamma, Beta, Weibull oder Negative Binomial: <code>y ~ x</code> sagt stets den Mittelwert vorher. Das ist eine nachvollziehbare, anwenderfreundliche Vereinheitlichung — man muss nicht für jede Verteilungsfamilie neu lernen, was der erste Parameter bedeutet.<br><br>
Weil diese μ-Parametrisierung für die Arbeit mit brms zentral ist, ist sie hier im Tool die <strong>Standardeinstellung</strong>. Zum Vergleich lässt sich über den Umschalter zusätzlich die klassische Lehrbuch-Notation einblenden — die begegnet einem in Lehrbüchern, in der R-Basis (<code>dgamma</code>, <code>dnbinom</code>) und in Publikationen.<br><br>
<strong>Und wo nutzt brms die klassische Notation?</strong> Immer genau dann, wenn die Verteilung <em>keine</em> Likelihood ist, sondern eine andere Rolle spielt — insbesondere als <a class="glo-link" href="Glossar.html#gl-prior" target="_blank" title="Der Prior p(θ) ist die Wahrscheinlichkeitsverteilung über Modellparameter θ, die unser Vorwissen vor Betrachtung der Daten ausdrückt.">Prior</a>. In <code>prior(gamma(2, 0.1), ...)</code> sind die beiden Zahlen shape und rate, <em>nicht</em> μ und φ. Das ist in sich konsequent (ein Prior sagt ja keinen Mittelwert vorher, sondern beschreibt direkt die Verteilung eines Parameters), kann aber verwirren — besonders bei Verteilungen wie Skew-Normal, wo beide Notationen unter demselben Funktionsnamen auftauchen.<br><br>
<strong>Die Farbcodierung hilft beim Auseinanderhalten:</strong> Im Abschnitt „Was bedeuten die Parameter?" steht die <span style="color:var(--density-color);font-weight:600">türkise Box <span class="par-num" style="width:.95rem;height:.95rem;font-size:.56rem;vertical-align:-.1em">1</span></span> immer für die brms-/Likelihood-Parametrisierung, die <span style="color:var(--a6);font-weight:600">weinrote Box <span class="par-num" style="width:.95rem;height:.95rem;font-size:.56rem;vertical-align:-.1em">2</span></span> für die klassische Notation bzw. die Prior-Verwendung. Dieselben Farben hat der Umschalter in der Seitenleiste.<br><br>
Der Abschnitt <strong>"Verwendung in brms"</strong> zeigt dann für jede Verteilung konkret beide Rollen: als Likelihood (family-Syntax, Link) und als Prior (prior()-Syntax) — inkl. typischer Parametrisierungen.
<div class="hp-sect">Gemischte Verteilungen</div>
<strong>ZI-Beta</strong> und <strong>ZOIB</strong>: Punktmassen bei 0/1 als rote Balken, Beta-Anteil als Kurve. <strong>Hurdle-Gamma</strong> und <strong>Hurdle-Lognormal</strong>: Punktmasse bei 0 als roter Balken, positiver Anteil als Kurve auf (0, ∞) statt auf [0,1].
<div class="hp-sect">Diskrete Verteilungen</div>
Balkendiagramm der PMF. Modus = höchster Balken.
<div class="hp-sect">X-Achse fixieren</div>
<strong>X fixiert / X frei</strong>-Button (über dem Diagramm): Friert die X-Achse ein, damit man bei Parameteränderungen (z.B. μ oder σ) die Formänderung direkt sieht — statt dass sich die Achse mitskaliert. Standardmäßig aktiv, und die <em>Ein/Aus-Einstellung</em> gilt global über alle Verteilungen hinweg. Der eingefrorene Achsenbereich selbst wird dabei aber <em>pro Verteilung</em> gemerkt, nicht geteilt — kontinuierlich unbegrenzte und kontinuierlich begrenzte Verteilungen bekommen also weiterhin ihre jeweils passende Achse. Ebenso merkt sich das Tool pro Verteilung die zuletzt eingestellten Parameterwerte, sodass man zwischen Verteilungen hin- und herspringen kann, ohne die eigene Einstellung zu verlieren — bis zum nächsten Neuladen der Seite, danach gilt wieder alles auf Standard. Für diskrete, gemischte und ordinale Verteilungen ist der Button deaktiviert (nicht sinnvoll).
<div class="hp-sect">Verteilungsbeziehungen</div>
<strong>⊞ Beziehungen</strong>-Button öffnet eine große Übersichtskarte mit allen Verteilungen des Distribution Lab und ihren Zusammenhängen: Spezialfälle, Grenzwerte, Konstruktionen. Orientierung im "Verteilungs-Zoo". Darin klappt <strong>📖 Symbole</strong> eine Kurzreferenz der griechischen Buchstaben auf.
<div class="hp-sect">Cheat Sheet</div>
<strong>📋 Cheat Sheet</strong>-Button öffnet eine vollständige Referenz: alle Symbole (Name, Aussprache, Merke), die Parameterbedeutung jeder Verteilung gruppiert nach Kategorie, und die Pfeil-/Zusatzzeichen der Beziehungskarte — zum Nachschlagen, ohne eine einzelne Verteilung erst auswählen zu müssen.
</div>
</div>
</div>
<script>
'use strict';
// ── State ──────────────────────────────────────────────────────
let DARK = document.documentElement.getAttribute('data-theme') === 'dark';
let CAT_IDX = 0;
let DIST_KEY = 'normal';
let PARAMS = {};
let BRMS_MODE = true;
// Standard: fixiert (statt frei) — damit man beim ersten Öffnen direkt zwischen
// Verteilungen wechseln und ihre Form auf derselben X-Achse vergleichen kann.
let X_FIXED = true;
let FIXED_XRANGE = null;
function cv(v){ return getComputedStyle(document.documentElement).getPropertyValue(v).trim(); }
function darken(hex,amt){
hex=hex.replace('#','');
const r=parseInt(hex.substr(0,2),16), g=parseInt(hex.substr(2,2),16), b=parseInt(hex.substr(4,2),16);
const f=v=>Math.max(0,Math.round(v*(1-amt))).toString(16).padStart(2,'0');
return '#'+f(r)+f(g)+f(b);
}
// ── Math ───────────────────────────────────────────────────────
function logGamma(z){
if(z<0.5) return Math.log(Math.PI/Math.sin(Math.PI*z))-logGamma(1-z);
z-=1;
const c=[0.99999999999980993,676.5203681218851,-1259.1392167224028,
771.32342877765313,-176.61502916214059,12.507343278686905,
-0.13857109526572012,9.9843695780195716e-6,1.5056327351493116e-7];
let x=c[0];
for(let i=1;i<=8;i++) x+=c[i]/(z+i);
const t=z+7.5;
return 0.5*Math.log(2*Math.PI)+(z+0.5)*Math.log(t)-t+Math.log(x);
}
function logBeta(a,b){ return logGamma(a)+logGamma(b)-logGamma(a+b); }
function gammaFn(z){ return Math.exp(logGamma(z)); }
function erf(x){
const s=x<0?-1:1; x=Math.abs(x);
const t=1/(1+0.3275911*x);
return s*(1-(((((1.061405429*t-1.453152027)*t+1.421413741)*t-0.284496736)*t+0.254829592)*t)*Math.exp(-x*x));
}
function Phi(x){ return 0.5*(1+erf(x/Math.SQRT2)); }
function phi(x){ return Math.exp(-0.5*x*x)/Math.sqrt(2*Math.PI); }
function logisticCDF(x){ return 1/(1+Math.exp(-x)); }
function logisticPDF(x){ const e=Math.exp(-x); return e/(1+e)/(1+e); }
function normalPDF(x,mu,sig){ if(sig<=0)return 0; return phi((x-mu)/sig)/sig; }
function gammaPDF(x,alpha,rate){ // rate = 1/scale
if(x<=0||alpha<=0||rate<=0)return 0;
return Math.exp((alpha-1)*Math.log(x)-rate*x+alpha*Math.log(rate)-logGamma(alpha));
}
function weibullPDF(x,k,lambda){
if(x<=0||k<=0||lambda<=0)return 0;
const z=x/lambda;
return (k/lambda)*Math.pow(z,k-1)*Math.exp(-Math.pow(z,k));
}
function betaPDF(x,a,b){
if(x<=0||x>=1||a<=0||b<=0)return 0;
return Math.exp((a-1)*Math.log(x)+(b-1)*Math.log(1-x)-logBeta(a,b));
}
// Peak (Ort + Höhe) der Beta(a,b)-Dichte — nur definiert, wenn a>1 UND b>1 (sonst
// ist die Dichte monoton oder divergiert an einem Rand; kein einzelner endlicher
// "typischer" Punkt existiert dann, den man sinnvoll gegen eine Punktmasse abwägen könnte).
function betaPeakXY(a,b){
if(a>1 && b>1){ const x=(a-1)/(a+b-2); return {x, h:betaPDF(x,a,b)}; }
return null;
}
function lognormPDF(x,mu,sig){ if(x<=0||sig<=0)return 0; return phi((Math.log(x)-mu)/sig)/(x*sig); }
function invGaussPDF(x,mu,lam){
if(x<=0||mu<=0||lam<=0)return 0;
return Math.sqrt(lam/(2*Math.PI*x*x*x))*Math.exp(-lam*(x-mu)*(x-mu)/(2*mu*mu*x));
}
function exGaussPDF(x,mu,sigma,beta){
if(sigma<=0||beta<=0)return 0;
const z=(x-mu)/sigma-sigma/beta;
const phiVal=Phi(z);
if(phiVal<=0)return 0;
const logVal=-Math.log(beta)+(mu-x)/beta+(sigma*sigma)/(2*beta*beta)+Math.log(phiVal);
return isFinite(logVal)?Math.exp(logVal):0;
}
function fDistPDF(x,d1,d2){
if(x<=0||d1<=0||d2<=0)return 0;
return Math.exp(0.5*d1*Math.log(d1)+0.5*d2*Math.log(d2)+(0.5*d1-1)*Math.log(x)
-logBeta(d1/2,d2/2)-0.5*(d1+d2)*Math.log(d2+d1*x));
}
function poissonPMF(k,lam){
if(k<0||!Number.isInteger(k)||lam<=0)return 0;
return Math.exp(k*Math.log(lam)-lam-logGamma(k+1));
}
function binomPMF(k,n,p){
if(k<0||k>n||!Number.isInteger(k))return 0;
if(p<=0)return k===0?1:0; if(p>=1)return k===n?1:0;
return Math.exp(logGamma(n+1)-logGamma(k+1)-logGamma(n-k+1)+k*Math.log(p)+(n-k)*Math.log(1-p));
}
function negbinPMF(k,mu,phi){
if(k<0||!Number.isInteger(k)||mu<=0||phi<=0)return 0;
const p=phi/(mu+phi);
return Math.exp(logGamma(k+phi)-logGamma(k+1)-logGamma(phi)+phi*Math.log(p)+k*Math.log(1-p));
}
function betaBinomPMF(k,n,a,b){
if(k<0||k>n||!Number.isInteger(k))return 0;
return Math.exp(logGamma(n+1)-logGamma(k+1)-logGamma(n-k+1)
+logGamma(k+a)+logGamma(n-k+b)-logGamma(n+a+b)+logGamma(a+b)-logGamma(a)-logGamma(b));
}
// Für ein Hurdle-Modell (P(Y=0)=hu, P(Y=k>0)=(1-hu)·f(k)/(1-f(0))) gilt allgemein:
// der k=0-Term jeder Basisverteilung trägt 0 zu Σk·f(k) und Σk²·f(k) bei — daher
// lassen sich Erwartungswert/Varianz der Nicht-Null-gestutzten Basisverteilung direkt
// aus deren eigenem (ungestutztem) Mittelwert/Varianz herleiten, unabhängig davon,
// welche Zähldichte f konkret verwendet wird.
function hurdleDiscreteMoments(baseMean,baseVar,f0,hu){
const surv=1-f0;
const meanTrunc=baseMean/surv;
const m2Trunc=(baseVar+baseMean*baseMean)/surv;
const meanY=(1-hu)*meanTrunc;
return {mean:meanY, variance:(1-hu)*m2Trunc-meanY*meanY};
}
// ── Distributions Config ───────────────────────────────────────
// params: array of {id, label, min, max, step, val, fmt}
// hasBrmsToggle: bool — if true, needs paramsBrms + paramsClassic + toCanonical + convertParams
// pdf(x,p): for non-toggle; discrete(k,p) for discrete
// supportFn(p): [lo,hi]
// meanFn(p), varianceFn(p), modeFn(p): optional (null = compute numerically)
// For hasBrmsToggle: all fn signatures are (canonical_p)
// notation: string for header display
// info: {was, parameter, technik}
const CATS = [
{label:'Kontinuierlich\nunbegrenzt', dists:['normal','student_t','cauchy','skew_normal']},
{label:'Kontinuierlich\npositiv', dists:['lognormal','shifted_lognormal','gamma','exponential','weibull','exgaussian','inv_gaussian','chi_sq','f_dist','hurdle_gamma','hurdle_lognormal']},
{label:'Begrenzt', dists:['beta','bernoulli','zi_beta','zoib','lkj']},
{label:'Zähldaten', dists:['poisson','negbin','binomial','beta_binomial','zero_inflated_poisson','zero_inflated_negbinomial','zero_inflated_binomial','hurdle_poisson','hurdle_negbinomial']},
{label:'Ordinal', dists:['cumprobit','cumlogit']},
];
const DISTS = {
normal:{
name:'Normal', group:0, notation:'Y ~ Normal(μ, σ)',
params:[
{id:'mu', label:'μ (Mittelwert)', min:-5, max:5, step:0.1, val:0, fmt:v=>v.toFixed(1)},
{id:'sigma', label:'σ (Streuung)', min:0.1, max:5, step:0.1, val:1, fmt:v=>v.toFixed(1)},
],
pdf:(x,p)=>normalPDF(x,p.mu,p.sigma),
supportFn:p=>[p.mu-4.5*p.sigma, p.mu+4.5*p.sigma],
meanFn:p=>p.mu, varianceFn:p=>p.sigma*p.sigma, modeFn:p=>p.mu,
examples:[
{label:'Körpergrößen (erw. Frauen)', params:{mu:170, sigma:7}},
{label:'IQ-Werte', params:{mu:100, sigma:15}},
],
info:{
was:'Die <strong>Normalverteilung</strong> (Gauß\'sche Glockenkurve) ist symmetrisch um ihren Mittelwert, unbegrenzt auf beiden Seiten, und gehorcht der klassischen Glockenform. Sie ist das Fundament linearer Modelle — die Fehlerterme werden als normalverteilt angenommen.',
einsatz:'Körpergrößen (z.B. μ = 170 cm, σ = 7 cm bei erwachsenen Frauen <button class="inline-ex-btn" onclick="applyExample(\'normal\',0)">anwenden</button>), IQ-Werte (μ = 100, σ = 15 per Definition <button class="inline-ex-btn" onclick="applyExample(\'normal\',1)">anwenden</button>), Messfehler in physikalischen Experimenten, Prüfungsnoten, Blutdruck, Reaktionszeiten in einfachen Aufgaben. Das <strong>Grundprinzip:</strong> Immer wenn ein Ergebnis durch viele kleine, unabhängige Einflüsse entsteht, die sich addieren, erscheint die Normalverteilung — egal ob Körpergröße durch hunderte genetische Faktoren oder Messfehler durch viele kleine Störquellen. <strong>Typischer Einsatz in brms:</strong> Standardmodell für kontinuierliche Outcomes ohne natürliche Grenzen.',
parameter:'<strong>μ (Mittelwert):</strong> Der Gipfel der Glocke — der häufigste, der mittlere und der Erwartungswert gleichzeitig. Verschiebe μ: Die ganze Glocke wandert nach links oder rechts, aber ihre Form bleibt gleich. <em>Beispiel:</em> μ = 170 cm → die mittlere Körpergröße liegt bei 170 cm.<br><br><strong>σ (Standardabweichung):</strong> Die Breite der Glocke. Kleines σ → schmale, spitze Glocke (Werte eng beisammen). Großes σ → breite, flache Glocke (Werte sehr verstreut). <em>Goldene Regel:</em> 68% aller Werte fallen in [μ−σ, μ+σ], 95% in [μ−2σ, μ+2σ], 99.7% in [μ−3σ, μ+3σ]. <em>Beispiel:</em> σ = 7 cm → 68% der Personen zwischen 163 und 177 cm, 95% zwischen 156 und 184 cm.<br><br><strong>Typische Prior-Parametrisierungen:</strong><br>• <code>Normal(0, 1)</code> — Standard-Regularisierungs-Prior für Regressionskoeffizienten auf standardisierter Skala<br>• <code>Normal(0, 2.5)</code> — etwas breiter, erlaubt größere Effekte<br>• <code>Normal(0, 10)</code> — schwach-informativer Prior, fast flach',
brms:'<div class="brms-role"><strong>Als Likelihood</strong> — wenn das Outcome kontinuierlich und nicht begrenzt ist:<br><code>brm(y ~ x, data = d, family = gaussian())</code><br>→ Link: <em>identity</em> — der lineare Prädiktor Xβ modelliert direkt den Mittelwert μ.<br>→ σ wird automatisch geschätzt (globale Residualstreuung).<br>→ Entspricht der klassischen linearen Regression.<br><br><strong>σ durch Prädiktoren vorhersagen</strong> — um Varianzheterogenität zuzulassen:<br><code>brm(bf(y ~ x, sigma ~ gruppe), data = d, family = gaussian())</code><br>→ σ bekommt eine eigene Subformel: die Streuung darf sich zwischen Gruppen oder entlang eines Prädiktors unterscheiden. Nützlich wenn z.B. die Varianz mit dem Mittelwert zunimmt oder zwischen Bedingungen verschieden ist.</div><div class="brms-role"><strong>Als Prior</strong> — für fast jeden Parameter verwendbar:<br><code>prior(normal(0, 1), class = b)</code> für Regressionskoeffizienten<br><code>prior(normal(0, 2.5), class = Intercept)</code> für den Achsenabschnitt<br>→ Beliebtester Prior überhaupt: schwach-informativ, zentriert auf 0, erlaubt vernünftige Effektgrößen, unterdrückt extreme Werte leicht.</div>',
technik:'<strong>Zentraler Grenzwertsatz:</strong> Summen vieler unabhängiger Zufallsvariablen → Normal, unabhängig von der Ausgangsverteilung. E[Y] = μ, Var(Y) = σ². Student-t(ν→∞) → Normal. Normal(0,1)² ~ Chi²(1). Link: <code>identity</code>.'
}
},
student_t:{
name:'Student-t', group:0, notation:'Y ~ Student-t(ν, μ, σ)',
// σ default 0.75 (not 1) so the default support ([-4.5,4.5], same 4.5·σ margin as
// Normal/Skew-Normal) matches the rest of group 0 — lets you switch distributions
// with X-Fix on and compare shapes on the same x-axis.
params:[
{id:'nu', label:'ν (Freiheitsgrade)', min:1, max:30, step:0.5, val:5, fmt:v=>v.toFixed(1)},
{id:'mu', label:'μ (Lage)', min:-5, max:5, step:0.1, val:0, fmt:v=>v.toFixed(1)},
{id:'sigma', label:'σ (Skalierung)', min:0.1, max:5, step:0.1, val:0.75, fmt:v=>v.toFixed(2)},
],
pdf:(x,p)=>{
const nu=p.nu, sig=p.sigma, mu=p.mu;
if(sig<=0||nu<=0)return 0;
const t=(x-mu)/sig;
return Math.exp(logGamma((nu+1)/2)-logGamma(nu/2)-0.5*Math.log(nu*Math.PI)