Announcement

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

  • Margins: combined and separate variables generate different results?

    Dear Statalist Member

    I am estimating the expected probability of not having good health, using the command -margins, according to the socioeconomic position in each state of Brazil divided between capital and interior. I created a variable matching the state and whether the person is in the capital or the interior. The goal was to add more cases in each category.
    Let's call this categorical variable of statecapital. As an example, for Rio de Janeiro, code 33, a category 331 was created for Rio de Janeiro Capital and 330 for Rio de Janeiro interior; and so for all 26 Brazilian States. The socioeconomic position of the person is measured by a binary variable, coded 1 for top and 0 for non-top jobs.
    The sample is complex and I have used the svy command.
    As an example, the syntax looks like this:

    svy: logit notgoodhealth i.statecapital i.top \\ covariates
    [state variable was combined with the binary variable capital]
    margins statecapital#top

    However, I realized that by doing the estimation with the separated variables, using the margins, the results diverge. There are no differences between the estimates in the number of cases, covariates and conditioners.

    The syntax in this case was:

    svy: logit notgoodhealth i.state i.capital i.top \\ covariates
    [state and capital are used as separated variables]

    margins state#capital#top

    The difference may be ponderable. The probability of someone at the top in the capital of a state changes from 0.109 to 0.128 between the two estimates. Without using the svy command and the sample weights the difference persists. In this case the difference changes from 0.116 to 0.122. It seems to have no relation to the sample weights.

    Why does the command -margins produce these differences?
    What would be the most appropriate way of estimating?

    Thanks in advance.

    Prof. José Alcides F. Santos

  • #2
    You have to think about what your variables and your models mean. If you throw them together in arbitrary ways, the results will not be useful.

    Your variable statecapital has been calculated in such a way that, for example Bahia Capital and Bahia interior as as unrelated to each other, and as potentially different from each other, as Bahia Capital and Golas interior. The statecapital variable in noway encodes the separate effects of states, nor, for that matter of the capital/interior distinction. By contrast, when you use state and capital separately, you are separately estimating an effect for each state and an effect for capital vs interior, and you are postulating that those effects are directly additive (in the log-odds metric).

    I have no idea which of these approaches is appropriate for your situation. But that is why they are different.

    Comment


    • #3
      Dear Clyde

      Thanks for the analytically perfect comment as always.
      As each state forms a certain socio-economic unit, in which there is an internal dynamics that hierarchize capital and interior within it, it seems to me that it makes much less sense to treat the capital and interior of a State “as unrelated to each other, and as potentially different from each other”, like any other interior of another State.
      My research is interested in jobs or social classes, states and their divisions between interior and capital, as differentiated socioeconomic factors that impact on health.
      The combined variable "statecapital" seems an artificial option.

      Comment


      • #4
        I assume the two logit commands are producing somewhat different results. So, the margins commands will produce different results too.

        In other words, I think the first logit command basically lets state and capital interact, and the 2nd doesn't.

        If I'm wrong you might post the full output from your logit and margins commands.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        StataNow Version: 19.5 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://academicweb.nd.edu/~rwilliam/

        Comment


        • #5
          Dear Richard Williams

          I am grateful for your comment and the alert.
          It had come to my mind that a variable formed from the combination of two other variables could capture a kind of combined or interactive effect. I would ask the following question: What happens in the model with a variable that combines two others?
          1) Does it break the dependency that exists between interior and capital of the same State for being transformed into distinct categories? After all, the effects of the two categories are being estimated as independent. They are being treated this way in the equation. This is what I got from Clyde Schechter's comment.
          2) On the other hand, since it is formed only of cases of that state, does it maintain this dependence, bust also capturing a combined effect, that is, a difference due to the joint and exclusive presence of the two attributes?

          Comment


          • #6
            Again, it would help to see the output. But if I'm visualizing this right, if you added

            i.state#i.capital

            to the 2nd model, then models 1 and 2 would be identical, albeit parameterized differently. If you try this and I am obviously wrong, then let us know.

            So, if I am right, you interpret this like you do any other interaction term. The effect of a state depends on whether it is the capital or isn't the capital. Or, if you prefer, the effect of being in the capital city depends on which state you are in, e.g. being in the capital might lead to higher SES in some states but lower SES in others.

            Personally, I don't like to combine variables like you are doing. It potentially confounds the effects of states with the effects of capitals. I would keep the terms separate and then add interaction terms if necessary.

            Incidentally, your command

            margins state#capital#top

            doesn't magically add an iteraction that wasn't in the original model. Using the main terms that were in it, it just computes the predicted values of the different combos of values.
            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            StataNow Version: 19.5 MP (2 processor)

            EMAIL: [email protected]
            WWW: https://academicweb.nd.edu/~rwilliam/

            Comment


            • #7
              Here is a simple example of what I have in mind. Suppose race hs 3 categories and sex has 2 categories. Then a combo racesex will have 6 categories and i.racesex will produce 5 dummies.

              Now, suppose you instead do i.race (2 dummies), i.sex (1 dummy) and i.sex#i.race (2 interactions). Again, 5 terms.

              Whicher coding you choose, you will fit the same model, albeit parameterized differently.

              But, suppose race has a big effect, and sex has no effect. Or, race and sex both have effects but no interaction. The 2nd coding lets you detect this. But the combo coding mushes these all together -- you may know something about race and sex matters but you don't know if it is just race or just sex or both or whatever.

              So, if you want to better understand what the effects of variables are, you should avoid the combo coding which mushes everything together.
              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              StataNow Version: 19.5 MP (2 processor)

              EMAIL: [email protected]
              WWW: https://academicweb.nd.edu/~rwilliam/

              Comment


              • #8
                Here is an emprical example. The two models are equivalent. But the first model mushes race and highlead together. You can tell they have some effect on health, but (to me at least) it is hard to say exactly what it is. The second model estimates separate effects for race, highlead, and their interaction. It seems to make it clear that race by itself is what is really important and highlead has little effect.

                Code:
                . webuse nhanes2f, clear
                
                . svy: ologit health i.race#i.highlead
                (running ologit on estimation sample)
                
                Survey: Ordered logistic regression
                
                Number of strata   =        31                 Number of obs     =       4,940
                Number of PSUs     =        62                 Population size   =  56,316,764
                                                               Design df         =          31
                                                               F(   5,     27)   =       15.78
                                                               Prob > F          =      0.0000
                
                ---------------------------------------------------------------------------------
                                |             Linearized
                         health |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                ----------------+----------------------------------------------------------------
                  race#highlead |
                White#lead>=25  |  -.1423945   .1536119    -0.93   0.361     -.455688    .1708989
                 Black#lead<25  |   -.856371   .1157361    -7.40   0.000    -1.092416   -.6203257
                Black#lead>=25  |  -.9081019    .252315    -3.60   0.001    -1.422702    -.393502
                 Other#lead<25  |  -.3870694   .1629638    -2.38   0.024    -.7194362   -.0547025
                Other#lead>=25  |  -.4982479   .1548756    -3.22   0.003    -.8141188    -.182377
                ----------------+----------------------------------------------------------------
                          /cut1 |  -3.117644   .1324286                     -3.387734   -2.847554
                          /cut2 |  -1.696558   .0684551                     -1.836173   -1.556943
                          /cut3 |  -.3297573   .0432422                     -.4179504   -.2415642
                          /cut4 |   .8394853   .0449603                      .7477881    .9311824
                ---------------------------------------------------------------------------------
                
                . svy: ologit health i.race##i.highlead
                (running ologit on estimation sample)
                
                Survey: Ordered logistic regression
                
                Number of strata   =        31                 Number of obs     =       4,940
                Number of PSUs     =        62                 Population size   =  56,316,764
                                                               Design df         =          31
                                                               F(   5,     27)   =       15.78
                                                               Prob > F          =      0.0000
                
                ---------------------------------------------------------------------------------
                                |             Linearized
                         health |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                ----------------+----------------------------------------------------------------
                           race |
                         Black  |   -.856371   .1157361    -7.40   0.000    -1.092416   -.6203257
                         Other  |  -.3870694   .1629638    -2.38   0.024    -.7194362   -.0547025
                                |
                       highlead |
                      lead>=25  |  -.1423945   .1536119    -0.93   0.361     -.455688    .1708989
                                |
                  race#highlead |
                Black#lead>=25  |   .0906637   .3357318     0.27   0.789    -.5940659    .7753933
                Other#lead>=25  |    .031216   .2221003     0.14   0.889    -.4217606    .4841927
                ----------------+----------------------------------------------------------------
                          /cut1 |  -3.117644   .1324286                     -3.387734   -2.847554
                          /cut2 |  -1.696558   .0684551                     -1.836173   -1.556943
                          /cut3 |  -.3297573   .0432422                     -.4179504   -.2415642
                          /cut4 |   .8394853   .0449603                      .7477881    .9311824
                ---------------------------------------------------------------------------------
                
                . testparm race#highlead
                
                Adjusted Wald test
                
                 ( 1)  [health]2.race#1.highlead = 0
                 ( 2)  [health]3.race#1.highlead = 0
                
                       F(  2,    30) =    0.04
                            Prob > F =    0.9644
                
                . testparm race#highlead i.highlead
                
                Adjusted Wald test
                
                 ( 1)  [health]1.highlead = 0
                 ( 2)  [health]2.race#1.highlead = 0
                 ( 3)  [health]3.race#1.highlead = 0
                
                       F(  3,    29) =    0.31
                            Prob > F =    0.8158
                -------------------------------------------
                Richard Williams, Notre Dame Dept of Sociology
                StataNow Version: 19.5 MP (2 processor)

                EMAIL: [email protected]
                WWW: https://academicweb.nd.edu/~rwilliam/

                Comment


                • #9
                  Dear Richard Williams

                  Thank you again for the various clarifications.
                  Your comment about the interaction between state and capital made me see that this might be interesting. In studies on social class, race, and gender I have systematically estimated separate effects and then interactions. In fact, I had never used a combined variable before. I have come to argue in a study the inconvenience of doing this, because race and gender act in opposite ways in Brazil in terms of direct and indirect effects. As it has been translated into English in a special edition is available at this link:
                  http://socialsciences.scielo.org/pdf...se/scs_a02.pdf
                  Although this problem seems more serious in the cases mentioned, it is also inconvenient in this case. In this study I was going this way in a little reflected way.
                  My main interest is in estimating the effect of social position in each state segmented into capital and interior, that is, in more or less developed areas in aspects that can affect health.
                  I will estimate the results following your instructions.
                  Today is a national holiday in Brazil (Independence Day) and my home computer seems to be having problems with RAM.
                  I generated this result by interacting only the variables state (UF: Federation Unit) and capital.
                  The result is the probability of not having good health (Saúde Não Boa in Portuguese).
                  This was the syntax used:
                  svy: logit saudnboa_ts i.uf27##i.capital i.topo i.fem i.cor3all c.idade i.rural i.informa if inrange(idade,18,64), level (99) nolog
                  margins uf27##capital##topo i(1).topo
                  The results show the acronyms of the States. RJ is Rio de Janeiro, SP is São Paulo, and so on. I showed here only the effect to the top jobs (topo in Portuguese) in order not to generate many results.

                  Code:
                  . margins uf27##capital##topo   i(1).topo
                   
                  Predictive margins                                Number of obs   =      91583
                  Model VCE    : Linearized
                   
                  Expression   : Pr(saudnboa_ts), predict()
                   
                  -----------------------------------------------------------------------------------
                                    |            Delta-method
                                    |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
                  ------------------+----------------------------------------------------------------
                               uf27 |
                                RO  |   .2778907   .0156174    17.79   0.000      .247281    .3085003
                                AC  |    .302052   .0154792    19.51   0.000     .2717132    .3323907
                                AM  |   .2733624   .0109787    24.90   0.000     .2518444    .2948803
                                RR  |   .3149348   .0184236    17.09   0.000     .2788251    .3510444
                                PA  |   .3362717     .01579    21.30   0.000      .305324    .3672195
                                AP  |   .3122371   .0194938    16.02   0.000       .27403    .3504442
                                TO  |   .3135973   .0125889    24.91   0.000     .2889235    .3382712
                                MA  |   .3902546    .018898    20.65   0.000     .3532152     .427294
                                PI  |   .3470291   .0128748    26.95   0.000     .3217949    .3722633
                                CE  |   .2886499   .0100209    28.80   0.000     .2690093    .3082905
                                RN  |   .2616698   .0155009    16.88   0.000     .2312886    .2920509
                                PB  |   .2986619   .0113039    26.42   0.000     .2765067     .320817
                                PE  |   .3027312   .0102937    29.41   0.000      .282556    .3229064
                                AL  |   .3217079   .0136216    23.62   0.000       .29501    .3484058
                                SE  |   .3064735   .0134862    22.72   0.000     .2800411     .332906
                                BA  |   .3115274   .0148968    20.91   0.000     .2823302    .3407247
                                MG  |   .1698043   .0105851    16.04   0.000     .1490579    .1905507
                                ES  |   .2001832    .012528    15.98   0.000     .1756288    .2247376
                                RJ  |   .2140834   .0098225    21.80   0.000     .1948316    .2333352
                                SP  |   .1789225   .0064876    27.58   0.000     .1662071    .1916379
                                PR  |   .2120046   .0089817    23.60   0.000     .1944007    .2296084
                                SC  |   .2243286   .0134654    16.66   0.000     .1979369    .2507202
                                RS  |   .1997374   .0096013    20.80   0.000     .1809193    .2185555
                                MS  |   .2058184   .0125583    16.39   0.000     .1812047    .2304321
                                MT  |   .2259852   .0120682    18.73   0.000     .2023319    .2496384
                                GO  |   .2384418   .0101695    23.45   0.000       .21851    .2583736
                                DF  |          .  (not estimable)
                                    |
                            capital |
                                 0  |          .  (not estimable)
                                 1  |    .197593   .0033716    58.60   0.000     .1909847    .2042012
                                    |
                       uf27#capital |
                              RO#0  |   .3016331   .0200178    15.07   0.000     .2623989    .3408672
                              RO#1  |   .2086191   .0184873    11.28   0.000     .1723847    .2448536
                              AC#0  |   .3143684   .0199663    15.74   0.000     .2752352    .3535016
                              AC#1  |   .2662678   .0169028    15.75   0.000     .2331389    .2993966
                              AM#0  |   .2759229    .014057    19.63   0.000     .2483718     .303474
                              AM#1  |   .2659057   .0126861    20.96   0.000     .2410415      .29077
                              RR#0  |   .3315153   .0243307    13.63   0.000      .283828    .3792027
                              RR#1  |   .2668121   .0138306    19.29   0.000     .2397046    .2939197
                              PA#0  |   .3631792   .0205901    17.64   0.000     .3228233    .4035351
                              PA#1  |   .2582836   .0153975    16.77   0.000      .228105    .2884622
                              AP#0  |   .3267471   .0253115    12.91   0.000     .2771374    .3763568
                              AP#1  |     .27012   .0196377    13.76   0.000     .2316308    .3086092
                              TO#0  |   .3285335   .0160598    20.46   0.000     .2970569    .3600101
                              TO#1  |   .2702484   .0154624    17.48   0.000     .2399428    .3005541
                              MA#0  |   .4252915   .0248875    17.09   0.000     .3765128    .4740702
                              MA#1  |   .2892631   .0163858    17.65   0.000     .2571476    .3213786
                              PI#0  |   .3973137   .0165209    24.05   0.000     .3649333    .4296941
                              PI#1  |   .2010839   .0156305    12.86   0.000     .1704486    .2317192
                              CE#0  |   .3144452   .0122437    25.68   0.000      .290448    .3384424
                              CE#1  |   .2134681   .0164955    12.94   0.000     .1811375    .2457988
                              RN#0  |   .2655822   .0200656    13.24   0.000     .2262544      .30491
                              RN#1  |   .2502585   .0163273    15.33   0.000     .2182577    .2822593
                              PB#0  |   .3181793   .0142595    22.31   0.000     .2902311    .3461275
                              PB#1  |   .2418864    .015569    15.54   0.000     .2113717    .2724012
                              PE#0  |   .3232832   .0124712    25.92   0.000     .2988401    .3477263
                              PE#1  |   .2429682   .0177692    13.67   0.000     .2081413    .2777951
                              AL#0  |   .3120584   .0174604    17.87   0.000     .2778367    .3462801
                              AL#1  |   .3496094   .0161735    21.62   0.000     .3179099    .3813089
                              SE#0  |    .331302   .0173124    19.14   0.000     .2973704    .3652335
                              SE#1  |   .2342722   .0161498    14.51   0.000     .2026191    .2659252
                              BA#0  |   .3353148   .0194787    17.21   0.000     .2971372    .3734923
                              BA#1  |   .2424035   .0146639    16.53   0.000     .2136629    .2711441
                              MG#0  |   .1865298   .0139019    13.42   0.000     .1592826    .2137769
                              MG#1  |   .1203933   .0091096    13.22   0.000     .1025387    .1382478
                              ES#0  |   .2161902   .0158244    13.66   0.000      .185175    .2472054
                              ES#1  |   .1530791   .0167022     9.17   0.000     .1203433    .1858149
                              RJ#0  |   .2292472   .0126602    18.11   0.000     .2044338    .2540607
                              RJ#1  |   .1695418   .0104116    16.28   0.000     .1491354    .1899481
                              SP#0  |   .1729889   .0081982    21.10   0.000     .1569208     .189057
                              SP#1  |   .1963831   .0084175    23.33   0.000      .179885    .2128811
                              PR#0  |    .225835   .0112537    20.07   0.000     .2037781    .2478919
                              PR#1  |   .1713757   .0125403    13.67   0.000     .1467971    .1959543
                              SC#0  |   .2360518    .016278    14.50   0.000     .2041476     .267956
                              SC#1  |   .1899505   .0226901     8.37   0.000     .1454787    .2344223
                              RS#0  |   .2125332   .0120242    17.68   0.000     .1889662    .2361002
                              RS#1  |   .1620957   .0127136    12.75   0.000     .1371775    .1870138
                              MS#0  |   .2192064   .0164581    13.32   0.000     .1869491    .2514637
                              MS#1  |   .1664614    .010588    15.72   0.000     .1457092    .1872136
                              MT#0  |   .2587923   .0154282    16.77   0.000     .2285535     .289031
                              MT#1  |   .1295534    .014689     8.82   0.000     .1007635    .1583432
                              GO#0  |   .2535028   .0128641    19.71   0.000     .2282896     .278716
                              GO#1  |   .1943344   .0134488    14.45   0.000     .1679753    .2206936
                              DF#0  |          .  (not estimable)
                              DF#1  |    .226033   .0094581    23.90   0.000     .2074955    .2445704
                                    |
                             1.topo |   .1243364   .0053548    23.22   0.000     .1138411    .1348317
                                    |
                          uf27#topo |
                              RO#1  |   .1500063   .0120311    12.47   0.000     .1264258    .1735869
                              AC#1  |   .1657514    .012433    13.33   0.000     .1413832    .1901195
                              AM#1  |   .1466097   .0093111    15.75   0.000     .1283604    .1648591
                              RR#1  |   .1746851   .0146007    11.96   0.000     .1460683     .203302
                              PA#1  |   .1901416    .013652    13.93   0.000     .1633841    .2168991
                              AP#1  |   .1727639   .0151586    11.40   0.000     .1430536    .2024742
                              TO#1  |   .1737128   .0111336    15.60   0.000     .1518914    .1955341
                              MA#1  |   .2307279   .0171852    13.43   0.000     .1970455    .2644103
                              PI#1  |   .2000437    .012219    16.37   0.000     .1760949    .2239924
                              CE#1  |   .1572324   .0091828    17.12   0.000     .1392344    .1752305
                              RN#1  |   .1390461   .0114478    12.15   0.000     .1166087    .1614835
                              PB#1  |   .1636656   .0102082    16.03   0.000     .1436578    .1836734
                              PE#1  |   .1664654   .0097251    17.12   0.000     .1474047    .1855262
                              AL#1  |   .1794632   .0117507    15.27   0.000     .1564322    .2024942
                              SE#1  |   .1692184   .0115353    14.67   0.000     .1466096    .1918272
                              BA#1  |   .1726322   .0123606    13.97   0.000     .1484059    .1968584
                              MG#1  |   .0839752   .0069944    12.01   0.000     .0702664    .0976841
                              ES#1  |   .1014175   .0085894    11.81   0.000     .0845827    .1182524
                              RJ#1  |   .1096476   .0075423    14.54   0.000     .0948649    .1244302
                              SP#1  |   .0891933   .0052864    16.87   0.000     .0788321    .0995546
                              PR#1  |   .1083757   .0070226    15.43   0.000     .0946117    .1221397
                              SC#1  |   .1157701   .0094629    12.23   0.000     .0972231    .1343171
                              RS#1  |   .1010918    .007052    14.34   0.000       .08727    .1149135
                              MS#1  |   .1046873   .0087878    11.91   0.000     .0874636    .1219111
                              MT#1  |   .1176287    .008988    13.09   0.000     .1000125    .1352448
                              GO#1  |   .1245047   .0082735    15.05   0.000      .108289    .1407205
                              DF#1  |          .  (not estimable)
                                    |
                       capital#topo |
                               0 1  |          .  (not estimable)
                               1 1  |   .1007122   .0046059    21.87   0.000     .0916848    .1097397
                                    |
                  uf27#capital#topo |
                            RO#0#1  |   .1654225   .0150492    10.99   0.000     .1359267    .1949184
                            RO#1#1  |   .1063298   .0118885     8.94   0.000     .0830287    .1296308
                            AC#0#1  |     .17413   .0153557    11.34   0.000     .1440335    .2042266
                            AC#1#1  |   .1420367   .0123499    11.50   0.000     .1178314     .166242
                            AM#0#1  |    .148307   .0110239    13.45   0.000     .1267005    .1699135
                            AM#1#1  |   .1418033   .0099548    14.24   0.000     .1222923    .1613142
                            RR#0#1  |   .1860989   .0186245     9.99   0.000     .1495956    .2226022
                            RR#1#1  |    .142388   .0106534    13.37   0.000     .1215077    .1632682
                            PA#0#1  |   .2089577   .0171307    12.20   0.000     .1753822    .2425332
                            PA#1#1  |   .1369155   .0113487    12.06   0.000     .1146725    .1591584
                            AP#0#1  |   .1827421   .0191406     9.55   0.000     .1452272     .220257
                            AP#1#1  |   .1445283   .0139971    10.33   0.000     .1170946     .171962
                            TO#0#1  |   .1839971   .0134378    13.69   0.000     .1576595    .2103347
                            TO#1#1  |   .1446116   .0115453    12.53   0.000     .1219833    .1672399
                            MA#0#1  |   .2567843   .0219702    11.69   0.000     .2137236    .2998451
                            MA#1#1  |   .1571111    .012565    12.50   0.000     .1324841    .1817381
                            PI#0#1  |   .2347378   .0153056    15.34   0.000     .2047395    .2647362
                            PI#1#1  |   .1018765    .010222     9.97   0.000     .0818418    .1219112
                            CE#0#1  |    .174183   .0108242    16.09   0.000      .152968     .195398
                            CE#1#1  |   .1092212    .010931     9.99   0.000     .0877969    .1306455
                            RN#0#1  |   .1415947   .0141611    10.00   0.000     .1138394    .1693501
                            RN#1#1  |   .1318258    .011688    11.28   0.000     .1089178    .1547338
                            PB#0#1  |   .1767656   .0122357    14.45   0.000     .1527841    .2007472
                            PB#1#1  |   .1265773   .0109909    11.52   0.000     .1050355     .148119
                            PE#0#1  |   .1803173   .0112923    15.97   0.000     .1581848    .2024498
                            PE#1#1  |   .1272519   .0123165    10.33   0.000     .1031121    .1513918
                            AL#0#1  |   .1725392   .0138752    12.44   0.000     .1453443    .1997341
                            AL#1#1  |   .1990394   .0138748    14.35   0.000     .1718453    .2262336
                            SE#0#1  |   .1859482   .0142304    13.07   0.000     .1580571    .2138392
                            SE#1#1  |   .1218577   .0111768    10.90   0.000     .0999516    .1437638
                            BA#0#1  |   .1887895    .015539    12.15   0.000     .1583336    .2192453
                            BA#1#1  |   .1268996   .0105188    12.06   0.000     .1062831    .1475161
                            MG#0#1  |   .0934116   .0089186    10.47   0.000     .0759316    .1108917
                            MG#1#1  |   .0571571   .0053551    10.67   0.000     .0466614    .0676528
                            ES#0#1  |   .1108533   .0106418    10.42   0.000     .0899958    .1317108
                            ES#1#1  |   .0746277    .009633     7.75   0.000     .0557475     .093508
                            RJ#0#1  |    .118771   .0092171    12.89   0.000     .1007057    .1368362
                            RJ#1#1  |   .0837563   .0068912    12.15   0.000     .0702499    .0972627
                            SP#0#1  |   .0856961   .0059792    14.33   0.000      .073977    .0974151
                            SP#1#1  |   .0991228   .0062705    15.81   0.000     .0868329    .1114126
                            PR#0#1  |   .1166875   .0083611    13.96   0.000     .1003001    .1330749
                            PR#1#1  |   .0847871   .0079473    10.67   0.000     .0692107    .1003635
                            SC#0#1  |   .1229562   .0112257    10.95   0.000     .1009542    .1449582
                            SC#1#1  |    .095385   .0137013     6.96   0.000     .0685311     .122239
                            RS#0#1  |   .1086621   .0084745    12.82   0.000     .0920523    .1252719
                            RS#1#1  |   .0795998   .0078176    10.18   0.000     .0642776     .094922
                            MS#0#1  |   .1126691   .0110671    10.18   0.000     .0909779    .1343603
                            MS#1#1  |   .0820313   .0069775    11.76   0.000     .0683556    .0957069
                            MT#0#1  |     .13724    .011334    12.11   0.000     .1150259    .1594542
                            MT#1#1  |   .0619664   .0082462     7.51   0.000     .0458042    .0781287
                            GO#0#1  |   .1338764   .0099455    13.46   0.000     .1143837    .1533692
                            GO#1#1  |   .0979286   .0088476    11.07   0.000     .0805875    .1152696
                            DF#0#1  |          .  (not estimable)
                            DF#1#1  |   .1168081   .0074054    15.77   0.000     .1022937    .1313225
                  -----------------------------------------------------------------------------------

                  Comment


                  • #10
                    The fact that there are so many results here, plus the fact that I know nothing about Brazil, makes it hard for me to say much about your results. But, they probably mean much more to you. In the US we often use region (north, south, east and west) as a more parsimonious alternative to using states when we think there are differences across the country. In short, you might consider if there are simpler ways to get at the differences you want. But again, you know far more about Brazil than I do.

                    And, I think the logit command, with interaction effects instead of everythiing mushed together, is the way to go. Like I did in my examples, in between my logit command and my margins command, I would do tests of the main and interaction effects, unless maybe it is super-obvious all are significant. The interaction effects add a lot of terms to your model, and you may not want that added complexity if they are obviously not important. And if they are important I think you should formally show so.
                    -------------------------------------------
                    Richard Williams, Notre Dame Dept of Sociology
                    StataNow Version: 19.5 MP (2 processor)

                    EMAIL: [email protected]
                    WWW: https://academicweb.nd.edu/~rwilliam/

                    Comment


                    • #11
                      Dears

                      I put here estimates similar to the post #9, but now using the four major regions of Brazil.
                      I show both the effects of having a job at the top and outside of it in every region divided by capital and interior.
                      The sequence goes from less developed to more developed regions.
                      N is the acronym of North; N for Northeast; S for South; SE for Southeast.
                      The result is the probability of not having good health (Saúde Não Boa in Portuguese).

                      The syntax used was the following:
                      svy: logit saudnboa_ts i.reg5##i.capital i.topo i.fem i.cor3all c.idade i.rural i.informa if inrange(idade,18,64), level (99) nolog
                      margins reg##capital##topo



                      Code:
                      . margins reg5##capital##topo
                       
                      Predictive margins                                Number of obs   =      91583
                      Model VCE    : Linearized
                       
                      Expression   : Pr(saudnboa_ts), predict()
                       
                      -----------------------------------------------------------------------------------
                                        |            Delta-method
                                        |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
                      ------------------+----------------------------------------------------------------
                                   reg5 |
                                     N  |   .3166018   .0094128    33.64   0.000      .298153    .3350506
                                    NO  |   .3131934   .0060065    52.14   0.000     .3014209    .3249659
                                    CO  |   .2359543    .006722    35.10   0.000     .2227794    .2491291
                                     S  |   .2104736   .0060709    34.67   0.000     .1985748    .2223725
                                    SE  |   .1860269   .0047967    38.78   0.000     .1766256    .1954282
                                        |
                                capital |
                                     0  |   .2468258   .0037503    65.82   0.000     .2394754    .2541763
                                     1  |   .2025686   .0034624    58.51   0.000     .1957825    .2093547
                                        |
                           reg5#capital |
                                   N#0  |   .3362232   .0123903    27.14   0.000     .3119386    .3605077
                                   N#1  |   .2595887   .0072357    35.88   0.000      .245407    .2737704
                                  NO#0  |   .3363775   .0079097    42.53   0.000     .3208748    .3518803
                                  NO#1  |   .2457697   .0063385    38.77   0.000     .2333465     .258193
                                  CO#0  |    .248598   .0087748    28.33   0.000     .2313997    .2657963
                                  CO#1  |   .1988656   .0062459    31.84   0.000     .1866238    .2111074
                                   S#0  |   .2239253   .0075224    29.77   0.000     .2091816     .238669
                                   S#1  |    .170878   .0084848    20.14   0.000     .1542481    .1875079
                                  SE#0  |   .1882596   .0061226    30.75   0.000     .1762596    .2002597
                                  SE#1  |   .1794431   .0058765    30.54   0.000     .1679254    .1909608
                                        |
                                   topo |
                                     0  |   .2472875   .0030463    81.18   0.000     .2413168    .2532582
                                     1  |   .1236268   .0053406    23.15   0.000     .1131594    .1340942
                                        |
                              reg5#topo |
                                   N#0  |   .3324178   .0097229    34.19   0.000     .3133613    .3514743
                                   N#1  |   .1754376   .0095463    18.38   0.000     .1567272     .194148
                                  NO#0  |   .3287615    .006229    52.78   0.000      .316553      .34097
                                  NO#1  |   .1732473   .0080042    21.64   0.000     .1575593    .1889353
                                  CO#0  |   .2485322   .0069954    35.53   0.000     .2348214    .2622429
                                  CO#1  |   .1225224   .0066472    18.43   0.000     .1094941    .1355508
                                   S#0  |    .221806   .0063638    34.85   0.000     .2093333    .2342787
                                   S#1  |   .1071046   .0057106    18.76   0.000     .0959119    .1182973
                                  SE#0  |   .1965301   .0050439    38.96   0.000     .1866443    .2064159
                                  SE#1  |   .0927779   .0047967    19.34   0.000     .0833765    .1021794
                                        |
                           capital#topo |
                                   0 0  |   .2593684   .0039708    65.32   0.000     .2515859    .2671509
                                   0 1  |   .1310574   .0058237    22.50   0.000     .1196431    .1424717
                                   1 0  |   .2135262   .0037104    57.55   0.000     .2062538    .2207985
                                   1 1  |   .1028243    .004702    21.87   0.000     .0936086      .11204
                                        |
                      reg5#capital#topo |
                                 N#0#0  |   .3532802   .0128481    27.50   0.000     .3280984    .3784621
                                 N#0#1  |   .1888822   .0114416    16.51   0.000      .166457    .2113074
                                 N#1#0  |   .2736124   .0075877    36.06   0.000     .2587408     .288484
                                 N#1#1  |   .1373112   .0072598    18.91   0.000     .1230824    .1515401
                                NO#0#0  |     .35344   .0082141    43.03   0.000     .3373406    .3695395
                                NO#0#1  |   .1889917   .0092296    20.48   0.000     .1709021    .2070813
                                NO#1#0  |   .2591835   .0066571    38.93   0.000     .2461357    .2722312
                                NO#1#1  |   .1285886   .0066419    19.36   0.000     .1155706    .1416066
                                CO#0#0  |    .262138   .0091757    28.57   0.000     .2441539    .2801222
                                CO#0#1  |   .1303599   .0077893    16.74   0.000     .1150932    .1456267
                                CO#1#0  |   .2100776   .0065893    31.88   0.000     .1971627    .2229924
                                CO#1#1  |   .1002361   .0055602    18.03   0.000     .0893382    .1111339
                                 S#0#0  |   .2363383    .007902    29.91   0.000     .2208506    .2518259
                                 S#0#1  |   .1151459   .0065505    17.58   0.000     .1023072    .1279847
                                 S#1#0  |   .1806851    .008935    20.22   0.000     .1631729    .1981974
                                 S#1#1  |   .0842154   .0059453    14.16   0.000     .0725628     .095868
                                SE#0#0  |   .1989469   .0064529    30.83   0.000     .1862994    .2115945
                                SE#0#1  |   .0940875   .0053611    17.55   0.000     .0835799     .104595
                                SE#1#0  |    .189687   .0062234    30.48   0.000     .1774894    .2018847
                                SE#1#1  |   .0890484   .0049315    18.06   0.000      .079383    .0987139
                      -----------------------------------------------------------------------------------

                      Comment

                      Working...
                      X