# Why does a two-sample proportion test with outcome Y and predictor X give the same result as one with outcome X and predictor Y?

I just noticed, while playing around in Stata, that this is the case, at least with three pairs of variables I tried out, which makes me think there must be some real relation there -- the z-statistic when I test is the same every time. For example, a proportion test to see if there's a statistically-significant difference in the proportion of homeownership between Black and white individuals gives the same result as a test to see if the proportion of white individuals is different between homeowners and non-homeowners.

I tried messing around to see if I could get the two formulae to end up being the same, but the formula for just one of the tests has quite a few moving parts, and the arithmetic was getting pretty complicated. In the past, I've mistakenly wasted time trying to prove this sort of thing (lots of tedious arithmetic, and high potential for time-wasting if you don't go about it the right way). I didn't know if there was a simpler method. I've never seen anyone mention this before, and I couldn't think of a way to Google it that would give anything but very general discussions, but I thought it was quite interesting.