Skip to content

Instantly share code, notes, and snippets.

View dharasim's full-sized avatar

Daniel Harasim dharasim

View GitHub Profile
def permutation_simulation(higher, lower, n=100_000):
xs = higher
ys = lower
m = np.mean(xs) - np.mean(ys)
zs = np.concatenate((xs, ys))
z_perms = np.random.choice(ys, size=(n, len(zs)))
x_perms = z_perms[:, 0:len(xs)]
y_perms = z_perms[:, len(xs)+1:]
x_perm_means = np.mean(x_perms, 1)
y_perm_means = np.mean(y_perms, 1)
using Distributions
using Random: AbstractRNG
using StatsBase: proportionmap
using Test
# Generic categoricals are also known as empirical measures.
struct GenericCategorical{T}
mapping :: Dict{T, Float64}
values :: Vector{T}
probs :: Vector{Float64}