Announcement

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

  • Trying to maked Food insecurity index with Normalized method

    Hello, I am encountering an issue with my analysis and would appreciate some help. Here is a sample of my dataset generated using the `dataex` command:
    Code:
    Code:
    keep if province==2
    drop if c01 == 98 | c01 == 99
    drop if c02 == 98 | c02 == 99
    drop if c03 == 98 | c03 == 99
    drop if c04 == 98 | c04 == 99
    drop if c05 == 98 | c05 == 99
    drop if c06 == 98 | c06 == 99
    drop if c07 == 98 | c07 == 99
    drop if c08 == 98 | c08 == 99
    recode c01 (1=1 "1") (2=0 "0"), generate(binary_c01)
    recode c02 (1=1 "1") (2=0 "0"), generate(binary_c02)
    recode c03 (1=1 "1") (2=0 "0"), generate(binary_c03)
    recode c04 (1=1 "1") (2=0 "0"), generate(binary_c04)
    recode c05 (1=1 "1") (2=0 "0"), generate(binary_c05)
    recode c06 (1=1 "1") (2=0 "0"), generate(binary_c06)
    recode c07 (1=1 "1") (2=0 "0"), generate(binary_c07)
    recode c08 (1=1 "1") (2=0 "0"), generate(binary_c08)
    egen total_sum = rowtotal ( binary_c01 binary_c02 binary_c03 binary_c04 binary_c05 binary_c06 binary_c07 binary_c08)
    gen new_variable = total_sum / 8
    collapse (mean) new_variable , by(district)
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int district float new_variable
    201 .071822405
    202 .23362786
    203 .25410727
    204 .18933824
    205 .13278517
    206 .12393823
    207 .20965692
    208 .07747596
    209 .11210724
    210 .0438087
    211 .10324302
    212 .08202247
    213 .1757874
    214 .1905099
    215 .25977466
    216 .24156584
    217 .13207187
    218 .17132325
    219 .20212767
    220 .20722397
    221 .09185022
    222 .13728632
    223 .16487886
    224 .2227503
    225 .1102415
    226 .1215731
    227 .06865241
    228 .12343162
    229 .19244234
    230 .17709924
    231 .09437067
    232 .11702532
    233 .169588
    234 .16614604
    235 .09290158
    236 .13475722
    237 .14879823
    end
    label values district district
    label def district 201 "attock", modify
    label def district 202 "bahawalnagar", modify
    label def district 203 "bahawalpur", modify
    label def district 204 "bhakhar", modify
    label def district 205 "chakwal", modify
    label def district 206 "chiniot", modify
    label def district 207 "d. g. khan", modify
    label def district 208 "faisalabad", modify
    label def district 209 "gujranwala", modify
    label def district 210 "gujrat", modify
    label def district 211 "hafizabad", modify
    label def district 212 "islamabad", modify
    label def district 213 "jehlum", modify
    label def district 214 "jhang", modify
    label def district 215 "kasur", modify
    label def district 216 "khanewal", modify
    label def district 217 "khushab", modify
    label def district 218 "lahore", modify
    label def district 219 "layyah", modify
    label def district 220 "lodhran", modify
    label def district 221 "mandi bahauddin", modify
    label def district 222 "mianwali", modify
    label def district 223 "multan", modify
    label def district 224 "muzaffar garh", modify
    label def district 225 "nankana sahib", modify
    label def district 226 "narowal", modify
    label def district 227 "okara", modify
    label def district 228 "pakpattan", modify
    label def district 229 "rahim yar khan", modify
    label def district 230 "rajanpur", modify
    label def district 231 "rawalpindi", modify
    label def district 232 "sahiwal", modify
    label def district 233 "sargodha", modify
    label def district 234 "sheikhupura", modify
    label def district 235 "sialkot", modify
    label def district 236 "t.t. singh", modify
    label def district 237 "vehari", modify
    ------------------ copy up to and including the previous line ------------------

    Listed 37 out of 37 observations

    then I saved the resulting data into excel form and added an Extra Column of Population into that data then, I imported that data to Stata for further Normalizing the dataset.
    Code:
    gen aggregate_population = R_Sum * Population
    **Normalized R_Sum**
    egen R_Sum_min = min(R_Sum)
    egen R_Sum_max = max(R_Sum)
    gen R_Sum_normalized = (R_Sum - R_Sum_min) / (R_Sum_max - R_Sum_min)
    **Normalized aggregate_population**
    egen aggregate_population_min = min(aggregate_population)
    egen aggregate_population_max = max(aggregate_population)
    gen aggregate_population_normalized = (aggregate_population - aggregate_population_min) / (aggregate_population_max - aggregate_population_min)
    **Listing**
    list district R_Sum aggregate_population R_Sum_normalized aggregate_population_normalized
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str8 district double R_Sum int Population float(aggregate_population R_Sum_min R_Sum_max R_Sum_normalized aggregate_population_min aggregate_population_max aggregate_population_normalized)
    "attock" .0718224 8302 596.2696 .0438087 .2597747 .12971348 470.7683 5056.778 .02736612
    "bahawaln" .2336279 14150 3305.835 .0438087 .2597747 .8789309 470.7683 5056.778 .6181989
    "bahawalp" .2541073 17744 4508.88 .0438087 .2597747 .9737579 470.7683 5056.778 .8805283
    "bhakhar" .1893382 8432 1596.4998 .0438087 .2597747 .6738537 470.7683 5056.778 .24547078
    "chakwal" .1327852 6886 914.3589 .0438087 .2597747 .4119931 470.7683 5056.778 .09672692
    "chiniot" .1239382 6931 859.0157 .0438087 .2597747 .3710283 470.7683 5056.778 .08465908
    "d. g. kh" .2096569 9365 1963.437 .0438087 .2597747 .7679366 470.7683 5056.778 .32548305
    "faisalab" .077476 26226 2031.8856 .0438087 .2597747 .15589166 470.7683 5056.778 .3404086
    "gujranwa" .1121072 17293 1938.6698 .0438087 .2597747 .3162465 470.7683 5056.778 .3200825
    "gujrat" .0438087 10746 470.7683 .0438087 .2597747 6.231653e-09 470.7683 5056.778 0
    "hafizaba" .103243 6839 706.0789 .0438087 .2597747 .2752021 470.7683 5056.778 .05131052
    "islamaba" .0820225 6569 538.8058 .0438087 .2597747 .1769436 470.7683 5056.778 .014835883
    "jehlum" .1757874 6654 1169.6893 .0438087 .2597747 .6111087 470.7683 5056.778 .15240286
    "jhang" .1905099 12185 2321.363 .0438087 .2597747 .6792791 470.7683 5056.778 .40353045
    "kasur" .2597747 13231 3437.079 .0438087 .2597747 .9999999 470.7683 5056.778 .6468173
    "khanewal" .2415658 12106 2924.3955 .0438087 .2597747 .9156862 470.7683 5056.778 .5350244
    "khushab" .1320719 7183 948.6725 .0438087 .2597747 .4086902 470.7683 5056.778 .10420915
    "lahore" .1713233 29516 5056.778 .0438087 .2597747 .59043825 470.7683 5056.778 1
    "layyah" .2021277 3820 772.1278 .0438087 .2597747 .7330737 470.7683 5056.778 .065712795
    "lodhran" .207224 6879 1425.494 .0438087 .2597747 .7566714 470.7683 5056.778 .2081822
    "mandi ba" .0918502 6069 557.43884 .0438087 .2597747 .22244936 470.7683 5056.778 .018898904
    "mianwali" .1372863 6627 909.7963 .0438087 .2597747 .4328348 470.7683 5056.778 .09573203
    "multan" .1648789 18966 3127.093 .0438087 .2597747 .5605984 470.7683 5056.778 .5792235
    "muzaffar" .2227503 16937 3772.722 .0438087 .2597747 .8285637 470.7683 5056.778 .7200058
    "nankana" .1102415 5554 612.2813 .0438087 .2597747 .30760765 470.7683 5056.778 .03085755
    "narowal" .1215731 9348 1136.4653 .0438087 .2597747 .360077 470.7683 5056.778 .14515822
    "okara" .0686524 7877 540.77496 .0438087 .2597747 .11503524 470.7683 5056.778 .01526527
    "pakpatta" .1234316 8399 1036.702 .0438087 .2597747 .3686826 470.7683 5056.778 .12340438
    "rahim ya" .1924423 15179 2921.082 .0438087 .2597747 .6882268 470.7683 5056.778 .5343018
    "rajanpur" .1770992 7805 1382.2593 .0438087 .2597747 .6171827 470.7683 5056.778 .1987547
    "rawalpin" .0943707 22208 2095.7844 .0438087 .2597747 .23412018 470.7683 5056.778 .354342
    "sahiwal" .1170253 10219 1195.8816 .0438087 .2597747 .3390191 470.7683 5056.778 .1581142
    "sargodha" .169588 15512 2630.649 .0438087 .2597747 .5824032 470.7683 5056.778 .4709717
    "sheikhup" .166146 13203 2193.6257 .0438087 .2597747 .5664655 470.7683 5056.778 .3756768
    "sialkot" .0929016 10428 968.7779 .0438087 .2597747 .2273177 470.7683 5056.778 .10859323
    "t.t. sin" .1347572 9130 1230.3333 .0438087 .2597747 .4211241 470.7683 5056.778 .16562654
    "vehari" .1487982 8818 1312.1025 .0438087 .2597747 .486139 470.7683 5056.778 .1834567
    end
    ------------------ copy up to and including the previous line ------------------

    Listed 37 out of 37 observations
    The code runs without errors, and I observe the following:
    • One district has a normalized aggregate population value of 1.
    • One district has a normalized aggregate population value of 0.
    • The remaining districts have values between 0 and 1 after normalization.
    I understand that normalization should result in values between 0 and 1, but here one district is exactly "1" and the other is exactly "0", also I want to confirm if this is the correct approach for normalizing aggregate population values.

    Any advice or improvements to my approach would be greatly appreciated.

    Thank you for your assistance
    .
    Last edited by aafaque ali; 16 Jul 2024, 08:23.

  • #2
    Code:
    gen aggregate_population_normalized = (aggregate_population - aggregate_population_min) / (aggregate_population_max - aggregate_population_min)
    All that has to happen is that the numerator is 0, which is a certainty for at least one country.

    Comment


    • #3
      George Ford that means there is no problem in estimation? and how can we defend this?

      Comment


      • #4
        the calculation is correct. nothing to defend.

        Comment


        • #5
          how can we interpret this, according to the results (Gujrat District has no/0 Food insecurity, whereas Lahore has 1 or more food insecurity compared to other districts) or there may be other reasons?
          also if we use the Z Score method instead of the Normalized method in the above results we get the value of two districts greater than 2 is this possible?

          Comment


          • #6
            It's not clear to me why you are normalizing population.

            A standardized variables with have mean = 0, sd = 1. so yes, values could exceed 2, and will represent more extreme values (roughly the 2.5% tails on each side).

            Comment


            • #7
              i think it is not possible to get normalized values(food insc index) without normalizing the population? or if there is any other way to do so please need your assistance.

              Comment


              • #8
                I got no idea what you are up, other than trying to normalize something.

                There's nothing wrong with the way you normalized. A positive/negative sign on the normalized pop is informative.

                Comment


                • #9
                  Actually I m trying to make Index (food insecurity index) and i think that can be made by either Normalizing or Z score.

                  Comment


                  • #10
                    what variables make up the food insecurity index?

                    Comment


                    • #11
                      the eight questions (c01-c08) represent the food insecurity from which I have made thee food ins index.

                      Comment


                      • #12
                        Why not use factor analysis? polychoric is required if c* are categorical/dichotomous. there are examples in the help file.

                        Comment


                        • #13
                          I have also used factor analysis, but I encountered an issue where one district had a factor score of exactly '1' while another district had a factor score of exactly '0'.

                          Comment


                          • #14
                            what's the type of the variables? dummy/categorical/continuous?

                            missing values?

                            if dichotomous, are all 0 or all 1?

                            did you predict "bartlett"?

                            Comment


                            • #15
                              The data Is Binary (0,1), but i think Bartlett's test of sphericity is automatically performed with the factor command

                              Comment

                              Working...
                              X