Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Interaction: ## versus * - OR are different

    Dear Statalist:
    I have some queations

    METHOD ONE: I created the following interaction variables using *. Where c1=no disease, c2=cancer c3=mental disease c4=other disease. Giving1= not caregiving, giving2=caregiving

    NO CAREGIVING AND DISEASES
    gen nocaregiving_nodisease= giving1*c1
    gen nocaregiving_cancer= giving1*c2
    gen nocaregiving_mental= giving1*c3
    gen nocaregiving_other= giving1*c4

    CAREGIVING AND DISEASES
    gen caregiving_nodisease= giving2*c1
    gen caregiving_cancer= giving2*c2
    gen caregiving_mental= giving2*c3
    gen caregiving_other= giving2*c4

    The dependant variable es k6cat which is binary

    Then proceed with the following command for logistic regression

    logit k6cat nocaregiving_cancer nocaregiving_mental nocaregiving_other caregiving_nodisease caregiving_cancer caregiving_mental caregiving_other caregiverdisease caregiving sex agecat2 agecat3 agecat4 e2 e3 job setaiexpbyninsu_cat, or nolog

    note: caregiverdisease omitted because of collinearity
    note: caregiving omitted because of collinearity

    Logistic regression Number of obs = 879,674
    LR chi2(15) = 25077.54
    Prob > chi2 = 0.0000
    Log likelihood = -512669.93 Pseudo R2 = 0.0239

    --------------------------------------------------------------------------------------
    k6cat | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]
    ---------------------+----------------------------------------------------------------
    nocaregiving_cancer | 2.166334 .0488408 34.29 0.000 2.072692 2.264206
    nocaregiving_mental | 5.87672 .0993783 104.73 0.000 5.685135 6.074762
    nocaregiving_other | 1.427238 .0075137 67.57 0.000 1.412587 1.442041
    caregiving_nodisease | 1.415696 .0518512 9.49 0.000 1.317631 1.521059
    caregiving_cancer | 3.454236 .6844809 6.26 0.000 2.342505 5.093585
    caregiving_mental | 8.505128 1.54574 11.78 0.000 5.95637 12.14451
    caregiving_other | 2.182677 .0617268 27.60 0.000 2.064987 2.307075
    caregiverdisease | 1 (omitted)
    caregiving | 1 (omitted)
    sex | 1.220351 .0060654 40.07 0.000 1.208521 1.232297
    agecat2 | .5647246 .003999 -80.69 0.000 .5569409 .5726171
    agecat3 | .6406081 .005502 -51.85 0.000 .6299146 .651483
    agecat4 | .8240018 .0098324 -16.22 0.000 .8049542 .8435001
    e2 | .9156378 .0056034 -14.40 0.000 .904721 .9266864
    e3 | .8764097 .0060818 -19.01 0.000 .8645704 .8884112
    job | 1.194357 .0071747 29.57 0.000 1.180377 1.208502
    setaiexpbyninsu_cat | .9502311 .0046335 -10.47 0.000 .9411928 .9593561
    _cons | .2517346 .0032518 -106.78 0.000 .2454411 .2581894


    METHOD 2: using ## with the "original variables". Where Caregiverdisease; 0= no disease, 1=cancer, 2=mental disease, 3=other disease. Caregiving; 0= not caregiving, 1=caregiving

    logistic k6cat i.caregiverdisease##i.caregiving sex agecat2 agecat3 agecat4 e2 e3 job setaiexpbyninsu_cat, allbaselevels

    Logistic regression Number of obs = 879,674
    LR chi2(15) = 25077.54
    Prob > chi2 = 0.0000
    Log likelihood = -512669.93 Pseudo R2 = 0.0239

    ---------------------------------------------------------------------------------------------
    k6cat | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]
    ----------------------------+----------------------------------------------------------------
    caregiverdisease |
    0 | 1 (base)
    1 | 2.166334 .0488408 34.29 0.000 2.072692 2.264206
    2 | 5.87672 .0993783 104.73 0.000 5.685135 6.074762
    3 | 1.427238 .0075137 67.57 0.000 1.412587 1.442041
    |
    caregiving |
    0 | 1 (base)
    1 | 1.415696 .0518512 9.49 0.000 1.317631 1.521059
    |
    caregiverdisease#caregiving |
    0 0 | 1 (base)
    0 1 | 1 (base)
    1 0 | 1 (base)
    1 1 | 1.126307 .2282772 0.59 0.557 .7570724 1.675623
    2 0 | 1 (base)
    2 1 | 1.022294 .1902165 0.12 0.906 .7098954 1.472169
    3 0 | 1 (base)
    3 1 | 1.080247 .0498851 1.67 0.095 .9867683 1.182582
    |
    sex | 1.220351 .0060654 40.07 0.000 1.208521 1.232297
    agecat2 | .5647246 .003999 -80.69 0.000 .5569409 .5726171
    agecat3 | .6406081 .005502 -51.85 0.000 .6299146 .651483
    agecat4 | .8240018 .0098324 -16.22 0.000 .8049542 .8435001
    e2 | .9156378 .0056034 -14.40 0.000 .904721 .9266864
    e3 | .8764097 .0060818 -19.01 0.000 .8645704 .8884112
    job | 1.194357 .0071747 29.57 0.000 1.180377 1.208502
    setaiexpbyninsu_cat | .9502311 .0046335 -10.47 0.000 .9411928 .9593561
    _cons | .2517346 .0032518 -106.78 0.000 .2454411 .2581894

    ***************************
    As you can see the OR values in the first method nocaregiving_cancer, nocaregiving_mental, nocaregiving_other, caregiving_nodisease, are the same with 1,2, 3 from caregiverdisease and 1 in caregiving. The other OR values from the first method caregiving_cancer, caregiving_mental, caregiving_other; and second method: caregiverdisease#caregiving 11 2 1 31 are different.

    Is there any explanation for these differences in OR? I think these should be equal.

    Thank you for your attention,

  • #2
    Hi Lisset
    The reason why the coefficients are different is because both methods are "omitting" different variables during the regression.
    In your fist example, Stata is producing all interactions, skipping the base values. In the second, it produces coefficients for base values skipping some of the interactions.
    HTH

    Comment


    • #3
      Fernando. Thank you for your answer. I understand.
      I was trying to replicate the same with a different dataset and the values in the first and second examples were very similar. That is why I was trigerred.

      Regards

      Comment

      Working...
      X