Show that
\[ \frac{\partial PR[resp_i=1]}{\partial age_i}+\frac{\partial Pr[resp_i=0]}{\partial age_i}=0 \]
\[ \begin{aligned} \frac{\partial PR[resp_i=1]}{\partial age_i}+\frac{\partial Pr[resp_i=0]}{\partial age_i} &= \frac{\partial PR[resp_i=1]}{\partial age_i}+\frac{1- \partial Pr[resp_i=1]}{\partial age_i} \\ &= \frac{\partial PR[resp_i=1]}{\partial age_i}- \frac{\partial Pr[resp_i=1]}{\partial age_i} \\ &= 0 \end{aligned} \]
Assume that you recode the dependent variable as follows: \(resp^{new}_i=-resp_i+1\). Hence, positive response is now defined to be equal to zero and negative response to be equal to 1. Use the odds ratio to show that this transformation implies that the sign of all parameters change.
As we conclude in training exercise, the coeficcients are equal when the dependent variable is \(resp_i\) o \(resp^{new}_i\). This means,
\[ \begin{aligned} \frac{Pr[resp^{new}_i=0]}{Pr[resp^{new}_i=1]} &=\frac{Pr[resp_i=1]}{Pr[resp_i=0]} \end{aligned} \]
Using this result, we can see that the odds ratios are the reciprocal from the original model, thus:
\[ \begin{aligned} \frac{Pr[resp_i=1]}{Pr[resp_i=0]} &= \frac{1}{exp\left(\beta_0+\sum_{j=2}^{k} \beta_j x_{ji} \right)} \end{aligned} \]
Finally, using the property \((e^{t})^{-1}=e^{-t}\)
\[ \begin{aligned} \frac{Pr[resp^{new}_i=0]}{Pr[resp^{new}_i=1]} &= exp\left(-\beta_0-\sum_{j=2}^{k} \beta_j x_{ji} \right) \end{aligned} \] This proofe that the transformation of the dependent variable change the sign of all coefficients.
Consider again the odds ratio positive response versus negative response:
\[ \frac{Pr[resp_i=1]}{Pr[resp_i=0]}=exp(\beta_0+\beta_1 male_i+\beta_2 active_i +\beta_3 age_i + \beta_4 (age_i/10)^2) \]
During lecture 5.5 you have seen that this odds ratio obtains its maximum value for age equal to 50 years for males as well as females. Suppose now that you want to extend the logit model and allow that this age value is possibly different for males than for females. Discuss how you can extend the logit specification
We could extender the logit specification adding the interaction of variables male and age like this \(male_i\times age_i\) and \(male_i \times (age/10^2)\). The results of this model are show above:
model <- glm(response~male+activity+age+I((age/10)^2)+I(male*age)+I(male*(age/10)^2),
data=Data55, family = "binomial")
stargazer(model, type="html", title="Results", header = FALSE)
| Dependent variable: | |
| response | |
| male | -2.142 |
| (1.828) | |
| activity | 0.939*** |
| (0.186) | |
| age | -0.017 |
| (0.058) | |
| I((age/10)2) | 0.016 |
| (0.054) | |
| I(male * age) | 0.133* |
| (0.073) | |
| I(male * (age/10)2) | -0.132* |
| (0.069) | |
| Constant | -0.477 |
| (1.458) | |
| Observations | 925 |
| Log Likelihood | -600.041 |
| Akaike Inf. Crit. | 1,214.082 |
| Note: | p<0.1; p<0.05; p<0.01 |
The odds ratios of this models would be:
\[ \frac{Pr[esp_i=1]}{Pr[esp_i=0]}=exp(\beta_0+\beta_1male_i+\beta_2active_i+\beta_3age_i+\beta_4(age_i/10)^2)+\beta_5male_i age_i +\beta_6 male_i (age_i/10)^2 \]