Announcement

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

  • Palma ratio

    Hello
    I have the following information
    How can I get the Palma ratio for each province in Iran?
    (Each province has a code)
    Code:
     * Example generated by -dataex-. To install: ssc install dataex clear input long FamilyCode byte Familysize long Householdcost double weight str2 provincecode byte(Numberchildren Numberadults) 1000001172 4  78334098 730.040555625913 "00" 0 4 1000001177 6 124493597 730.040555625913 "00" 0 6 1000001180 4 115916220 730.040555625913 "00" 1 3 1000001181 4  63545000 730.040555625913 "00" 0 4 1010001058 2 166503300  480.21485567259 "01" 0 2 1010001061 3  69395700  480.21485567259 "01" 0 3 1010001062 4 152237000  480.21485567259 "01" 0 4 1010001065 4 118378300  480.21485567259 "01" 0 4 1010001069 4 236274000  480.21485567259 "01" 0 4 1010002155 3 237815600 671.720096486292 "01" 0 3 1010002158 4 131921720 671.720096486292 "01" 1 3 1010002162 6 133199600 671.720096486292 "01" 1 5 1010002165 4 164902380 671.720096486292 "01" 0 4 1020001005 2  38355000   1155.402801109 "02" 0 2 1020001009 5 111509500   1155.402801109 "02" 2 3 1020001011 5  75596500   1155.402801109 "02" 1 4 1020001016 3  57215400   1155.402801109 "02" 0 3 1020002218 4 144330000 2251.34387864718 "02" 2 2 1040001186 3  76261706 1377.38780093977 "04" 0 3 1040001189 4  65453510 1377.38780093977 "04" 2 2 1040001192 1  20463000 1377.38780093977 "04" 0 1 1040001195 3  72476164 1377.38780093977 "04" 1 2 1040001196 1  37835000 1377.38780093977 "04" 0 1 1040002054 4 153948000 787.195760294191 "04" 1 3 end

  • #2
    The question about calculating the Palma ratio seems to have been answered by Stephen Jenkins in your previous topic at

    https://www.statalist.org/forums/for...equality-index

    which involves installing his sumdist command from SSC
    Code:
    ssc install sumdist
    For your current problem, you need to calculate the Palma ratio in a loop over the various provincecode values. I don't know how to take the weight in your data into account, but in your example data in post #1 it has the same value for every observation in a province, and since you are calculating your statistics separately for each province, perhaps the weight does not matter, and I have ignored it. I have calculated the index at the family level rather than the individual level.
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long FamilyCode byte Familysize long Householdcost double weight str2 provincecode byte(Numberchildren Numberadults)
    1000001172 4  78334098 730.040555625913 "aa" 0 4
    1000001177 6 124493597 730.040555625913 "aa" 0 6
    1000001180 4 115916220 730.040555625913 "aa" 1 3
    1000001181 4  63545000 730.040555625913 "aa" 0 4
    1010001058 2 166503300  480.21485567259 "aa" 0 2
    1010001061 3  69395700  480.21485567259 "aa" 0 3
    1010001062 4 152237000  480.21485567259 "aa" 0 4
    1010001065 4 118378300  480.21485567259 "aa" 0 4
    1010001069 4 236274000  480.21485567259 "aa" 0 4
    1010002155 3 237815600 671.720096486292 "aa" 0 3
    1010002158 4 131921720 671.720096486292 "aa" 1 3
    1010002162 6 133199600 671.720096486292 "aa" 1 5
    1010002165 4 164902380 671.720096486292 "aa" 0 4
    1020001005 2  38355000   1155.402801109 "bb" 0 2
    1020001009 5 111509500   1155.402801109 "bb" 2 3
    1020001011 5  75596500   1155.402801109 "bb" 1 4
    1020001016 3  57215400   1155.402801109 "bb" 0 3
    1020002218 4 144330000 2251.34387864718 "bb" 2 2
    1040001186 3  76261706 1377.38780093977 "bb" 0 3
    1040001189 4  65453510 1377.38780093977 "bb" 2 2
    1040001192 1  20463000 1377.38780093977 "bb" 0 1
    1040001195 3  72476164 1377.38780093977 "bb" 1 2
    1040001196 1  37835000 1377.38780093977 "bb" 0 1
    1040002054 4 153948000 787.195760294191 "bb" 1 3
    end
    
    levelsof provincecode, local(pc)
    foreach province of local pc {
    quietly sumdist Householdcost if provincecode=="`province'", ngp(10)
    display "Province `province' Palma ratio = " r(sh10) / ( r(sh1) + r(sh2) + r(sh3) + r(sh4) )
    }
    Code:
    . levelsof provincecode, local(pc)
    `"aa"' `"bb"'
    
    . foreach province of local pc {
      2. quietly sumdist Householdcost if provincecode=="`province'", ngp(10)
      3. display "Province `province' Palma ratio = " r(sh10) / ( r(sh1) + r(sh2) + r(sh3) + r(sh4) )
      4. }
    Province aa Palma ratio = .4171743
    Province bb Palma ratio = .70192714
    Last edited by William Lisowski; 27 May 2019, 18:44.

    Comment


    • #3
      Hello
      Thank you for your help
      When I execute these commands, the value of palma ratio for the provinces is greater than one! What is the reason?
      (levelsof provincecode, local(pc)
      foreach province of local pc
      {quietly sumdist Householdcost if provincecode=="`province'", ngp(10)
      display "Province `province' Palma ratio = " r(sh10) / ( r(sh1) + r(sh2) + r(sh3) + r(sh4) )})

      Comment


      • #4
        There is no reason to expect the Palma ratio to be either less than or greater than one. In your case, what a Palma ratio greater than 1 is telling you is that the when you add up the householdcost for the 10% of the households with the highest values, that total householdcost is greater than when you add up the householdcost for the 40% of the households with the lowest values.

        Comment

        Working...
        X