Question: How to weight a sample to remove bias that is seen on many variables?
Background: I've got two samples which are not random. For every individual I've got three categorical characteristics (A, B, C) and one continuous (X). I want to test whether the difference in average X in both samples is statistically significant. Those samples differ in characteristics A, B, C which are known to have influence on X. My idea is to give some weight to every individual in such a way that weighted distribution of characteristics A, B, C in both samples are the same and then compared weighted average. The question is how to calculate the weights? I could define a loss function that tells how different the characteristics in samples are and use some optimisation method to minimize this loss function (maybe stochastic gradient descent).