Public
Edited
Jun 3, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
min_entropy_posterior_alpha = snake_bite_deaths + 1
Insert cell
min_entropy_posterior_beta = sample_size - snake_bite_deaths + 1
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
subjective_posterior_alpha = prior_alpha + snake_bite_deaths
Insert cell
subjective_posterior_beta = prior_beta + sample_size - snake_bite_deaths
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mean_estimate = portion_snake_bites
Insert cell
var_estimate = portion_snake_bites * (1 - portion_snake_bites)/ sample_size
Insert cell
Insert cell
confidence_interval = [mean_estimate - 1.96 * Math.sqrt(var_estimate), mean_estimate + 1.96 * Math.sqrt(var_estimate)]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
significance = 0.05
Insert cell
power = 0.8
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
jstat = require('jstat')
Insert cell
Insert cell
beta_binomial_pdf = (x, n, alpha, beta) => Math.exp(jstat.factorialln(n) - jstat.factorialln(x) - jstat.factorialln(n - x) + jstat.betaln(x + alpha,n - x + beta) - jstat.betaln(alpha, beta))
Insert cell
lnBetaFunc = (a, b) => {
// Log Beta Function
// ln(Beta(x,y))
let foo = 0.0;

for (let i=0; i<a-2; i++) {
foo += Math.log(a-1-i);
}
for (let i=0; i<b-2; i++) {
foo += Math.log(b-1-i);
}
for (let i=0; i<a+b-2; i++) {
foo -= Math.log(a+b-1-i);
}
return foo
}

Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more