Hi all,
I am attempting to study the gender gap in the life-course evolution of political interest using growth curve modelling (Stata 16.0). The problem is that I cannot reconcile the results of the regression (melogit) and the marginals (margins). In detail, the coefficient of sex##age is an odds ratio > 1, which suggests a steeper growth over time for women, whilst the marginals (margins) show that men have a steeper growth. I suspect this has to do with the fact that sex##age is computed at specific values of other control variables. Any ideas to explain this apparent contradiction? Thank you, Nic

Code:
melogit interest i.sex##c.age c.isced_parents##i.sex##c.age c.gender_attitudes##i.sex##c.age ib3.casmin##i.sex##c.age i.year_1  || pidp: age, diff or cov(unstr)
Third row: sex#c.age has a 1.18 odds ratio, implying women having a steeper growth.

melogit results
Code:
                     interest | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------------------------------+----------------------------------------------------------------
                                  sex |
                              Female  |   .0797479   .1236744    -1.63   0.103     .0038165    1.666392
                                  age |   .9183841   .1291689    -0.61   0.545     .6971152    1.209885
                                      |
                            sex#c.age |
                              Female  |    1.17762   .2371548     0.81   0.417     .7935718    1.747529
                                      |
                        isced_parents |    1.10222   .0494202     2.17   0.030     1.009493    1.203466
                                      |
                  sex#c.isced_parents |
                              Female  |   1.169129    .074481     2.45   0.014     1.031895    1.324614
                                      |
                c.isced_parents#c.age |   1.006333   .0058582     1.08   0.278      .994916     1.01788
                                      |
            sex#c.isced_parents#c.age |
                              Female  |   .9871253   .0081886    -1.56   0.118     .9712057    1.003306
                                      |
                     gender_attitudes |   .7252891   .1985224    -1.17   0.241      .424155    1.240217
                                      |
               sex#c.gender_attitudes |
                              Female  |   .7648504   .2973847    -0.69   0.491     .3569582    1.638837
                                      |
             c.gender_attitudes#c.age |   1.031944   .0343485     0.94   0.345     .9667716    1.101511
                                      |
         sex#c.gender_attitudes#c.age |
                              Female  |   .9962939   .0485382    -0.08   0.939     .9055616    1.096117
                                      |
                               casmin |
                   Less than level 2  |   .0421242   .0207223    -6.44   0.000     .0160619    .1104753
                             Level 2  |   .1315831    .046803    -5.70   0.000     .0655292    .2642196
                Level 3 (vocational)  |   .4611131   .2711349    -1.32   0.188     .1456465    1.459872
       Higher education (vocational)  |   .2908482    .174043    -2.06   0.039     .0900138    .9397745
          Higher education (general)  |   .7632587   .3877851    -0.53   0.595      .281972    2.066034
                    Studying level 2  |   .7163233   .2019592    -1.18   0.237     .4122138    1.244789
                                      |
                           casmin#sex |
            Less than level 2#Female  |   7.644757   5.476532     2.84   0.005     1.877509    31.12757
                      Level 2#Female  |   3.890349   1.922813     2.75   0.006      1.47666    10.24936
         Level 3 (vocational)#Female  |   5.605182   4.573374     2.11   0.035     1.132605    27.73966
Higher education (vocational)#Female  |   4.526671   3.648537     1.87   0.061     .9326163    21.97126
   Higher education (general)#Female  |   1.093604   .7399108     0.13   0.895     .2903715    4.118757
             Studying level 2#Female  |    .903155   .3519893    -0.26   0.794      .420747    1.938669
                                      |
                         casmin#c.age |
                   Less than level 2  |   1.077859   .0765448     1.06   0.291     .9378067    1.238827
                             Level 2  |   1.133095   .0662414     2.14   0.033     1.010426    1.270656
                Level 3 (vocational)  |   1.041306   .0986981     0.43   0.669     .8647666    1.253885
       Higher education (vocational)  |   1.021982   .0774086     0.29   0.774     .8809886     1.18554
          Higher education (general)  |   1.087357   .0731461     1.24   0.213     .9530424    1.240601
                    Studying level 2  |      1.287    .343928     0.94   0.345     .7622719    2.172937
                                      |
                     casmin#sex#c.age |
            Less than level 2#Female  |   .8207434    .085831    -1.89   0.059     .6686382     1.00745
                      Level 2#Female  |   .7887889   .0659503    -2.84   0.005     .6695641    .9292432
         Level 3 (vocational)#Female  |   .7503382   .1027247    -2.10   0.036     .5737513    .9812743
Higher education (vocational)#Female  |   .8901057   .0908325    -1.14   0.254     .7287509    1.087186
   Higher education (general)#Female  |   .9380943   .0843286    -0.71   0.477     .7865548     1.11883
             Studying level 2#Female  |   1.175099   .4388004     0.43   0.666     .5652268    2.443017
                                      |
                               year_1 |
                                1995  |   .9087041   .2070425    -0.42   0.674     .5814087    1.420245
                                1998  |   1.209628   .2963029     0.78   0.437     .7484225    1.955046
                                2001  |   .9578809    .252838    -0.16   0.870     .5709948    1.606908
                                2004  |   1.029336   .2907509     0.10   0.918     .5917289     1.79057
                                2007  |   .7295872   .2233028    -1.03   0.303     .4004537    1.329236
                                2010  |   1.015031   .3713182     0.04   0.967     .4955568    2.079053
                                2013  |   .8386817   .3510156    -0.42   0.674     .3692679    1.904815
                                2016  |   .9891315   .5252397    -0.02   0.984     .3493467    2.800602
                                2019  |   1.528287   1.167477     0.56   0.579     .3419492    6.830434
                                      |
                                _cons |    .388696    .433558    -0.85   0.397     .0436682    3.459828
