I have summaries of hundreds of variables for two populations. Most of these variables are counts, but some are continuous. For example, if I had population sizes $N_0 = 20000$ people and $N_1 = 10000$, I might have a:
Count variable: people with red hair. There are $X_0 = 2000$ and $X_1 = 2500$ redheads in populations 0 and 1, respectively.
Continuous variable: age. In population 0, average age is $\bar{X_0} = 52$ with standard deviation $S_0 = 17$. In population 1, $\bar{X_1} = 62$ and $S_1 = 16$
And my file might look like:
library(data.table)
(d <- data.table(var_type = c('bin', 'cont'), var_name = c('redhead', 'age'),
n_0 = c(2e4L, 2e4L), n_1 = c(1e4L, 1e4L),
x_0 = c(2e3L, NA), x_1 = c(2500L, NA),
avg_0 = c(NA, 52), avg_1 = c(NA, 62),
sdev_0 = c(NA, 17), sdev_1 = c(NA, 16)
) )
# var_type var_name n_0 n_1 x_0 x_1 avg_0 avg_1 sdev_0 sdev_1
# 1: bin redhead 20000 10000 2000 2500 NA NA NA NA
# 2: cont age 20000 10000 NA NA 52 62 17 16
I am supposed to answer the question What are the variables with the biggest differences between these populations? where biggest is not at all well-defined.
I have pointed out that this definition and the criteria for comparison between the count and continuous variables are not clear, and got the response, Come up with something. Thus I've attempted the following:
Standardized Mean Difference: For the count variables, I create $\bar{X}$ and $S$ by treating each observation as a Bernoulli outcome.
# p = x / n
d[var_type=='bin', `:=`(avg_0 = x_0/n_0, avg_1 = x_1/n_1)]
# s = sqrt(p*(1-p))
d[var_type=='bin', `:=`(sdev_0 = sqrt( avg_0 * (1-avg_0) ),
sdev_1 = sqrt( avg_1 * (1-avg_1) ) )]
# assuming equal population variances
d[, sdev_pool := sqrt( ( (n_0 - 1) * sdev_0 ^ 2 + (n_1 - 1) * sdev_1 ^ 2 ) /
(n_0 + n_1 - 2) ) ]
d[, smd := (avg_1 - avg_0) / sdev_pool][]
# var_type var_name ... avg_0 avg_1 sdev_0 sdev_1 sdev_pool smd
# 1: bin redhead ... 0.1 0.25 0.3 0.4330127 0.3499985 0.4285733
# 2: cont age ... 52.0 62.00 17.0 16.0000000 16.6733430 0.5997597
NHST: At the risk of being ostracized from CV... yes, I did this. Since the $\chi^2$ test with df=1 is equivalent to the $z$-test, I can use the same test for both variable types. The results are not blindingly illuminating.
# use pooled std err
d[, z := (avg_1 - avg_0) / (sdev_pool * sqrt(1/n_0 + 1/n_1) )]
# 2-tailed test
d[, p_val := 2*pnorm(-abs(z))][]
# var_type var_name n_0 n_1 ... avg_0 avg_1 ... sdev_pool ... z p_val
# 1: bin redhead 20000 10000 ... 0.1 0.25 ... 0.3499985 ... 34.99287 2.888512e-268
# 2: cont age 20000 10000 ... 52.0 62.00 ... 16.6733430 ... 48.97018 0.000000e+00
Using this approach, one concludes that the difference in age is slightly more significant (clinically or statistically) than the difference in redheads. Although I feel like the latter is a "bigger" effect size, I can't quantify it because I can't make an equivalent of an odds ratio (or arcsine transform, or logit, etc...) for the continuous outcome.
Discretization: I haven't tried this yet, but I guess I could discretize the continuous variables and compare counts in each "bin" between groups. In other words, compare the counts of 55- to 65-year-olds, etc. That is probably what I will wind up doing in the absence of better ideas.
My question (finally!) is for insights to help define bigness of difference and approaches to systematically compare differences across these variable types.