Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# ─────────────────────────────────────────────────────────────────────────────
#
# TeXpresso Build Script
# ======================
#
# Overview
# --------
#
#!/bin/bash
set -euo pipefail
# ── Preconditions ────────────────────────────────────────────────────────────
need() { command -v "$1" >/dev/null 2>&1 || { echo "$1 is required." >&2; exit 1; }; }
need docker
need dpkg-deb
need fakeroot
@jpasquier
jpasquier / unisante_phenobese_n_welch_t_test.R
Created June 20, 2023 08:51
[Unisanté - Phenobese] Sample size for a 2-sided Welch's t-test
n_welch_t_test <- function(m1, s1, m2, s2, r = 1, alpha = .05, pwr = .8) {
root_func <- function(n1) {
n2 <- r * n1
d <- m2 - m1
s <- sqrt(s1^2 / n1 + s2^2 / n2)
ncp = abs(d) / s
nu <- (s1^2 / n1 + s2^2 / n2)^2 /
(s1^4 / (n1^2 * (n1 - 1)) + s2^4 / (n2^2 * (n2 - 1)))
qu <- qt(1 - alpha / 2, nu)
1 - pt(qu, nu, ncp = ncp) + pt(-qu, nu, ncp = ncp) - pwr
#!/bin/python3
import numpy as np
import matplotlib.pyplot as plt
from multiprocessing import Pool, cpu_count
np.random.seed(666)
# Function that calculates (by simulation) the overflow probability of the
# system
@jpasquier
jpasquier / rush.R
Last active December 14, 2022 15:06
library(ggplot2)
library(parallel)
options(mc.cores = detectCores() - 1)
RNGkind("L'Ecuyer-CMRG")
set.seed(666)
# Function that calculates (by simulation) the overflow probability of the
# system