Announcement

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

  • SPMAP - How to highlight specific countries

    Hello everyone,

    I have a full matrix of results after running a mlogit estimation by country. I would like to represent the results in a map instead of a "classic" table, since I have one estimation result per country. The matrix looks like this

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str52 origin float(o converged nobs nalt nresp ndfm npar nwaves nsubwaves DOM_GTIa_b DOM_GTIa_se DOM_GTIa_z DOM_GTIa_p INT_GTIa_b INT_GTIa_se INT_GTIa_z INT_GTIa_p)
    "Albania"                            1 1   970  0 3 24 34 2 2   -.12976843  .06936996  -1.870672     .06139055   .01470666   .0755269  .19472083      .8456115
    "Algeria"                            2 1  3084 33 3 27 38 4 5  -.027323693  .02498631 -1.0935466     .27415386   -.0912853  .07684368 -1.1879352     .23485893
    "Angola"                             3 1  1477  0 3 24 34 2 2     .3213637     .16525   1.944712     .05180966      1.3229  .18704215   7.072738 1.5190604e-12
    "Argentina"                          4 1  2785  0 3 30 40 5 5  -.007761759  .03415157 -.22727385      .8202108   .04489442  .13897046  .32305005      .7466573
    "Armenia"                            5 1  3693  0 3 34 44 7 7    -.1061456  .07207699 -1.4726696     .14084014   .01333367  .11064167   .1205122      .9040774
    "Australia"                          6 1  1152  0 3 26 36 3 3    .07956897  .06095408   1.305392     .19175935   .08964764  .24161074   .3710416      .7106065
    "Austria"                            7 1  1776  0 3 26 36 4 4  -.024301853  .06482402  -.3748896      .7077426  -.21141933  .26632944  -.7938263     .42729655
    "Azerbaijan"                         8 1  2541  0 3 33 44 7 7    .12076923  .08159624  1.4800832     .13885105   .04918098  .14792563    .332471      .7395336
    "Bahrain"                            9 1  3066  0 3 28 38 4 4   -.13126999 .026468387  -4.959501   7.06745e-07  .001847397  .10302607 .017931355      .9856936
    "Bangladesh"                        10 1  5219  0 3 34 44 7 7   -.02151143  .05887154  -.3653961      .7148157   -.4054044  .19024552 -2.1309536     .03309296
    "Belarus"                           11 1  4029  0 3 34 44 7 7    .14699467 .032421812    4.53382  5.792633e-06   .13709433   .0934105  1.4676545      .1421981
    "Belgium"                           12 1  1596  0 3 26 36 3 3     .2250023   .0799418   2.814576    .004884162   .10730167   .2732547  .39268005      .6945558
    "Benin"                             13 1  3834  0 3 28 40 5 5            0          0          .             .           0          0          .             .
    "Bhutan"                            14 1  2235  0 3 26 36 3 3    .05105785  .07547566    .676481      .4987353    .7638986   .3661446  2.0863302    .036948714
    "Bolivia"                           15 1  4125  0 3 32 42 6 6   -.07310887  .03851023 -1.8984274      .0576398  .002404557  .10276804 .023397906      .9813329
    "Botswana"                          16 1  2119  0 3 24 36 3 3            0          0          .             .           0          0          .             .
    "Bulgaria"                          18 1  2657  0 3 32 42 7 7 -.0022955062   .0710047 -.03232893      .9742097 -.013702468  .10736345 -.12762693      .8984442
    "Burkina Faso"                      19 1  4426  0 3 32 42 6 6    .02428656  .07466631    .325268      .7449782     .302009  .12197249   2.476042    .013284806
    "Burundi"                           20 1  2185  0 3 26 36 3 3  -.026132485  .04184137  -.6245609      .5322593    .3114715   .1341154   2.322414     .02021066
    "Cambodia"                          21 1  4267  0 3 32 42 6 6    .24135967  .09024387   2.674527    .007483474   .25230622   .4154064    .607372      .5436041
    "Cameroon"                          22 1  3942  0 3 32 42 6 6   -.02224585  .01969297 -1.1296341     .25863042   .10795724  .04598539  2.3476424     .01889265
    "Central African Republic"          24 1  1622  0 3 24 34 2 2    .16186996  .07203152  2.2472103    .024626594   .19282487   .1792534  1.0757111     .28205648
    "Chad"                              25 1  5831  0 3 34 44 7 7  -.022808196  .02091916 -1.0903016     .27558026    .0817886 .035410184  2.3097477    .020902127
    "Chile"                             26 1  3272  0 3 32 42 6 6   .070772186  .02123457  3.3328755   .0008595338   .13987544 .071867846  1.9462868      .0516203
    "Colombia"                          28 1  3556  0 3 34 44 7 7   .010944182  .02206466    .496005      .6198909   .09966103 .064829744  1.5372733      .1242264
    "Costa Rica"                        29 1  3738  0 3 30 42 6 6            0          0          .             .           0          0          .             .
    "Croatia"                           30 1  1131  0 3 24 34 2 2    -.8031086   .3708303  -2.165704    .030333815    -.336095   .4571997  -.7351164      .4622686
    "Cyprus"                            31 1  1991  0 3 28 38 4 4    -.1672957  .07304565 -2.2902896    .022004535   .20944045   .2079715  1.0070633     .31390435
    "Czech Republic"                    32 1  3138  0 3 32 42 7 7    .05053426  .05129416   .9851855       .324533   -.5692547  .28674084 -1.9852586     .04711571
    "Côte d'Ivoire"                    33 1  2792  0 3 28 38 4 4  -.012926582 .022134684 -.58399665      .5592225  -.08983453  .04873696 -1.8432528     .06529211
    "Democratic Republic of the Congo"  34 1  4132  0 3 31 42 6 6    .07035348 .018477144   3.807595  .00014032493   .11695943 .033849396  3.4552884   .0005497044
    "Denmark"                           35 1  1416  0 3 26 36 3 3    .05319685  .05018159   1.060087     .28910503  -.04196068   .1731983 -.24226958      .8085713
    "Dominican Republic"                36 1  3686  0 3 34 44 7 7    -.0590481  .05486678 -1.0762085     .28183404   .05575668  .09423537  .59167475     .55406845
    "Ecuador"                           37 1  2619  0 3 30 40 5 5   -.05710624  .04404862 -1.2964363      .1948252  .024705335  .11607515  .21283914      .8314524
    "Egypt"                             38 1  3778  0 3 30 40 5 5    .06224888  .02732705  2.2779217    .022731246  -.16653553 .072495446 -2.2971861     .02160816
    "El Salvador"                       39 1  4244  0 3 30 42 6 6            0          0          .             .           0          0          .             .
    "Estonia"                           40 1   800  0 3 22 34 2 2            0          0          .             .           0          0          .             .
    "Ethiopia"                          41 1  2313  0 3 24 36 3 3   -.09492033 .035950456  -2.640309    .008283036  .009260411  .08299669  .11157567      .9111599
    "Finland"                           42 1   924  0 3 26 36 3 3    .06856895  .07416604   .9245331      .3552088  -.09643614  .22761875   -.423674      .6718036
    "Gabon"                             44 1  3623  0 3 28 40 5 5            0          0          .             .           0          0          .             .
    "Georgia"                           45 1  3564  0 3 34 44 7 7   .001418286  .04032076 .035175085      .9719401   .09584304   .1409213   .6801175      .4964301
    "Germany"                           46 1  1512  2 3 28 38 4 5   -.13734046 .064169586 -2.1402733    .032332674   -.1224961  .22540124  -.5434579      .5868146
    "Ghana"                             47 1  3441  0 3 30 40 5 5  -.012165073  .04050349  -.3003463       .763913 -.036758944  .07704773  -.4770931      .6332958
    "Greece"                            48 1  3315  0 3 31 44 7 7   .005809367  .02549153  .22789402      .8197286   .04606277  .05196906   .8863498      .3754291
    "Guatemala"                         49 1  2888  0 3 28 38 4 4    .05378345  .03990714  1.3477148     .17775014   .09446277  .07977389  1.1841315     .23636103
    "Guinea"                            50 1  3176  0 3 30 40 5 5    .10948043  .04519242    2.42254     .01541244   .11043192  .05833423  1.8930895     .05834597
    "Haiti"                             51 1  1773  0 3 32 42 6 6    -.1062982  .17865923  -.5949774      .5518586  -.25396657   .3568481  -.7116939     .47665435
    "Honduras"                          52 1  4276  0 3 34 44 7 7   .006012908 .029601675   .2031273      .8390355   .04798345  .05443902   .8814165      .3780924
    "Hungary"                           53 1   780  0 3 24 34 2 2     .1520987  .12554277  1.2115288      .2256928    .1764534  .17035283  1.0358113      .3002902
    "India"                             54 1 21817  0 3 34 44 7 8    .13563919 .014895702   9.105928  8.553145e-20   .08940367   .1235207   .7237949      .4691916
    "Indonesia"                         55 1  5074  0 3 30 44 7 7    .11743207          0          .             .   .57115334          0          .             .
    "Iran"                              56 1  3032  0 3 30 40 5 5     .0830548  .01996583  4.1598477 .000031845986   .27585882  .05727866   4.816084  1.464031e-06
    "Iraq"                              57 1  2842  0 3 26 36 3 4    .03987381  .02660379   1.498802     .13392502    .1069322   .0512499   2.086486     .03693461
    "Israel"                            58 1  3760  0 3 32 42 6 6    .00398869  .04455171  .08952945      .9286612    .3831985  .19396946   1.975561     .04820451
    "Italy"                             59 1  1350 12 3 28 38 4 4   -.08993775  .05535474 -1.6247525      .1042153  -.19138093  .12206419 -1.5678713     .11691117
    "Jamaica"                           60 1   291  0 3 22 32 1 1    .57796067  1.1951133   .4836032      .6286675   .06305569   2.477118 .025455264      .9796918
    "Jordan"                            61 1  6108  0 3 33 44 7 8  -.015606663 .025536615  -.6111485      .5411013   .05488089  .08172279   .6715494      .5018706
    "Kazakhstan"                        62 1  4275  0 3 34 44 7 7     -.010219 .035766106 -.28571743      .7750946   .08280636   .1542963   .5366711     .59149486
    "Kenya"                             63 1  4429  0 3 32 42 6 6   -.00466262 .015892455  -.2933858      .7692273  .021940624  .05953586   .3685279      .7124797
    "Kosovo"                            64 1  1329  0 3 24 34 2 2    .12502153  .05741621  2.1774607     .02944622   -.1812762   .1092144 -1.6598196     .09695075
    "Kuwait"                            65 1  4509  0 3 31 42 6 7   .033569094  .02467113   1.360663      .1736202   .05583004     .05034  1.1090592     .26740468
    "Kyrgyzstan"                        66 1  4492  0 3 34 44 7 7    .04069415  .05300311   .7677692      .4426244    .0228309  .09983688  .22868203      .8191161
    "Latvia"                            68 1  2666  0 3 30 42 6 6            0          0          .             .           0          0          .             .
    "Lebanon"                           69 1  5671  0 3 34 44 7 8  .0091223195 .032434504  .28125355      .7785159   .05743228  .08312149   .6909438      .4896009
    "Lesotho"                           70 1   687  0 3 22 32 1 1    .06033796  .31020415   .1945105      .8457762   .06780086   .6841646  .09910022      .9210587
    "Libya"                             71 1  1490  0 3 24 34 2 2   -.06241156  .03126206 -1.9963994     .04589046  -.12591198  .04282713 -2.9400055    .003282064
    "Lithuania"                         72 1  3004  0 3 32 44 7 7            0          0          .             .           0          0          .             .
    "Luxembourg"                        73 1   515 21 3 17 32 1 1            0          0          .             .           0          0          .             .
    "Macedonia"                         74 1   922  0 3 24 34 2 2    .06169864  .06203803   .9945294      .3199652 -.029748766  .08048767  -.3696065      .7116757
    "Madagascar"                        75 1  3822  0 3 30 40 5 5  -.025226656 .027063074  -.9321431      .3512626  -.04903199  .11437062  -.4287114      .6681333
    "Malawi"                            76 1  1547  0 3 22 34 2 2            0          0          .             .           0          0          .             .
    "Malaysia"                          77 1  3545  0 3 26 40 5 5    .03895926          0          .             .   .26040888          0          .             .
    "Mauritania"                        79 1  6078  0 3 34 44 7 8   -.02401965  .02962074  -.8109065      .4174194    .2115876   .0699957   3.022865    .002503937
    "Mexico"                            80 1  2645  0 3 28 38 4 5   -.07626173  .03754194  -2.031374     .04221708   .09839313  .09078282  1.0838299      .2784402
    "Moldova"                           81 1  3439  0 3 32 42 6 6    .03090454 .063426904   .4872466      .6260836   .08377279  .10472643   .7999201     .42375705
    "Mongolia"                          82 1  3451  0 3 28 40 5 5            0          0          .             .           0          0          .             .
    "Montenegro"                        83 1  1016  0 3 24 34 2 2  -.011387386  .11177985 -.10187335      .9188572   .05431838  .20086843  .27041772      .7868389
    "Morocco"                           84 1  2735  0 3 26 36 4 4   .012853036  .03076947   .4177204      .6761515   .05956033  .09554326    .623386      .5330309
    "Mozambique"                        85 1   560  0 3 20 32 1 1  -.025699314  .04721348 -.54432154      .5862202   .07667636   .2171748   .3530629      .7240413
    "Myanmar"                           86 1  2536  1 3 28 38 4 4   -.05435925  .04203175 -1.2932903      .1959107   -8.914063   .4636493 -19.225874             0
    "Namibia"                           87 1   562  0 3 20 32 1 1            0          0          .             .           0          0          .             .
    "Nepal"                             88 1  5116  0 3 34 44 7 7   .008803531  .06132296   .1435601      .8858479   .10543472   .3498898   .3013369      .7631576
    "Netherlands"                       89 1  1205  0 3 26 36 3 3   .010910528  .05858107  .18624663      .8522514   .08331673   .2316848   .3596124       .719137
    "New Zealand"                       90 1  1086  0 3 26 36 3 3   -.06923419   .1155389  -.5992284      .5490205   .06389091   .2422298  .26376155      .7919636
    "Nicaragua"                         91 1  3628  0 3 32 42 6 6   -.01997141  .04976946  -.4012784      .6882152  -.14595287  .11547628 -1.2639207      .2062585
    "Niger"                             92 1  5691  0 3 34 44 7 7   -.02223478 .021884413 -1.0160099      .3096247  -.06146595   .0394048 -1.5598593     .11879313
    "Nigeria"                           93 1  5692  0 3 34 44 7 8   -.05395183 .015662184 -3.4447196   .0005716524  -.14294887  .03714282  -3.848627  .00011878164
    "Norway"                            94 1   507  1 3 15 32 1 1    .07600389          0          .             .   -6.473337          0          .             .
    "Pakistan"                          95 1  5343  0 3 34 44 7 7   -.04995336  .08557837  -.5837147     .55941224  -.55540514   .4205642  -1.320619      .1866284
    "Panama"                            96 1  4057  0 3 34 44 7 7   -.11600205   .2729485  -.4249961      .6708395   -7.677625   .3728125 -20.593796             0
    "Paraguay"                          97 1  4120  0 3 34 44 7 7   -.06078538  .07659777  -.7935659      .4274482   .21925806  .12651429  1.7330694     .08308333
    "Peru"                              98 1  3030  0 3 34 44 7 7   .021997254  .03593865    .612078      .5404862  -.07611353  .08475634  -.8980276      .3691708
    "Poland"                            99 1  3248  0 3 30 42 7 7            0          0          .             .           0          0          .             .
    "Portugal"                         100 1  1535  0 3 26 36 4 4   .034176577  .17446056  .19589858      .8446895   .38357905  .36726505  1.0444202       .296291
    "Republic of Congo"                101 1  3439  0 3 30 40 5 5  .0021089418  .09938148  .02122067      .9830696  -3.8667054   .0856987  -45.11977             0
    "Romania"                          102 1  2009  0 3 34 44 7 7     .3689977   .4405231   .8376355      .4022355  -1.3828766  1.0751041 -1.2862724       .198348
    "Russia"                           103 1  9413  0 3 30 44 7 9   -.07009073     .02418  -2.898707    .003747053  -.02718243   .0870212 -.31236565      .7547626
    "Saudi Arabia"                     105 1  4272  0 3 30 40 5 5    .11043423 .021319315   5.180008  2.218757e-07  .012755977  .04997024   .2552715      .7985134
    "Senegal"                          106 1  5134  0 3 34 44 7 7   .011229874  .02965718   .3786561      .7049432   .08325405  .04317566  1.9282634     .05382236
    "Serbia"                           107 1  1382  0 3 32 42 6 6    -.3021757  .13928722  -2.169443     .03004908   -.2111873   .1751461  -1.205778     .22790307
    end
    DOM_GTIa_b corresponds to the beta coefficient of my variable of interest (GTIa) on internal migrations (DOM) (outcome 2 of my mlogit).
    DOM_GTIa_p corresponds to the corresponding p-value.
    INT suffix stands for international migrations (outcome 3 of my mlogit).

    I'd like to create two maps, one for internal migrations, the other for international ones. I would like to include all beta coefficients I have here in my matrix of results, but with a particular emphasis on the ones being significant at 5% (p<=0.05). Ideally, I thought about highlighting these particular countries with slashes (I'm opened to suggestions).

    My current spmap code is such as:

    Code:
    rename DOM_GTIa_b GTI_Internal_b
    format (GTI_Internal_b) %12.2f 
    spmap GTI_Internal_b using "worldcoor.dta" if NAME_0!="Antarctica", id(id) fcolor(RdBu) clmethod(custom) clbreaks(-0.80 -0.1 0 0.1 0.58) ndocolor(gs13) ocolor(none ..) osize(vvthin) legstyle(2) legcount legend(size(*1.5))
    But with this code I obtain a map without any distinction on the p-values obviously. Any idea how to do that please? Any help would be much appreciated.

    Thank you in advance,
    Killian

  • #2
    Any ideas please?

    Kind regards,
    Killian

    Comment


    • #3
      A couple options would be use the label() and/or point() options to highlight particular areas. Using the example data in Maurizio Pisati's -spmap-:

      Code:
      use "Italy-RegionsData.dta"
      
      spmap relig1 using "Italy-RegionsCoordinates.dta", id(id) /// 
          point( xcoord(xcoord) ycoord(ycoord) select(keep if relig1 >67) size(*3) fcolor(blue) ) ///
          label(xcoord(xcoord) ycoord(ycoord) label(relig1) select(keep if relig1 >67))
      Click image for larger version

Name:	Graph.png
Views:	1
Size:	63.6 KB
ID:	1553536

      Comment


      • #4
        Ok thanks for your reply. I'll try this and post again on this topic if I have any issue.

        Best,
        Killian Foubert

        Comment

        Working...
        X