summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKierán Meinhardt <kmein@posteo.de>2023-01-03 20:09:40 +0100
committerKierán Meinhardt <kmein@posteo.de>2023-01-03 20:12:50 +0100
commitc9452d8c45728a370eedf59f7e3c02c5344a7e2c (patch)
tree48ce26f3aa20d326432ac4eff1e74661cbfc40c4
parent1d809b3c2598a11b2edfdb5a7f3abb82bc1e6210 (diff)
bloat: add advanced statistical methods
-rw-r--r--cholerab/bloat/vodka-korn/shell.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/cholerab/bloat/vodka-korn/shell.nix b/cholerab/bloat/vodka-korn/shell.nix
new file mode 100644
index 00000000..82375bb6
--- /dev/null
+++ b/cholerab/bloat/vodka-korn/shell.nix
@@ -0,0 +1,36 @@
+{ pkgs ? import <nixpkgs> {} }:
+pkgs.mkShell {
+ packages = [
+ (pkgs.writers.writePython3Bin "run" {
+ libraries = [
+ pkgs.python3Packages.numpy
+ pkgs.python3Packages.scipy
+ ];
+ } /* py */ ''
+ import numpy as np
+ from scipy.stats import fisher_exact
+ SIGNIFICANCE = 0.05
+
+ # ↓truth| KORN | VODKA |←guess
+ # ------------------------
+ # KORN | a | b |
+ # VODKA | c | d |
+
+ a = 4
+ b = 0
+ c = 0
+ d = 4
+
+ _, p_value = fisher_exact(np.array([[a, b], [c, d]], np.int32))
+
+ print("Scientists have found out", end=": ")
+
+ if p_value < SIGNIFICANCE:
+ print("korn != vodka.")
+ else:
+ print("korn == vodka.")
+
+ print(f"p-value: {p_value} (threshold: {SIGNIFICANCE})")
+ '')
+ ];
+}