81b77697dcd6103d96361e646b8b716f32c047a8
[Ultimately_Untrue_Thought.git] / content / 2019 / does-general-intelligence-deflate-standardized-effect-sizes-of-cognitive-sex-differences.md
1 Title: Does General Intelligence Deflate Standardized Effect Sizes of Cognitive Sex Differences?
2 Date: 2019-09-01 22:50
3 Category: commentary
4 Tags: statistics, Python, sex differences
5
6 Marco del Guidice[ref]I was telling friend of the blog [Tailcalled](https://surveyanon.wordpress.com/) the other week that we really need to start a Marco del Guidice Fan Club![/ref] points out[ref]Marco del Guidice, ["Measuring Sex Differences and Similarities"](https://marcodgdotnet.files.wordpress.com/2019/04/delgiudice_measuring_sex-differences-similarities_pre.pdf), §2.3.3, "Measurement Error and Other Artifacts"[/ref] that in the presence of measurement error, standardized effect size measures like [Cohen's _d_](https://rpsychologist.com/d3/cohend/) will underestimate the "true" effect size.
7
8 The effect size _d_ tries to quantify the difference between two distributions by reporting the difference between the distributions' means in _standardized_ units—units that have been scaled to take into account how "spread out" the data is. This gives us a common reference scale for _how big_ a given statistical difference is. Height is measured in meters, and "Agreeableness" in the [Big Five personality model](https://en.wikipedia.org/wiki/Big_Five_personality_traits) is an abstract construct that doesn't even have natural units, and yet there's still a meaningful sense in which we can say that the sex difference in height (_d_≈1.7) is "about three times larger" than the sex difference in Agreeableness (_d_≈0.5).[ref]Yanna J. Weisberg, Colin G. DeYoung, and Jacob B. Hirsh, ["Gender Differences in Personality across the Ten Aspects of the Big Five"](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3149680/), Table 2[/ref]
9
10 Cohen's _d_ is computed as the difference in group means, divided by the square root of the pooled variance. Thus, holding _actual_ sex differences constant, more measurement error means more variance, which means smaller values of _d_. Here's some toy Python code illustrating this effect:[ref]Special thanks to Tailcalled for [catching a bug](http://unremediatedgender.space/source?p=Ultimately_Untrue_Thought.git;a=commitdiff;h=c5158d9a6feaa7ed5c770e6ace83d7e7ba2451e6) in the initially published version of this code.[/ref]
11
12 ```python
13 from math import sqrt
14 from statistics import mean, variance
15
16 from numpy.random import normal, seed
17
18 # seed the random number generator for reproducibility of figures in later
19 # comments; commment this out to run a new experiment
20 seed(1)  # https://en.wikipedia.org/wiki/Nothing-up-my-sleeve_number
21
22 def cohens_d(X, Y):
23     return (
24         (mean(X) - mean(Y)) /
25         sqrt(
26             (len(X)*variance(X) + len(Y)*variance(Y)) /
27             (len(X) + len(Y))
28         )
29     )
30
31 def population_with_error(μ, ε, n):
32     def trait():
33         return normal(μ, 1)
34     def measurement_error():
35         return normal(0, ε)
36     return [trait() + measurement_error() for _ in range(n)]
37
38
39 # trait differs by 1 standard deviation
40 true_f = population_with_error(1, 0, 10000)
41 true_m = population_with_error(0, 0, 10000)
42
43 # as above, but with 0.5 standard units measurment error
44 measured_f = population_with_error(1, 0.5, 10000)
45 measured_m = population_with_error(0, 0.5, 10000)
46
47 true_d = cohens_d(true_f, true_m)
48 print(true_d)  # 1.0069180384313943 — d≈1.0, as expected!
49
50 naïve_d = cohens_d(measured_f, measured_m)
51 print(naïve_d)  # 0.9012430127962895 — deflated!
52 ```
53
54 But doesn't a similar argument hold for non-error sources of variance that are "orthogonal" to the group difference? Suppose performance on some particular cognitive task can be modeled as the sum of the general intelligence factor (zero or negligible sex difference), and a special ability factor that does show sex differences.[ref]Arthur Jensen, _The g Factor_, Chapter 13: "Although no evidence was found for sex differences in the mean level of _g_ or in the variability of _g_, there is clear evidence of marked sex differences in group factors and in test specificity. Males, on average, excel on some factors; females on others. [...] But the best available evidence fails to show a sex difference in _g_."[/ref] Then, even with zero measurement error, _d_ would underestimate the difference between women and men _of the same general intelligence_—
55
56 ```python
57 def performance(μ_g, σ_g, s, n):
58     def general_ability():
59         return normal(μ_g, σ_g)
60     def special_ability():
61         return normal(s, 1)
62     return [general_ability() + special_ability() for _ in range(n)]
63
64 # ♀ one standard deviation better than ♂ at the special factor
65 population_f = performance(0, 1, 1, 10000)
66 population_m = performance(0, 1, 0, 10000)
67
68 # ... but suppose we control/match for general intelligence
69 matched_f = performance(0, 0, 1, 10000)
70 matched_m = performance(0, 0, 0, 10000)
71
72 population_d = cohens_d(population_f, population_m)
73 print(population_d)  # 0.7413662423265308 — deflated!
74
75 matched_d = cohens_d(matched_f, matched_m)
76 print(matched_d)  # 1.0346898918452228 — as you would expect
77 ```