203 lines
7.9 KiB
HTML
203 lines
7.9 KiB
HTML
<!DOCTYPE html>
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
|
|
|
<meta charset="utf-8">
|
|
<meta name="generator" content="quarto-1.1.251">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
|
|
|
<meta name="author" content="Emanuel Rodriguez">
|
|
|
|
<title>Beta-Binomial Bayesian Model Example</title>
|
|
<style>
|
|
code{white-space: pre-wrap;}
|
|
span.smallcaps{font-variant: small-caps;}
|
|
div.columns{display: flex; gap: min(4vw, 1.5em);}
|
|
div.column{flex: auto; overflow-x: auto;}
|
|
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
|
ul.task-list{list-style: none;}
|
|
ul.task-list li input[type="checkbox"] {
|
|
width: 0.8em;
|
|
margin: 0 0.8em 0.2em -1.6em;
|
|
vertical-align: middle;
|
|
}
|
|
</style>
|
|
|
|
|
|
<script src="beta-binomial_files/libs/clipboard/clipboard.min.js"></script>
|
|
<script src="beta-binomial_files/libs/quarto-html/quarto.js"></script>
|
|
<script src="beta-binomial_files/libs/quarto-html/popper.min.js"></script>
|
|
<script src="beta-binomial_files/libs/quarto-html/tippy.umd.min.js"></script>
|
|
<script src="beta-binomial_files/libs/quarto-html/anchor.min.js"></script>
|
|
<link href="beta-binomial_files/libs/quarto-html/tippy.css" rel="stylesheet">
|
|
<link href="beta-binomial_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
|
|
<script src="beta-binomial_files/libs/bootstrap/bootstrap.min.js"></script>
|
|
<link href="beta-binomial_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
|
|
<link href="beta-binomial_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
|
|
|
|
<script>window.backupDefine = window.define; window.define = undefined;</script><script src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js"></script>
|
|
<script>document.addEventListener("DOMContentLoaded", function () {
|
|
var mathElements = document.getElementsByClassName("math");
|
|
var macros = [];
|
|
for (var i = 0; i < mathElements.length; i++) {
|
|
var texText = mathElements[i].firstChild;
|
|
if (mathElements[i].tagName == "SPAN") {
|
|
katex.render(texText.data, mathElements[i], {
|
|
displayMode: mathElements[i].classList.contains('display'),
|
|
throwOnError: false,
|
|
macros: macros,
|
|
fleqn: false
|
|
});
|
|
}}});
|
|
</script>
|
|
<script>window.define = window.backupDefine; window.backupDefine = undefined;</script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css">
|
|
|
|
<link rel="stylesheet" href="styles.css">
|
|
</head>
|
|
|
|
<body class="fullcontent">
|
|
|
|
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
|
|
|
|
<main class="content" id="quarto-document-content">
|
|
|
|
<header id="title-block-header" class="quarto-title-block default">
|
|
<div class="quarto-title">
|
|
<h1 class="title">Beta-Binomial Bayesian Model Example</h1>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="quarto-title-meta">
|
|
|
|
<div>
|
|
<div class="quarto-title-meta-heading">Author</div>
|
|
<div class="quarto-title-meta-contents">
|
|
<p>Emanuel Rodriguez </p>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</header>
|
|
|
|
<section id="introduction" class="level2">
|
|
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
|
|
<p>In this short article I will try to put together a set of notes to go over the Beta-Binomial Bayesian Model. The example used here is pretty trivial but so is this model so :shrug:</p>
|
|
</section>
|
|
<section id="when-to-use-the-beta-binomial" class="level2">
|
|
<h2 class="anchored" data-anchor-id="when-to-use-the-beta-binomial">When to use the Beta-Binomial?</h2>
|
|
<p>The situations it makes sense to use the Beta-Binomial Model (BBM) are cases where we have some conditional dependence between a random variable <span class="math inline">Y</span> and a continuous parameter <span class="math inline">\pi \in [0, 1]</span>. Where <span class="math inline">Y</span> is the number of successes in <span class="math inline">n</span> independent trials, each with a probability of success <span class="math inline">\pi</span>.</p>
|
|
<p>For the sake of these notes, let us start by setting up an example that will allow us to illustrate the implementation of this model. Suppose there is a slot machine manufacturer who recently was accused of embedding software into the hardware that would cause more losses than usual to players. To be allowed to continue selling machines to casinos, they must go through a series of inspections. The body governing the sale of these machines has tasked us to determine whether or not the software has been completely removed or if, instead, the company refined the bias to make it less noticeable.</p>
|
|
</section>
|
|
<section id="what-we-already-know" class="level2">
|
|
<h2 class="anchored" data-anchor-id="what-we-already-know">What we already know</h2>
|
|
</section>
|
|
|
|
</main>
|
|
<!-- /main column -->
|
|
<script id="quarto-html-after-body" type="application/javascript">
|
|
window.document.addEventListener("DOMContentLoaded", function (event) {
|
|
const toggleBodyColorMode = (bsSheetEl) => {
|
|
const mode = bsSheetEl.getAttribute("data-mode");
|
|
const bodyEl = window.document.querySelector("body");
|
|
if (mode === "dark") {
|
|
bodyEl.classList.add("quarto-dark");
|
|
bodyEl.classList.remove("quarto-light");
|
|
} else {
|
|
bodyEl.classList.add("quarto-light");
|
|
bodyEl.classList.remove("quarto-dark");
|
|
}
|
|
}
|
|
const toggleBodyColorPrimary = () => {
|
|
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
|
|
if (bsSheetEl) {
|
|
toggleBodyColorMode(bsSheetEl);
|
|
}
|
|
}
|
|
toggleBodyColorPrimary();
|
|
const icon = "";
|
|
const anchorJS = new window.AnchorJS();
|
|
anchorJS.options = {
|
|
placement: 'right',
|
|
icon: icon
|
|
};
|
|
anchorJS.add('.anchored');
|
|
const clipboard = new window.ClipboardJS('.code-copy-button', {
|
|
target: function(trigger) {
|
|
return trigger.previousElementSibling;
|
|
}
|
|
});
|
|
clipboard.on('success', function(e) {
|
|
// button target
|
|
const button = e.trigger;
|
|
// don't keep focus
|
|
button.blur();
|
|
// flash "checked"
|
|
button.classList.add('code-copy-button-checked');
|
|
var currentTitle = button.getAttribute("title");
|
|
button.setAttribute("title", "Copied!");
|
|
setTimeout(function() {
|
|
button.setAttribute("title", currentTitle);
|
|
button.classList.remove('code-copy-button-checked');
|
|
}, 1000);
|
|
// clear code selection
|
|
e.clearSelection();
|
|
});
|
|
function tippyHover(el, contentFn) {
|
|
const config = {
|
|
allowHTML: true,
|
|
content: contentFn,
|
|
maxWidth: 500,
|
|
delay: 100,
|
|
arrow: false,
|
|
appendTo: function(el) {
|
|
return el.parentElement;
|
|
},
|
|
interactive: true,
|
|
interactiveBorder: 10,
|
|
theme: 'quarto',
|
|
placement: 'bottom-start'
|
|
};
|
|
window.tippy(el, config);
|
|
}
|
|
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
|
for (var i=0; i<noterefs.length; i++) {
|
|
const ref = noterefs[i];
|
|
tippyHover(ref, function() {
|
|
// use id or data attribute instead here
|
|
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
|
|
try { href = new URL(href).hash; } catch {}
|
|
const id = href.replace(/^#\/?/, "");
|
|
const note = window.document.getElementById(id);
|
|
return note.innerHTML;
|
|
});
|
|
}
|
|
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
|
|
for (var i=0; i<bibliorefs.length; i++) {
|
|
const ref = bibliorefs[i];
|
|
const cites = ref.parentNode.getAttribute('data-cites').split(' ');
|
|
tippyHover(ref, function() {
|
|
var popup = window.document.createElement('div');
|
|
cites.forEach(function(cite) {
|
|
var citeDiv = window.document.createElement('div');
|
|
citeDiv.classList.add('hanging-indent');
|
|
citeDiv.classList.add('csl-entry');
|
|
var biblioDiv = window.document.getElementById('ref-' + cite);
|
|
if (biblioDiv) {
|
|
citeDiv.innerHTML = biblioDiv.innerHTML;
|
|
}
|
|
popup.appendChild(citeDiv);
|
|
});
|
|
return popup.innerHTML;
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
</div> <!-- /content -->
|
|
|
|
|
|
|
|
</body></html> |