2
$\begingroup$

Lets say that i have linear regression $Y= a +XB$, and in my $X$ matrix i have a dummy for the gender, lets call it $d_{g}$ which is 1 for male and 0 for female. The coefficient $b$ of $d_{g}$ shows the effect of being male relative to the effect for being female. How can i get the effect of being female ? Or the effect of being male, but not relative to the female.

$\endgroup$
1
  • $\begingroup$ Could you elaborate on "the effect of being male, but not relative to the female"? Relative to what then? $\endgroup$
    – Scortchi
    Commented Jun 7, 2017 at 8:47

2 Answers 2

6
$\begingroup$

You can reconstruct what you want from your fit using the population fractions of male and female $f_M$ and $f_F = 1 - f_M$.

The expectation of $Y$ for males and females is given by: $$ E[Y|M] = a + b \qquad E[Y|F] = a$$ so $$ E[Y|M] - E[Y|F] = b$$ $b$ gives the expected change in $Y$ going from female to male, as you said in your post.

Given the male and female population fractions we can construct the unconditional expectation: $$E[Y] = f_F E[Y|F] + f_M E[Y|M] = (1-f_M) a + f_M (a + b) = a + f_M b$$ and from that, we can get the expected change in $Y$ going from sex-unknown to male: $$E[Y|M] - E[Y] = (1 - f_M) b$$ and, similarly, the expected change in $Y$ going from sex-unknown to female: $$E[Y|F] - E[Y] = - f_M b$$ You should get the same results with this method as from the procedure suggested by Michael above, without having to re-run the regression.

$\endgroup$
8
  • $\begingroup$ +1, this is the better solution once the regression is already done. $\endgroup$
    – Michael L.
    Commented Jun 7, 2017 at 8:33
  • $\begingroup$ (+1) Wonder if that's the desired interpretation of "the effect of being male, but not relative to the female". (I can't think of another that makes any sense) $\endgroup$
    – Scortchi
    Commented Jun 7, 2017 at 8:45
  • $\begingroup$ Thank you. @Scortchi I am sorry if it was not clear enough. $\endgroup$
    – quant
    Commented Jun 7, 2017 at 8:58
  • 1
    $\begingroup$ @quant: You can extend it, but the algebra gets pretty harry. Suppose your model is $Y = a + b u + c v$, where $u = \{0, 1\}$ and $v = \{0, 1\}$ are your dummy variables for female/male and poor/rich, respectively. You can write fully conditional expectations $E[Y|0 0] = a, E[Y|1 0] = a+b, E[Y|0 1] = a+c, E[Y|1 1] = a + b + c$. Given the population fractions of each subgroup $p_{0 0}, p_{1 0}, p_{0 1}, p_{1 1}$, you can compute semi-conditional probabilities like $E[Y|1 .] = (p_{1 0} E[Y|1 0] + p_{1 1} E[Y| 1 1])/(p_{1 0} + p_{1 1}) = a + b + \frac{p_{1 1}}{p_{1 0} + p_{1 1}} c$ $\endgroup$ Commented Jun 8, 2017 at 17:21
  • 1
    $\begingroup$ and unconditional probabilities like $E[Y|. .] = a + (p_{1 0} + p_{1 1}) b + (p_{0 1} + p_{1 1}) c$, and then take difference to get expected changes such as $E[Y|1 .] - E[Y|. .] = (p_{0 0} + p_{0 1}) b + \left[ \frac{p_{1 1}}{p_{1 0} + p_{1 1}} - (p_{0 1} + p_{1 1}) \right] c$. There may be some way to convert this to more compact matrix expressions; I don't know. If you are willing to re-do the regression, it would also be straightforward to fall back to Michael's suggested procedure. $\endgroup$ Commented Jun 8, 2017 at 17:27
2
$\begingroup$

This can simply be achieved by leaving out the constant (other wise you run in the so called dummy-trap) and using a model like $$Y=d_{female} + d_{male} + X\beta + u, $$ where $d_{female}$ is one if female and $d_{male}$ is one if male. Then you will have $$E[Y|X,male]=d_{male} + E[X]\beta,$$ $$E[Y|X,female]=d_{female} + E[X]\beta$$

and $E[Y|X,male]-E[Y|X,female]=d_{male} -d_{female}$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.