X-Git-Url: http://unremediatedgender.space/source?p=Ultimately_Untrue_Thought.git;a=blobdiff_plain;f=notes%2Fdeflation.py;fp=notes%2Fdeflation.py;h=72d09273e371994f9e233bea0a582910710b5d4a;hp=77efe237e13e1f5799e654c01f2363ccc7d6b751;hb=2fc071e3d84c1ead3fcc932cba95bae1b28a18a7;hpb=1207840d562a974eeefe6072299fd084e53088ef diff --git a/notes/deflation.py b/notes/deflation.py index 77efe23..72d0927 100644 --- a/notes/deflation.py +++ b/notes/deflation.py @@ -16,32 +16,32 @@ def cohens_d(X, Y): ) ) -def population_with_error(μ, σ, n): +def population_with_error(μ, ε, n): def trait(): return normal(μ, 1) def measurement_error(): - return normal(0, σ) + return normal(0, ε) return [trait() + measurement_error() for _ in range(n)] # trait differs by 1 standard deviation -adjusted_f = population_with_error(1, 0, 10000) -adjusted_m = population_with_error(0, 0, 10000) +true_f = population_with_error(1, 0, 10000) +true_m = population_with_error(0, 0, 10000) # as above, but with 0.5 standard units measurment error measured_f = population_with_error(1, 0.5, 10000) measured_m = population_with_error(0, 0.5, 10000) -smart_d = cohens_d(adjusted_f, adjusted_m) -print(smart_d) # 1.0193773432617055 — d≈1.0, as expected! +true_d = cohens_d(true_f, true_m) +print(true_d) # 1.0193773432617055 — d≈1.0, as expected! naïve_d = cohens_d(measured_f, measured_m) print(naïve_d) # 0.8953395386313235 -def performance(g, σ_g, s, n): +def performance(μ_g, σ_g, s, n): def general_ability(): - return normal(g, σ_g) + return normal(μ_g, σ_g) def special_ability(): return normal(s, 1) return [general_ability() + special_ability() for _ in range(n)]