Fork Me on GitHub

Bayesian Calculator

Easy drop-in calculator

Download this project as a .zip file Download this project as a tar.gz file

This project provides an easy method for internet authors to add a Bayes' Theorem calculator and visualization tool to their web pages. The project is in development so if you find any bugs or if you have any suggestions to make you can log them here.

This project uses Underscore.js, RequireJS, almond.js, jQuery, d3.js, jQuery tools, MathJax and less. Thanks to all those awesome developers.

Also a special thanks to Richard Carrier for giving me excellent feedback during the development of the project.

Configuration:

To include any of the following calculators on your page, first you must include this script tag in the head of your document:

<script src="http://camspiers.github.com/Bayes/javascripts/app.bayes.v1.2.1.js" charset="utf-8"></script>

Once this is included on the page, adding a calculator is as easy as adding a small html snippet into the desired location on your page. Each example shows what html snippet is required.

Examples:

Simple

<div class="bayes-calc" data-config='{"type": "simple"}'></div>

Simple with graph

<div class="bayes-calc" data-config='{"type": "simple", "graph": true}'></div>

Full

<div class="bayes-calc" data-config='{"type": "full"}'></div>

Full without equation

<div class="bayes-calc" data-config='{"type": "full", "equation": false}'></div>

Full with bar graph

<div class="bayes-calc" data-config='{"type": "full", "graph": true}'></div>

Full with circle graph

<div class="bayes-calc" data-config='{"type": "full", "graph": "circle"}'></div>

Full area-proportional venn graph

<div class="bayes-calc" data-config='{"type": "full", "graph": "venn"}'></div>

Full with 4 decimal place rounding

<div class="bayes-calc" data-config='{"type": "full", "dp": 4}'></div>

Simple a fortiori

<div class="bayes-calc" data-config='{"type": "simple", "afortiori": true}'></div>

Full a fortiori

<div class="bayes-calc" data-config='{"type": "full", "afortiori": true}'></div>

3 Hypotheses

<div class="bayes-calc" data-config='{"type": "full", "num": 3}'></div>

3 Hypotheses with circle graph

<div class="bayes-calc" data-config='{"type": "full", "num": 3, "graph": "circle", "css": {"width": "870px"}}'></div>