--------------------------------------+----------------------------------------------------------------
pidp                                  |
                              var(age)|   .0437968   .0064901                      .0327571    .0585571
                            var(_cons)|   8.008383   .7122384                      6.727316      9.5334
--------------------------------------+----------------------------------------------------------------
pidp                                  |
                        cov(age,_cons)|  -.1669749   .0457278    -3.65   0.000    -.2565997   -.0773501
-------------------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.
Note: _cons estimates baseline odds (conditional on zero random effects).
LR test vs. logistic model: chi2(3) = 3362.19             Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.
The marginals, instead, show that man have a steeper growth (age is centred (age-16) so that 0=16).
Code:
 margins sex, at(age=(0(1)14))

Code:
Predictive margins    Number    of    obs     =    12,159
Model VCE    : OIM

Expression   : Marginal predicted mean,    predict()

1._at        : age             =    0

2._at        : age             =    1

3._at        : age             =    2

4._at        : age             =    3

5._at        : age             =    4

6._at        : age             =    5

7._at        : age             =    6

8._at        : age             =    7

9._at        : age             =    8

10._at       : age             =    9

11._at       : age             =    10

12._at       : age             =    11

13._at       : age             =    12

14._at       : age             =    13

15._at       : age             =    14

                
Delta-method
Margin   Std. Err.    z    P>z        [95% Conf.    Interval]
                
_at#sex 
1#Male     .2834477   .0173198    16.37   0.000        .2495015    .3173939
1#Female     .2224946   .0145547    15.29   0.000        .1939679    .2510212
2#Male     .2983585   .0161681    18.45   0.000        .2666696    .3300474
2#Female     .2256212   .0132417    17.04   0.000        .199668    .2515744
3#Male     .3147989   .0157898    19.94   0.000        .2838516    .3457463
3#Female     .2300119   .0126628    18.16   0.000        .2051932    .2548305
4#Male     .3327152   .0163698    20.32   0.000        .300631    .3647994
4#Female     .2357405    .013263    17.77   0.000        .2097455    .2617354
5#Male     .3518121   .0176267    19.96   0.000        .3172644    .3863598
5#Female     .2428226   .0150916    16.09   0.000        .2132437    .2724016
6#Male     .3716529   .0191098    19.45   0.000        .3341983    .4091075
6#Female      .251041   .0174754    14.37   0.000        .2167899    .2852922
7#Male     .3918779   .0206967    18.93   0.000        .3513131    .4324426
7#Female     .2600038   .0196706    13.22   0.000        .2214501    .2985575
8#Male     .4122473    .022445    18.37   0.000        .3682559    .4562387
8#Female     .2693942   .0214995    12.53   0.000        .2272559    .3115325
9#Male     .4325343   .0242777    17.82   0.000        .3849508    .4801178
9#Female     .2790412   .0230641    12.10   0.000        .2338364    .324246
10#Male     .4524836    .026015    17.39   0.000        .4014951    .5034721
10#Female      .288811   .0243535    11.86   0.000        .2410789    .336543
11#Male     .4718567   .0275408    17.13   0.000        .4178777    .5258358
11#Female      .298551   .0252958    11.80   0.000        .2489722    .3481299
12#Male     .4904753   .0288469    17.00   0.000        .4339363    .5470143
12#Female     .3081192   .0259088    11.89   0.000        .2573389    .3588995
13#Male     .5082308   .0299683    16.96   0.000        .449494    .5669676
13#Female     .3174089   .0262743    12.08   0.000        .2659122    .3689056
14#Male     .5250719    .030921    16.98   0.000        .4644678    .585676
14#Female     .3263432   .0264707    12.33   0.000        .2744617    .3782248
15#Male     .5409722   .0316926    17.07   0.000        .4788559    .6030885
15#Female     .3348735   .0265998    12.59   0.000        .2827388    .3870082





Dataset

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float interest double sex byte age float(isced_parents gender_attitudes casmin year_1)
. 2  0 15 3.0714285 7 1998
. 2  1 15 3.0714285 7 1998
. 2  2 15 3.0714285 3 1998
. 2  3 15 3.0714285 3 2001
0 2  4 15 3.0714285 3 2001
. 2  5 15 3.0714285 3 2001
0 2  6 15 3.0714285 . 2004
. 2  7 15 3.0714285 . 2004
0 2  8 15 3.0714285 . 2004
. 2  9 15 3.0714285 . 2007
. 2 10 15 3.0714285 . 2007
. 2 11 15 3.0714285 . 2007
. 2 12 15 3.0714285 . 2010
. 2 13 15 3.0714285 . 2010
. 2 14 15 3.0714285 . 2010
. 2  0 15 3.7142856 7 2001
0 2  1 15 3.7142856 7 2001
0 2  2 15 3.7142856 3 2001
0 2  3 15 3.7142856 3 2004
. 2  4 15 3.7142856 3 2004
end
label values sex bm_sex
label def bm_sex 2 "Female", modify
label values isced_parents isced_parents
label values casmin casmin
label def casmin 3 "Level 3 (general)", modify
label def casmin 7 "Studying level 2", modify