16 September 2018 6:31:53.110 PM BAYES_BETA Simple Bayesian Statistics demonstrations. BAYES_BETA Simple Bayesian Statistics demonstrations. Suppose we're watching a "system" and trying to analyze its behavior. Each time we observe the system, it flips a coin a certain number of times, and reports the number of heads and tails. We want to estimate THETA1 and THETA2, the probabilities of heads and of tails. We treat the values of THETA1 and THETA2 as random variables themselves, controlled by a Beta probability density function, which has parameters ALPHA1 and ALPHA2. We make an arbitrary or informed guess for initial values of ALPHA1 and ALPHA2. We observe the system, and adjust ALPHA1 and ALPHA2 using Bayes's Law. We continue until we are satisfied that our estimates seem to have converged. Run parameters: THETA1/THETA2: 0.750000 0.250000 Number of observations to make = 4 Number of tosses per observation = 5 Initial data: ALPHA1/ALPHA2 0.500000 0.500000 THETA1/THETA2: 0.500000 0.500000 Plot of Beta distribution, ALPHA1 = 0.500000 ALPHA2 = 0.500000 T BETA(T,ALPHA1,ALPHA2) 0.00000 0.00000 0.500000E-01 1.46051 0.100000 1.06103 0.150000 0.891446 0.200000 0.795775 0.250000 0.735105 0.300000 0.694609 0.350000 0.667359 0.400000 0.649747 0.450000 0.639827 0.500000 0.636620 0.550000 0.639827 0.600000 0.649747 0.650000 0.667359 0.700000 0.694609 0.750000 0.735105 0.800000 0.795775 0.850000 0.891446 0.900000 1.06103 0.950000 1.46051 1.00000 0.00000 BAYES_BETA - After observation 1 Prior observation data: Tosses: 0 Heads/Tails: 0 0 ALPHA1/ALPHA2: 0.500000 0.500000 THETA1/THETA2: 0.500000 0.500000 Observation data: Tosses: 5 Heads/Tails: 3 2 Post observation data: Tosses: 5 Heads/Tails: 3 2 ALPHA1/ALPHA2: 3.50000 2.50000 THETA1/THETA2: 0.583333 0.416667 BAYES_BETA - After observation 2 Prior observation data: Tosses: 5 Heads/Tails: 3 2 ALPHA1/ALPHA2: 3.50000 2.50000 THETA1/THETA2: 0.583333 0.416667 Observation data: Tosses: 5 Heads/Tails: 5 0 Post observation data: Tosses: 10 Heads/Tails: 8 2 ALPHA1/ALPHA2: 8.50000 2.50000 THETA1/THETA2: 0.772727 0.227273 BAYES_BETA - After observation 3 Prior observation data: Tosses: 10 Heads/Tails: 8 2 ALPHA1/ALPHA2: 8.50000 2.50000 THETA1/THETA2: 0.772727 0.227273 Observation data: Tosses: 5 Heads/Tails: 3 2 Post observation data: Tosses: 15 Heads/Tails: 11 4 ALPHA1/ALPHA2: 11.5000 4.50000 THETA1/THETA2: 0.718750 0.281250 BAYES_BETA - After observation 4 Prior observation data: Tosses: 15 Heads/Tails: 11 4 ALPHA1/ALPHA2: 11.5000 4.50000 THETA1/THETA2: 0.718750 0.281250 Observation data: Tosses: 5 Heads/Tails: 4 1 Post observation data: Tosses: 20 Heads/Tails: 15 5 ALPHA1/ALPHA2: 15.5000 5.50000 THETA1/THETA2: 0.738095 0.261905 Plot of Beta distribution, ALPHA1 = 15.5000 ALPHA2 = 5.50000 T BETA(T,ALPHA1,ALPHA2) 0.00000 0.00000 0.500000E-01 0.150402E-13 0.100000 0.273227E-09 0.150000 0.755337E-07 0.200000 0.372625E-05 0.250000 0.708497E-04 0.300000 0.730519E-03 0.350000 0.489248E-02 0.400000 0.236583E-01 0.450000 0.882360E-01 0.500000 0.264766 0.550000 0.656368 0.600000 1.36425 0.650000 2.38771 0.700000 3.49462 0.750000 4.18361 0.800000 3.90726 0.850000 2.57880 0.900000 0.952684 0.950000 0.922125E-01 1.00000 0.00000 BAYES_BETA: Normal end of execution. 16 September 2018 6:31:53.111 PM