2
$\begingroup$

I just have a question about how to get the main effect in the presence of interaction effect.

I have two cohort: say cohort A and cohort B . For cohort A, I have this code as 1. Zero for cohort B. So the cohort variable is 0 for cohort B, and equal 1 for cohort A.

I have an interaction term (also binary), say gender (sex). So sex=1 for Male and sex=0 for Female.

My model is : Probability of smoking = beta0 + cohortbeta1 + sexbeta2 + cohortsexbeta3

I know that I cannot just take the coffecient of cohort (i.e. beta1) from say SAS to be the effect of "being in Cohort A vs cohort B" in modelling the probability of smoking.

For example if beta1 = 0.5, I know that I CANNOT just take exp(0.5) = 1.65 to say "Oh being in cohort A is 1.65 times more likely to smoke than cohort B".

I know we need to take into consideration of being Male or Female at the same time.

So my question is:

from this interaction model (i.e. with the 4 betas there including the intercept term), is there anyway I can get or calculate the cohort effect? (say being in cohort A is XX times more likely to smoke than being in cohort B)

or there is simply no way of calculating the cohort effect WITHOUT considering the sex effect at the same time? (I mean the conclusion from this model has to be like this: Being Female in Cohort A is XX times more likely to smoke than being female in Cohort B)

What I am asking is: in this model, there is no way to make any interpretation of the cohort effect without ACCOUNTING for the sex effect? is that true? like we always have to include "Being female", "Being Male" (i.e. the sex variable levels) at the same time ???

If there is a way of just saying "Being in Cohort A is XX times more likely to smoke than being in Cohort B without worrying about which sex the person is in", could you let me know how? and specifically which software do you think can give me that value? I am using SAS, but I cannot figure out how to isolate the cohort effect without considering the SEX effect. Also the cohort*sex effect is significant.

thank you very much

$\endgroup$
2
$\begingroup$

I understand you are trying to infer the effects of Cohort on smoking but are not as interested in the effects of sex on smoking. Thus you are using sex as a controlled variable. Furthermore, while the main effect of sex is not significant, the interaction of sex$\times$Cohort is. A similar question, about the interpretation of coefficients in a logistic regression with and without interaction was asked here Interpreting interaction terms in logit regression with categorical variables.

Suppose you collected data from 80 individuals, 20 for each cell (combination of factors) of which: 10% of males in Cohort A and 80% in Cohort B smoked, 30% of females in Cohort A and 60% of females in Cohort B smoked. The odds of smoking for each group are plotted below:

Odds of smoking by Cohort and sex

Assuming that the variable Cohort = 0 for Cohort A and 1 for Cohort B, the model, with Cohort only, is as follows

$\text{Logit($Pr$(Smoking | Cohort))}= \beta_0 + \beta_1 \text{Cohort}$

The parameters calculated on the sample data and their interpretation are as follows

$\exp(\beta_0) = 0.25$ there is 1 smoker to every 4 nonsmokers in the A Cohort

$\exp(\beta_1) = 9.33, p < 0.05$ the odds of smoking increase 9-fold if you are in the Cohort B rather than A, and this difference in odds between the two Cohorts is statistically significant

While this model is O.K. for descriptive purposes, it does not control for the fact that men can be more prone to smoking overall than woman. If this is true the differences in smoking behavior between Cohorts could be attributed to the difference in the number of males vs. females in Cohort A and B. To rule out this possibility we want to control for the effect of sex on smoking. Assuming that we code men = 0 and women = 1, the model with sex, but still without the interaction is as follows:

$\text{Logit($Pr$(Smoking | Cohort,sex))}= \beta_0 + \beta_1 \text{Cohort}+\beta_2\text{sex}$

The parameters calculated on the sample data and their interpretation are as follows

$\exp(\beta_0) = 0.25$ there is 1 male smoker to every 4 male nonsmokers in the A Cohort

$\exp(\beta_1) = 9.33, p < 0.05$ the odds of smoking increase 9-fold if you are in the Cohort B rather than A, and this difference in odds between the two Cohorts is statistically significant, and irrespective of sex.

$\exp(\beta_2) = 0, p>0.1$ females do not have lower odds of smoking than males.

While we controlled for the fact that the effect of Cohort on smoking is not due to different numbers of males and females in the Cohorts, the effect of Cohort on smoking can be different for males and for females. The final model is thus:

$\text{Logit($Pr$(Smoking | Cohort,sex))}= \beta_0 + \beta_1 \text{Cohort}+\beta_2\text{sex}+ \beta_3\text{Cohort}\times\text{Sex}$

The parameters calculated on the sample data and their interpretation are as follows

$\exp(\beta_0) = 0.11$ there approx. 1 male smoker to every 9 male nonsmokers in the A Cohort

$\exp(\beta_1) = 36.00, p < 0.05$ the odds of smoking increase 35-fold for males if you are in the Cohort B rather than A, but this difference in odds between the two Cohorts is statistically significant.

$\exp(\beta_2) = 3.86, p>0.1$ females have approx. 4 times higher odds of smoking than males in the A cohort.

$\exp(\beta_2) = 0.10, p<0.5$ females have an approx. The difference in the effect of Cohort on the odds of smoking is 10 times smaller for women than for men, and this difference in the effect of cohort is statistically significant.

