-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests_8jan2022.out
1206 lines (935 loc) · 42 KB
/
run_tests_8jan2022.out
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
=====================
BMB510 Being Bayesian
=====================
2501 integration points
Bayesian analysis to estimate a total population size, Nt,
using the wild life biologists' tag and release method whereby
a number Na are labelled or tagged in some way, put back into
the population, allowed to 'mix' and a number Nb are resampled
of which Nc of Nb are labelled
labelled: 10 sampled: 10 of which 3 are labelled
Total known/found: 17
computing pdf from min 17 up to max N of 255
# of pdf points generated: 239
fraction of resample labelled: 0.30000 Population size (Max. Like. Est): 33
===========================================================
SUMMARY of posterior distribution for population size
===========================================================
mean: 64.74922 mode: 33.00000
median: 49.00000
2.5% to 97.5% limits: ( 21.00000 to 192.00000)
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
bayesian analysis to estimate total number of 'marked' objects Nm, given:
Total number of objects: Nt
A sample Nb of them in which we find Nc are 'marked' or 'labelled'
based on same hypergeometric distribution as TagAndRelease
from total of: 15 # sampled: 10 of which 3 are marked
unsampled: 5 # marked min: 3 and max: 8
fraction of sample marked: 0.30000 Max. Like. Est of total Marked: 4
===========================================================
SUMMARY of posterior distribution for total # marked
===========================================================
mean: 4.66667 mode: 4.00000
median: 4.00000
2.5% to 97.5% limits: ( 3.00000 to 6.00000)
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
bayesian analysis of rank order or serial # type:
e.g. birth order, dice problem (Allen Dewney), Locomotive problem (Mostellor)
German tank problem WWII
input file: testdata/familySize_test.dat
# data for family size program 6 6 8
# data points 5
largest rank: 109 is set to minimum population size
Setting upper size limit as 5 times Max: 545
===========================================================
Summary of posterior distribution for population size
===========================================================
median 128.00000
min - 97.5% limits: ( 109.00000, 268.00000 )
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
implement bayesian analysis of proportion/fraction/percent type parameter
like bias of coin, % of mutations etc
work with log p
# of positive, negative events: 2 9
===========================================================
SUMMARY of posterior distribution for fraction parameter
===========================================================
mean: 0.23077 mode: 0.18185
median: 0.21663
2.5% to 97.5% limits: ( 0.05476 to 0.48401)
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
implement bayesian analysis of difference in two
proportion/fraction/percent type parameters
work with logp
===========================================================
sample (data) summary
===========================================================
first # of positive 2 negative 9 events
second # of positive 3 negative 8 events
fraction 1 0.18182 fraction 2 0.27273 difference (2-1) 0.09091
===========================================================
===========================================================
SUMMARY of posterior distribution for set 1 fraction parameter
===========================================================
mean: 0.23077 mode: 0.18185
median: 0.21663
2.5% to 97.5% limits: ( 0.05476 to 0.48401)
===========================================================
===========================================================
SUMMARY of posterior distribution for set 2 fraction parameter
===========================================================
mean: 0.30769 mode: 0.27258
median: 0.29736
2.5% to 97.5% limits: ( 0.09912 to 0.57154)
===========================================================
===========================================================
SUMMARY of posterior distribution for difference (set 2 - set 1) fraction parameter
===========================================================
mean: 0.07692 mode: 0.07554
median: 0.07714
2.5% to 97.5% limits: ( -0.25420 to 0.40368)
===========================================================
p(f1 >= f2): 32.063% p(f1 < f2) 67.937%
=====================
BMB510 Being Bayesian
=====================
2501 integration points
Bayesian analysis of multiple proportion/fraction parameters
f_j using a hierarchically beta function model characterized by hyper-parameters
alpha, beta, govering beta distribution of population fraction
using the approach of gelman et al, DBA3 chapter 5, the rat tumor data set
#
# Bayesian hierarchical conjugate beta proportion parameter model test data
# from gelman et al, DBA3 chapter 5, e.g. the rat tumor data set
# number of positives, sample size
# 4 14
# data points 70
n total: 263.00000 nsize total 1725.00000 global <f>: 0.15246
input data f_j mean 0.13601 stdev 0.10275
estimated modal a,b: 1.3777748392916775 8.752435447153111
estimated modal y,z and log(p(a,b|data)): -1.8488622359581879 2.315522076825466 -725.6096220772147
lower y bound: -2.248862235958188
upper y bound: -1.3488622359581874
lower z bound: 1.5155220768254654
lower z bound: 4.515522076825466
posterior expectations of population hyperparameters
E(a) 2.36258 E(b) 14.26501
giving posterior population fraction 0.14209 and its std. err 0.08316
drew 1000 samples in 12674 tries
set 1 median 0.05983 95% CI ( 0.01399 , 0.15902)
set 2 median 0.06023 95% CI ( 0.01335 , 0.16380)
set 3 median 0.05957 95% CI ( 0.01393 , 0.15042)
set 4 median 0.05990 95% CI ( 0.01325 , 0.15558)
set 5 median 0.06040 95% CI ( 0.01402 , 0.16985)
set 6 median 0.06198 95% CI ( 0.01476 , 0.16911)
set 7 median 0.05942 95% CI ( 0.01316 , 0.15855)
set 8 median 0.06294 95% CI ( 0.01563 , 0.16815)
set 9 median 0.06010 95% CI ( 0.01387 , 0.15691)
set 10 median 0.06218 95% CI ( 0.01252 , 0.16029)
set 11 median 0.06231 95% CI ( 0.01301 , 0.16775)
set 12 median 0.06133 95% CI ( 0.01185 , 0.17235)
set 13 median 0.06164 95% CI ( 0.01333 , 0.15585)
set 14 median 0.06665 95% CI ( 0.01420 , 0.16413)
set 15 median 0.08778 95% CI ( 0.02801 , 0.18955)
set 16 median 0.08368 95% CI ( 0.02280 , 0.18504)
set 17 median 0.08410 95% CI ( 0.02419 , 0.19422)
set 18 median 0.08692 95% CI ( 0.02460 , 0.19583)
set 19 median 0.08490 95% CI ( 0.02220 , 0.19545)
set 20 median 0.08525 95% CI ( 0.02746 , 0.19638)
set 21 median 0.08656 95% CI ( 0.02441 , 0.21336)
set 22 median 0.08921 95% CI ( 0.03040 , 0.19861)
set 23 median 0.09325 95% CI ( 0.03449 , 0.20000)
set 24 median 0.09964 95% CI ( 0.03340 , 0.20529)
set 25 median 0.09939 95% CI ( 0.03509 , 0.21060)
set 26 median 0.10760 95% CI ( 0.03928 , 0.22652)
set 27 median 0.10972 95% CI ( 0.03685 , 0.21870)
set 28 median 0.10950 95% CI ( 0.03769 , 0.23187)
set 29 median 0.10924 95% CI ( 0.04164 , 0.21924)
set 30 median 0.10787 95% CI ( 0.04079 , 0.23038)
set 31 median 0.10870 95% CI ( 0.04062 , 0.21868)
set 32 median 0.11350 95% CI ( 0.03507 , 0.25055)
set 33 median 0.10785 95% CI ( 0.04908 , 0.19803)
set 34 median 0.11075 95% CI ( 0.03736 , 0.24016)
set 35 median 0.11076 95% CI ( 0.05212 , 0.20360)
set 36 median 0.11312 95% CI ( 0.04711 , 0.22013)
set 37 median 0.11503 95% CI ( 0.04025 , 0.24575)
set 38 median 0.13438 95% CI ( 0.06840 , 0.22443)
set 39 median 0.13726 95% CI ( 0.07127 , 0.23158)
set 40 median 0.13059 95% CI ( 0.05343 , 0.25387)
set 41 median 0.13281 95% CI ( 0.05270 , 0.25603)
set 42 median 0.12921 95% CI ( 0.05006 , 0.26960)
set 43 median 0.16608 95% CI ( 0.08931 , 0.26429)
set 44 median 0.17532 95% CI ( 0.09720 , 0.26953)
set 45 median 0.15301 95% CI ( 0.06775 , 0.28976)
set 46 median 0.15620 95% CI ( 0.06726 , 0.27665)
set 47 median 0.15282 95% CI ( 0.07153 , 0.28569)
set 48 median 0.15446 95% CI ( 0.06398 , 0.28526)
set 49 median 0.15288 95% CI ( 0.06750 , 0.28730)
set 50 median 0.15000 95% CI ( 0.06592 , 0.28281)
set 51 median 0.15360 95% CI ( 0.06814 , 0.28915)
set 52 median 0.17895 95% CI ( 0.10196 , 0.28135)
set 53 median 0.15983 95% CI ( 0.06700 , 0.28829)
set 54 median 0.16423 95% CI ( 0.07038 , 0.30248)
set 55 median 0.16091 95% CI ( 0.06847 , 0.29076)
set 56 median 0.17414 95% CI ( 0.08250 , 0.30711)
set 57 median 0.20066 95% CI ( 0.11662 , 0.29836)
set 58 median 0.20496 95% CI ( 0.12929 , 0.30660)
set 59 median 0.18158 95% CI ( 0.08688 , 0.31284)
set 60 median 0.17882 95% CI ( 0.08512 , 0.32931)
set 61 median 0.18658 95% CI ( 0.09660 , 0.31227)
set 62 median 0.18419 95% CI ( 0.08727 , 0.31857)
set 63 median 0.19606 95% CI ( 0.09844 , 0.33310)
set 64 median 0.20666 95% CI ( 0.10217 , 0.34579)
set 65 median 0.20332 95% CI ( 0.10426 , 0.33805)
set 66 median 0.20079 95% CI ( 0.10523 , 0.33899)
set 67 median 0.25001 95% CI ( 0.16657 , 0.35430)
set 68 median 0.25700 95% CI ( 0.16560 , 0.37847)
set 69 median 0.25955 95% CI ( 0.16685 , 0.37765)
set 70 median 0.24912 95% CI ( 0.14497 , 0.38887)
=====================
BMB510 Being Bayesian
=====================
2501 integration points
Bayesian analysis of multiple proportion parameters dependent on dose,
data given as set of (dose, # in sample, # of positives)
using the approach of Gelman et al, DBA3 chapter 3.7, the bioassay experiment
# the bioassay dose-response test data from table 3.1, ch 3 DBA3
# for the proportion/fraction paramter model, where f is function
# of dose
# dose log g/ml, # of samples, # of positives
# dose sets: 4
dose n n+ f_j logit(f_j)
-0.86000 5.00000 0.00000 0.14286 -1.79176
-0.30000 5.00000 1.00000 0.28571 -0.91629
-0.05000 5.00000 3.00000 0.57143 0.28768
0.73000 5.00000 5.00000 0.85714 1.79176
fitting to logit(f+i) = a + b*dose...
to locate probablity peak in (a,b) parameter space
R 0.98584
modal a 0.12132 b 2.32061 log(p) -7.73814
grid lower a bound: -2.7786787703735776
grid upper a bound: 4.921321229626426
grid lower b bound: -18.51938837931666
grid upper b bound: 42.520611620683816
WARNING: if the lhood peak is not comfortably within the grid
boundaries you may need to adjust the boundaries manually!!
drew 1000 samples in 21900 tries
LD50 median -0.11098 95% CI ( -0.27988 , 0.12755)
=====================
BMB510 Being Bayesian
=====================
2501 integration points
bayes analysis of rate of rare events using poisson distbn
work with log p
# of events: 5 in time 5.0
===========================================================
SUMMARY of posterior distribution for rate
===========================================================
mean: 0.99807 mode: 0.80040
median: 0.93360
2.5% to 97.5% limits: ( 0.32400 to 2.03760)
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
Implement bayesian method for posterior probability distribution
of rate k_s for source with a background rate k_b
using Poisson likelihood model, taken from
Tom Loredo's tutorial: From Laplace to supernova 1987a
work with logp
background obs. time 1.000 and # counts 9
source obs. time 1.000 and # counts 9
===========================================================
SUMMARY of posterior distribution for rate of source
accounting for background
===========================================================
mean: 3.34055 mode: 0.00720
median: 2.76369
2.5% to 97.5% limits: ( 0.12955 to 9.75210)
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
Bayesian analysis of multiple observations of rare events
each observation characterized by n_i counts in time t_i
posterior is equivalent to that from a single observation of
n_total counts in t_total time
reading n t data from file testdata/multiRareCounts_test.dat
#
# test data for MultiRareCounts.py
# one pair of (counts time) per line
# data points 3
total count 10 observation time 5.00000 mean rate 2.00000
===========================================================
SUMMARY of posterior distribution for rate
===========================================================
mean: 1.99997 mode: 1.80000
median: 1.93200
2.5% to 97.5% limits: ( 0.95760 to 3.41520)
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
implement bayesian estimation of mean of population, using exact (t-distribution)
and approximation (Gaussian) posterior pdf
and chi-sq posterior pdf of std. dev
work with logp
# data points 11
===========================================================
sample (data) summary
===========================================================
Min X 0.32900 Max X 0.89800
Av X 0.72182 Var of X 0.03042 Std.dev of X 0.17440
===========================================================
===========================================================
SUMMARY of posterior distribution for population mean
===========================================================
mean: 0.72182 mode: 0.72182
median: 0.72182
2.5% to 97.5% limits: ( 0.60083 to 0.84263)
===========================================================
===========================================================
SUMMARY of posterior distribution for population std. deviation
===========================================================
mean: 0.19821 mode: 0.17440
median: 0.18905
2.5% to 97.5% limits: ( 0.12757 to 0.32090)
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
Implement bayesian estimation of mean of population, using
Cauchy distributed (fat-tailed) noise - allowing for larger magnitude noise (outliers)
# data points 11
===========================================================
sample (data) summary
===========================================================
Min X 0.32900 Max X 0.89800
Av X 0.72182 Var of X 0.03042 Std.dev of X 0.17440
===========================================================
===========================================================
SUMMARY of posterior distribution for population mean
===========================================================
mean: 0.79882 mode: 0.81268
median: 0.80259
2.5% to 97.5% limits: ( 0.70163 to 0.86821)
===========================================================
===========================================================
SUMMARY of posterior distribution for population std. deviation
===========================================================
mean: 0.08724 mode: 0.06464
median: 0.07848
2.5% to 97.5% limits: ( 0.03500 to 0.18521)
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
implement bayesian analysis of two diff population means
using gaussian approx to distributions, i.e. large sample case
if both sample sizes > 10, otherwise uses small population
(T-distribution) form conservatively assuming two populations
do NOT have same variance
work with logp
input file 1: testdata/mean1_test.dat
input file 2: testdata/mean2_test.dat
# data points 11
# data points 10
===========================================================
sample (data) summary
===========================================================
Av X1 0.72182 Av X2 0.63600 Var of X1 0.03042 Var of X2 0.02176
Av X2 - Av X1 -0.08582
std. dev. of X1 data 0.17440 std. dev. of X2 data 0.14753
st.dev ratio from data (s1/s2): 1.1821
std.err of <X1> 0.05515 std.err of <X2> 0.04918 std.err of <X2-X1> 0.07389
===========================================================
using gaussian approx to distributions, i.e. large sample case
===========================================================
SUMMARY of posterior distribution for difference (set 2 - set 1) of population means
===========================================================
mean: -0.08582 mode: -0.08582
median: -0.08582
2.5% to 97.5% limits: ( -0.23076 to 0.05889)
===========================================================
p(dMean) < 0., >0.: 0.878 0.122
===========================================================
SUMMARY of posterior distribution for set 1 std. deviation
===========================================================
mean: 0.19821 mode: 0.17431
median: 0.18911
2.5% to 97.5% limits: ( 0.12780 to 0.32073)
===========================================================
===========================================================
SUMMARY of posterior distribution for set 2 std. deviation
===========================================================
mean: 0.17015 mode: 0.14762
median: 0.16136
2.5% to 97.5% limits: ( 0.10692 to 0.28373)
===========================================================
Calculating posterior for ratio of sample std.deviations ...
===========================================================
SUMMARY of posterior distribution for std.dev1/std.dev2
===========================================================
mean: 1.09587 mode: 0.94721
median: 1.16707
2.5% to 97.5% limits: ( 0.58870 to 2.17791)
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
Calculate posterior difference in means given only summary data
(# of sample points, sample mean and sample standard deviation) for two
data sets, without original raw data
using t-dist
===========================================================
sample (data) summary
===========================================================
Number of points in set 1: 4 set2: 4
Av X1 0.67770 Av X2 0.83840 Var of X1 0.00308 Var of X2 0.01636
Av X2 - Av X1 0.16070
std.dev of X1 data 0.05550 std.dev of X2 data 0.12790
std.dev ratio from data (s1/s2): 0.43393
std.err of <X1> 0.03204 std.err of <X2> 0.07384 std.err of <X2-X1> 0.08050
===========================================================
===========================================================
SUMMARY of posterior distribution for difference (set 2 - set 1) of population means
===========================================================
mean: 0.16070 mode: 0.16070
median: 0.15941
2.5% to 97.5% limits: ( -0.00931 to 0.32942)
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
Bayesian hierarchical multiple means analysis
using a hierarchical model characterized by hyper-parameters
mu, tau govering gaussian prior distribution of population means
using the approach of Gelman et al, DBA3 chapter 5, in the 8-schools case
Input data as
(1) pairs of mean, std. error
(2) J sets of raw data {y_i}
Option 1 or 2 >>
name of file containing one (mean, std. err) per line>>
reading mean, std. err data from file testdata/EightSchools.dat
#
# example of hierarch gaussian bayes analysis of multiple means
# 8 schools data from gelman et al DBA3 table 5.2
# effect std. error
# data points 8
input data mean stderr:
28.00000 15.00000
8.00000 10.00000
-3.00000 16.00000
7.00000 11.00000
-1.00000 9.00000
1.00000 11.00000
18.00000 10.00000
12.00000 18.00000
global mean, stdev of means: 8.75000 9.76921
tau 95% limits: ( 0.00000 to 18.28796)
sampling randomly from posterior...
mean of means from 5000 samples: 7.87687
set 1 median 10.28887 95% CI ( -2.01211 , 31.88738)
set 2 median 7.70503 95% CI ( -4.83842 , 20.89632)
set 3 median 6.41031 95% CI ( -11.61624 , 20.61656)
set 4 median 7.57669 95% CI ( -5.66269 , 21.25376)
set 5 median 5.56937 95% CI ( -8.74886 , 16.55189)
set 6 median 6.50121 95% CI ( -8.80387 , 18.62579)
set 7 median 9.95110 95% CI ( -1.49663 , 25.86756)
set 8 median 8.14581 95% CI ( -6.96957 , 25.45583)
=====================
BMB510 Being Bayesian
=====================
2501 integration points
Bayesian hierarchical multiple means analysis
using a hierarchical model characterized by hyper-parameters
mu, tau govering gaussian prior distribution of population means
using the approach of Gelman et al, DBA3 chapter 5, in the 8-schools case
Input data as
(1) pairs of mean, std. error
(2) J sets of raw data {y_i}
Option 1 or 2 >>
name of file 1 set of raw data, one float per line (exit to end input)>> # data points 11
name of file 1 set of raw data, one float per line (exit to end input)>> # data points 10
name of file 1 set of raw data, one float per line (exit to end input)>> # data points 10
name of file 1 set of raw data, one float per line (exit to end input)>>
# of data sets read: 3
input data mean stderr:
0.72182 0.05515
0.63600 0.04918
0.63400 0.08042
global mean, stdev of means: 0.66394 0.04093
tau 95% limits: ( 0.00000 to 0.26958)
sampling randomly from posterior...
mean of means from 5000 samples: 0.66629
set 1 median 0.69550 95% CI ( 0.60709 , 0.80182)
set 2 median 0.64935 95% CI ( 0.55748 , 0.73051)
set 3 median 0.65438 95% CI ( 0.52340 , 0.76589)
=====================
BMB510 Being Bayesian
=====================
2501 integration points
Bayesian analysis of two sets of non-parametric data
bayesian version of wilcoxon rank test, as suggested in
ch. 4 of Gelman, BDA3
Preprocesses two data files, produces two output files
quantile_rank1.dat, quantile_rank2.dat in which the data is transform
into its rank within the two data sets
Then use DifferenceInMeans.py on these two files to compare mean ranks
HOWEVER, the only quantity that has meaning is probability 'mean rank'
of A is < or > than 'mean rank' of B
input file 1: testdata/rank1_test.dat
input file 2: testdata/rank2_test.dat
# test data for bayesian rank test
# data points 4
# test data for bayesian rank test
# data points 4
merging, sorting and ranking data...
converting data to quantiles...
writing quantile files quantile_rank1.dat quantile_rank2.dat
Now run Bayesian analysis of difference in means on quantile files by:
DifferenceInMeans.py quantile_rank1.dat quantile_rank2.dat
and look for p(dMean) < 0., >0.
=====================
BMB510 Being Bayesian
=====================
2501 integration points
implement bayesian analysis of two diff population means
using gaussian approx to distributions, i.e. large sample case
if both sample sizes > 10, otherwise uses small population
(T-distribution) form conservatively assuming two populations
do NOT have same variance
work with logp
input file 1: quantile_rank1.dat
input file 2: quantile_rank2.dat
# ranks of set 1 read from file
# testdata/rank1_test.dat
# as quantiles output from RankTest.py
# data points 4
# ranks of set 2 read from file
# testdata/rank2_test.dat
# as quantiles output from RankTest.py
# data points 4
===========================================================
sample (data) summary
===========================================================
Av X1 50.00000 Av X2 43.75000 Var of X1 820.31250 Var of X2 781.25000
Av X2 - Av X1 -6.25000
std. dev. of X1 data 28.64110 std. dev. of X2 data 27.95085
st.dev ratio from data (s1/s2): 1.0247
std.err of <X1> 16.53595 std.err of <X2> 16.13743 std.err of <X2-X1> 23.10528
===========================================================
using small population (T-distribution) form and assuming two populations
do NOT have same variance. Working....
===========================================================
SUMMARY of posterior distribution for difference (set 2 - set 1) of population means
===========================================================
mean: -6.25000 mode: -6.25000
median: -6.36091
2.5% to 97.5% limits: ( -75.23314 to 62.62223)
===========================================================
p(dMean) < 0., >0.: 0.591 0.409
===========================================================
SUMMARY of posterior distribution for set 1 std. deviation
===========================================================
mean: 41.61848 mode: 28.63214
median: 36.59281
2.5% to 97.5% limits: ( 18.64902 to 93.26421)
===========================================================
===========================================================
SUMMARY of posterior distribution for set 2 std. deviation
===========================================================
mean: 40.77060 mode: 27.94365
median: 35.73220
2.5% to 97.5% limits: ( 18.21872 to 92.23147)
===========================================================
Calculating posterior for ratio of sample std.deviations ...
===========================================================
SUMMARY of posterior distribution for std.dev1/std.dev2
===========================================================
mean: 0.79733 mode: 0.45881
median: 0.95016
2.5% to 97.5% limits: ( 0.30672 to 2.11727)
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
bayesian analysis of decay length/time data, assuming exponential decay
work with log p for large N
file with event distance or time data, 1 per line>
input file: testdata/decayTime_test.dat
# data for bayesian decay length/time analysis using exp. decay model
# data points 6
data: smallest: 1.50000 largest: 12.0 sum: 27.50000
enter lower exptl. window: must be less than min of data> enter upper exptl. window: must be more than max of data>
lower 1.000000 and upper 20.0 length or time windows
===========================================================
SUMMARY of posterior distribution for decay length/time
===========================================================
mean: 7.72757 mode: 3.10841
median: 4.35749
2.5% to 97.5% limits: ( 1.90676 to 42.93642)
===========================================================
=====================
BMB510 Being Bayesian
=====================
2501 integration points
basic bayesian version of parametric model of survival data
using the general, flexible Weibull distbn.
input file with either:
one event/decay/death time
or:
one time at which observation was stopped (right censoring)
per line. In the file the latter should be entered as negative value (!) to indicate that
observation was right censored, i.e. still surviving after observation stopped.
Program also requires a left censor time (for no left censoring use 0.)
input file:
testdata/survival_test1.dat
# test data for survival curves, taken from table 1.1 of
# cox and oakes 'analysis of survival data' p8,
# control group - censored data flagged by -ve time
# data points 21
dead time (left censor limit), # in dead time: 0.0 0
# of events, stopped observations: 21 0
min, max times: 1.0 23.0
nt = 13
MLE estimate of hazard: 0.11538
===========================================================
SUMMARY of posterior distribution for shape parameter
===========================================================
mean: 1.30786 mode: 1.27305
median: 1.29370
2.5% to 97.5% limits: ( 0.87919 to 1.78496)
===========================================================
===========================================================
SUMMARY of posterior distribution for scale parameter
===========================================================
mean: 9.61414 mode: 9.18559
median: 9.46099
2.5% to 97.5% limits: ( 6.44401 to 13.48613)
===========================================================
95% half life: ( 4.24727 - 10.98277 )
=====================
BMB510 Being Bayesian
=====================
2501 integration points
basic bayesian version of parametric model of survival data
using the general, flexible Weibull distbn.
input file with either:
one event/decay/death time
or:
one time at which observation was stopped (right censoring)
per line. In the file the latter should be entered as negative value (!) to indicate that
observation was right censored, i.e. still surviving after observation stopped.
Program also requires a left censor time (for no left censoring use 0.)
input file:
testdata/survival_test2.dat
# test data for survival curves, taken from table 1.1 of
# cox and oakes 'analysis of survival data' p8,
# treatment with 6-MP group - censored data flagged by -ve time
# data points 21
dead time (left censor limit), # in dead time: 0.0 0
# of events, stopped observations: 9 12
min, max times: 6.0 35.0
nt = 17
MLE estimate of hazard: 0.02507
===========================================================
SUMMARY of posterior distribution for shape parameter
===========================================================
mean: 1.28260 mode: 1.19368
median: 1.23272
2.5% to 97.5% limits: ( 0.66874 to 2.06318)
===========================================================
===========================================================
SUMMARY of posterior distribution for scale parameter
===========================================================
mean: 44.66466 mode: 32.05281
median: 38.42975
2.5% to 97.5% limits: ( 22.29786 to 101.91203)
===========================================================
95% half life: ( 12.88967 - 85.32480 )
=====================
BMB510 Being Bayesian
=====================
2501 integration points
implement linear regression equations with variances of slope, intercept, and 2-sigma
(95% credible interval) lines
see mendenhall and schaeffer, sivia & skilling
also do model where minimize perpendicular distance from line, not dy - this is symmetric in x &y
input file: testdata/linearRegression_test.dat
# xy data
# test for linear_regression.py
# data points 63
===========================================================
data summary
===========================================================
av x 0.57777 y 10.11651 xy 5.73491
av x^2 0.39472 y^2 104.04982
var x 0.06090 y 1.70609 xy -0.11007
stdev x 0.24678 y 1.30617
Pearson R -0.34147 R^2 0.11660
===========================================================
===========================================================
"Standard" fitting, that minimizes mean sq Y-distance to line
===========================================================
standard slope -1.80734 intercept 11.16073
zero intercept slope 14.52924 Pearson R 0.89488
===========================================================
candidates for slopes with Dperp minimized: 0.06661 -15.01354
candidates for intercepts with Dperp minimized: 10.07802 18.79083
Residuals for two candidates: 107.94550 3.37488
===========================================================
Alternative fitting parameters that minimize distance to line
This fit is symmetric (unchanged if x and y are swapped)
===========================================================
minmum distance slope -15.01354 intercept 18.79083
===========================================================
===========================================================
confidence intervals for standard fit
===========================================================
upper 95 percent CI slope -0.53345 intercept 10.42472
lower 95 percent CI slope -3.08123 intercept 11.89674
===========================================================
plottable data written to linear_regression_plot.dat
=====================
BMB510 Being Bayesian
=====================
2501 integration points
fit data to y = mx + b using
least sum of |y - mx - b|, or L1 norm instead of sum of sq's
input file: testdata/linearRegression_test.dat
# xy data
# test for linear_regression.py
# data points 63
===========================================================
data summary
===========================================================
av x 0.57777 y 10.11651 xy 5.73491
av x^2 0.39472 y^2 104.04982
var x 0.06090 y 1.70609 xy -0.11007
stdev x 0.24678 y 1.30617
Pearson R -0.34147 R^2 0.11660
===========================================================
minimizing absolute Y-deviation...
mean abs deviation 0.94754 by passing through points 12 and 40
mean absolute deviation 0.94754 slope -1.84739 intercept 11.17920
=====================
BMB510 Being Bayesian
=====================
2501 integration points
implement linear regression equations with variances of slope, intercept, and 2-sigma(95% CI) lines
see mendenhall and schaeffer, sivia & skilling
slope from bayesian analysis which treats x, y symmetrically - see S. Gull (1988)
input file: testdata/linearRegression_test.dat
# xy data
# test for linear_regression.py
# data points 63
===========================================================
data summary
===========================================================
av x 0.57777 y 10.11651 xy 5.73491
av x^2 0.39472 y^2 104.04982
var x 0.06090 y 1.70609 xy -0.11007