Code
viewof alpha = Inputs.range([1, 20], {label: 'alpha', step: 0.1})
viewof beta = Inputs.range([1, 20], {label: 'beta', step: 0.1})Sheng Long
January 16, 2026
Playing with Observable JS to see how different parameters affect PDF and CDFs of interest.
The Beta distribution is defined by two parameters: \(\alpha \in [1, \infty)\) and \(\beta \in [1, \infty)\). Its PDF can be expressed as \[ f(x; \alpha, \beta) = \frac{x^{\alpha-1}(1-x)^{\beta - 1}}{B((\alpha, \beta))} = x^{\alpha - 1}(1-x)^{\beta-1} \times \frac{\Gamma(\alpha + \beta)}{\Gamma(\alpha) + \Gamma(\beta)} \] where \(\Gamma(\cdot)\) is the Gamma function.
x = linspace(0.0, 1.0, 100)
plot_data = get_data(x, alpha, beta);
p1 = Plot.plot({
x: {
domain: [0, 1]
},
title: "Beta PDF",
marks: [
Plot.line(plot_data, {x: "x", y: "pdf_y"})
]
})
p2 = Plot.plot({
x: {
domain: [0, 1]
},
title: "Beta CDF",
marks: [
Plot.line(plot_data, {x: "x", y: "cdf_y"})
]
})
// Assuming plot1 and plot2 are defined variables holding your charts
html`
<div style="display: flex; flex-direction: row; gap: 20px; align-items: flex-start;">
<div style="flex: 1;">
${p1}
</div>
<div style="flex: 1;">
${p2}
</div>
</div>
`The Gumbel distribution is a particular case of the generalized extreme value distribution.
gumbel_pdf = (await import("https://esm.sh/@stdlib/stats-base-dists-gumbel-pdf")).default
gumbel_cdf = (await import("https://esm.sh/@stdlib/stats-base-dists-gumbel-cdf")).default
function get_gumbel_data(x, mu, beta) {
var i;
var points = [];
for ( i = 0; i < x.length; i++ ) {
points.push({x: x[i],
pdf_y: gumbel_pdf(x[i], mu, gumbel_beta),
cdf_y: gumbel_cdf(x[i], mu, gumbel_beta)
});
}
return points;
}
plot_gumbel_data = get_gumbel_data(x, gumbel_mu, gumbel_beta)The Weibull distribution, with shape parameter \(k \in (0, \infty)\) and scale parameter \(\lambda \in (0, + \infty)\). Its pdf is defined as
\[ f(x; \lambda, k) = \begin{cases} \frac{k}{\lambda}(\frac{x}{\lambda})^{k-1} e^{-(x/\lambda)^k}, & x \geq 0, \\ 0, & x < 0 \end{cases} \]