Since you want to infer about the effect of Cohort on smoking, but the effects differ across sex, you should than probably follow this with analyzing the simple effects of smoking for the two genders separately (with the appropriate correction for multiple testing). To see if there is an effect of Cohort in both males and females, but only their magnitude differs, or maybe the difference in Cohort is due only to one gender. For the above data i did this by using the Bonferonni correction and analyzing the effect of cohort in the male and female groups separately. To do this I applied the model with only cohort (the first model) and got:

$\beta_1 = 6.00, p > .1 $ for females,

$\beta_1 = 20.10, p = .03 $ for males.

so I conclude that there is a significant effect of cohort on smoking, but only for males. If I would have gotten both betas significant, than I would conclude that the effect of Cohort on the odds of smoking is significant for both males and females, but stronger for males.

$\endgroup$
  • $\begingroup$ Hi Chris, thanks for your response. But the sex*cohort interaction term is significant. What should I do? $\endgroup$ – john_w Feb 24 '15 at 21:09
  • $\begingroup$ If you're aim is purely descriptive, than using only Cohort is enough. If you want to make inferences about the effect of being in Cohort A or B on smoking, than you should probably include the effect of sex, to make sure that the main effect of Cohort is not spurious, and really related to unequal distribution of gender in the Cohorts. The interaction just suggests, that the effect of Cohort on smoking is different for man and women. $\endgroup$ – Chris Novak Feb 24 '15 at 21:42
  • $\begingroup$ So if in the interaction model, SAS gives me a p-value of 0.025 for the cohort effect , and also something less than 0.05 for sex*cohort parameter estimate, what does the 0.025 means for the parameter estimate of cohort effect in the interaction model? can you say there is a significant cohort effect on smoking becaues of the p-value of 0.025 in the interaction model? what if the p-value is 0.88 of the cohort effect in the interaction model? but the interaction term is significant? $\endgroup$ – john_w Feb 25 '15 at 18:10
  • $\begingroup$ I edited the answer to what I think is closer to what you were looking for. $\endgroup$ – Chris Novak Feb 26 '15 at 14:34
  • $\begingroup$ Hi Chris, sorry can you explain how you get the exp(beta0)=0.25? what is the numberator and what is the denominator of the number 0.25? is it 1/4= 0.25, or 2/8=0.25, or some other numbers? sorry could you elaborate little bit more. $\endgroup$ – john_w Feb 27 '15 at 1:35
2
$\begingroup$

In addition to the multiplicative marginal effect given by @ChrisNovak, you can also calculate the additive marginal effect. Using the same smoker data, first we get the exponentiated $\beta$s for comparison:

. logit smoker i.cohort##i.sex, or nolog;

Logistic regression                               Number of obs   =         80
                                                  LR chi2(3)      =      25.73
                                                  Prob > chi2     =     0.0000
Log likelihood = -42.187227                       Pseudo R2       =     0.2337

------------------------------------------------------------------------------
      smoker | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      cohort |
          B  |         36   33.54102     3.85   0.000      5.79752    223.5438
             |
         sex |
          F  |   3.857143   3.436216     1.52   0.130     .6729071    22.10937
             |
  cohort#sex |
        B#F  |   .0972222   .1114662    -2.03   0.042     .0102767    .9197636
             |
       _cons |   .1111111   .0828173    -2.95   0.003     .0257816    .4788568
------------------------------------------------------------------------------

You can calculate the average finite difference (i.e., the discrete analogue of the derivative) for cohort as if everyone was male and then as if everyone was female:

. margins sex, dydx(cohort);

Conditional marginal effects                      Number of obs   =         80
Model VCE    : OIM

Expression   : Pr(smoker), predict()
dy/dx w.r.t. : 2.cohort

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
2.cohort     |
         sex |
          M  |         .7   .1118034     6.26   0.000     .4808694    .9191306
          F  |         .3        .15     2.00   0.046     .0060054    .5939946
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

You want the difference between F and M, which is 0.3-0.7=-0.4.

In Stata, this can actually be done in one step (with SEs):

. margins r.sex, dydx(cohort);

Contrasts of conditional marginal effects
Model VCE    : OIM

Expression   : Pr(smoker), predict()
dy/dx w.r.t. : 2.cohort

------------------------------------------------
             |         df        chi2     P>chi2
-------------+----------------------------------
1b.cohort    |
         sex |  (omitted)
-------------+----------------------------------
2.cohort     |
         sex |          1        4.57     0.0325
------------------------------------------------

--------------------------------------------------------------
             |   Contrast Delta-method
             |      dy/dx   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
2.cohort     |
         sex |
   (F vs M)  |        -.4   .1870829     -.7666757   -.0333243
--------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the
      base level.

Here's the complete Stata Code for anyone interested:

#delimit;
clear;

/* Create Fake Data */
input
str1 cohort str1 sex smoker n;
"A"    "M" 0  18;
"A"    "F" 0  14;  
"B"    "M" 0  4;
"B"    "F" 0  8;
"A"    "M" 1  2;
"A"    "F" 1  6;  
"B"    "M" 1  16;
"B"    "F" 1  12;
end;

sencode cohort, replace;
sencode sex, replace;
expand n;
drop n;

/* Check the Odds */ 
table sex cohort, c(mean smoker);

logit smoker i.cohort##i.sex, or nolog;
margins sex, dydx(cohort);
margins r.sex, dydx(cohort);
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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