Object Library > Applets > Beta Coin Experiment

Beta Coin Experiment


Description and Use

The experiment is to toss a coin n times, where the probability of heads is p. The probability of heads is modeled with a prior beta distribution, having parameters a and b. The parameters n, p, a, and b can be varied with scroll bars. The prior density and the true probability of heads are shown in blue in the graph on the right. On each update, the number of heads Y is recorded in the first table. On each update, the posterior beta density, which has parameters

a + Y, b + (n - Y)

is shown in red in graph on the right. Also, the Bayesian estimate of p,

U = (a + Y) / (a + b + n)

is recorded in the first table on each update. Finally, the second table gives the true bias and mean square error of U, and on each update gives the empirical bias and mean square error, based on the all of the runs of the experiment.

This experiment illustrates Bayesian estimation, and in particular, the use of a distribution to model a parameter, and the concepts of prior and posterior distribution. The experiment is also relates to Bernoulli trials, the binomial distribution, and the beta distribution. For more information on the mathematical analysis, see

Instructions for Downloading and Installing

Click on the link below to download the Java archive file:

To add the applet to your web page, insert the following in the html file, at the point where you want the applet to appear:

<applet code="edu.uah.math.experiments.BetaCoinExperiment.class" archive="BetaCoinExperiment.jar" width="600" height="400"></applet>

The jar file and the html file must be in the same folder.

This width and height dimensions are simply suggestions and can be varied. Generally, components such as graphs and tables expand and contract proportionally, while components such as buttons, scrollbars, dice, and coins are fixed in size.


Metadata

Type

Keywords

Version

Browser Requirements

Authors

Copyright

Copyright © 2001-2003 Kyle Siegrist, Dawn Duehring

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details.

Related Resources

If you are interested in the Java source code or the Java documentation and object model for this applet, please visit BetaCoinExperiment in the Object section of the Library.