Announcement

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

  • Creating continuous categories out of discrete observations.

    Hello
    I am trying to draw a graph where I want to create continuous categories our of the number of days taken to release subisdy for an implement. I want to divide the categories from 0-30 days, 30-60 days, and so on. Can someone help me with generating a new variable to create categories, and count the number of implements for those categories. The data example is below:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str86 implementscheme double number_days
    "Animal Deterrent Bio-Acaustic Equipment-Electric Operated(With Solar Panel) State Plan"    1525
    "Brush Cutter(1 HP & above petrol engine operated) State Plan"                              1967
    "Brush Cutter(Below 3 BHP petrol driven) State Plan"                                         796
    "Cage Wheel(one pair) State Plan"                                                           1364
    "Chaff Cutter Manual State Plan"                                                         2565919
    "Chaff Cutter(Mannual Heavy Duty)-3 Roller, Shuking Type State Plan"                       33070
    "Chaff Cutter(Manual)-2 Roller,Non-Shuking Type State Plan"                               489315
    "Chaff Cutter-Stationary Engine Operated (Upto 2 HP Electrict Motor) State Plan"           23403
    "Chaff Cutter-Stationary Engine Operated(Upto 3-5 HP Electrict Moter) State Plan"          80859
    "Chaff Cutter-Tractor PTO Operated(35 HP & Above) State Plan"                              90143
    "ChainSawForPruning State Plan"                                                               35
    "Combine Harvester(S/P) State Plan"                                                         6140
    "Combine Harvester(T/D) State Plan"                                                          287
    "Combines SMAM"                                                                               28
    "Combines State Plan"                                                                      21318
    "Cultivator(T/D) State Plan"                                                              253159
    "Dibler State Plan"                                                                           71
    "Disc Harrow(T/D) State Plan"                                                             174303
    "Disc Plough State Plan"                                                                      19
    "Folding LDPE Irrigation Pipe NFSM"                                                       105003
    "Folding LDPE Irrigation Pipe State Plan"                                                5245860
    "HDPE Irrigation Pipe BGREI"                                                               41047
    "HDPE Irrigation Pipe NMOOP"                                                                 387
    "HDPE Irrigation Pipe State Plan"                                                          59611
    "HDPE Laminated Woven Layflat Tube BGREI"                                                  23185
    "HDPE Laminated Woven Layflat Tube NFSM"                                                    5422
    "HDPE Laminated Woven Layflat Tube State Plan"                                            238174
    "HDPE Tarpaulin Sheet NFSM"                                                               111826
    "HDPE laminated woven layflat tubes NFSM"                                                   1296
    "HDPE laminated woven layflat tubes State Plan"                                           196142
    "Hydraulic Trailer State Plan"                                                             65264
    "IrrigationPipe NFSM"                                                                      11068
    "IrrigationPipe NMOOP"                                                                     14878
    "IrrigationPipe State Plan"                                                               498712
    "Laser Land Leveller State Plan"                                                            1303
    "Leveller T/D (6 Feet & Above) State Plan"                                                  9764
    "M.B.Plough 2-3 bottom(35 HP & Above) State Plan"                                           5660
    "Manual Plant Protection Equip.(Sprayer/Duster) State Plan"                                 6012
    "Manual Rocker Sprayer(Gator) State Plan"                                                 204528
    "Marker State Plan"                                                                          111
    "Mini Dal Mill State Plan"                                                                    48
    "Mini Rubber Rice Mill BGREI"                                                               1448
    "Mini Rubber Rice Mill State Plan"                                                         20732
    "Mini Rubber Rice Mill(Above 4 Q/hr Output Capacity)-Tractor operated State Plan"          18676
    "Multi Crop Thresher BGREI"                                                                  312
    "Multi Crop Thresher NFSM"                                                                  3522
    "Multi Crop Thresher(Driven by Tractor above 35 BHP) BGREI"                                  107
    "Multi Crop Thresher(Driven by Tractor above 35 BHP) NFSM"                                   183
    "Multi Crop Thresher(Driven by Tractor above 35 BHP) State Plan"                            5847
    "Paddy Thresher BGREI"                                                                       314
    "Paddy Thresher NFSM"                                                                        191
    "Paddy Thresher(Driven by Engine/Electric motor below 5 BHP) State Plan"                      20
    "Paddy Thresher(Driven by Tractor above 35 BHP) BGREI"                                       210
    "Paddy Thresher(Driven by Tractor above 35 BHP) State Plan"                                 8884
    "Paddy Transplanter(S/P) upto 4-row State Plan"                                              100
    "PaddyDrumSeeder BGREI"                                                                       65
    "PaddyDrumSeeder State Plan"                                                               16626
    "PaddyThresherManual State Plan"                                                           34295
    "PaddyThresherPowerOpt6feetDrumSize BGREI"                                                  1737
    "PaddyThresherPowerOpt6feetDrumSize NFSM"                                                    322
    "PaddyThresherPowerOpt6feetDrumSize State Plan"                                           133539
    "PaddyTransplanter BGREI"                                                                   2319
    "PaddyTransplanter NFSM"                                                                     165
    "PaddyTransplanter State Plan"                                                              1107
    "Petrol Engine Pumpset(up to 10 hp) State Plan"                                             2804
    "Potato Digger (Above 35 HP tractor operated) State Plan"                                     67
    "Potato Digger State Plan"                                                                    91
    "Potato Planter State Plan"                                                                10241
    "Potato Planter(Above 35 HP) State Plan"                                                    6151
    "Power Knapsack Sprayer BGREI"                                                             37565
    "Power Knapsack Sprayer NFSM"                                                              22854
    "Power Maize Sheller State Plan"                                                           13573
    "Power Maize Sheller(Electric motor operated) State Plan"                                    248
    "Power Maize Sheller(T/D) State Plan"                                                       3981
    "Power Maize Thresher(T/D) State Plan"                                                      2778
    "Power Operated Multi Crop Thresher(T/D) State Plan"                                        3778
    "Power Operated Wheat Thresher(T/D) State Plan"                                            64729
    "Power Paddy Thresher(6 Feet drum size) State Plan"                                        46158
    "Power Sprayer BGREI"                                                                        604
    "Power Sprayer NFSM"                                                                        3773
    "Power Sprayer NFSM-oilseeds"                                                                 24
    "Power Sprayer State Plan"                                                                593925
    "Power Tiller(8 Hp & Above) State Plan"                                                    54213
    "Power Tiller(Below 8 Hp) State Plan"                                                         66
    "Power tiller BGREI"                                                                         983
    "Power tiller RKVY"                                                                          977
    "Power tiller State Plan"                                                                 262380
    "PowerOperatedEquip(Cultivator) State Plan"                                               535244
    "PowerOperatedEquip(Harrow) State Plan"                                                   249188
    "PowerOpt.Thresher State Plan"                                                            151443
    "PowerWeeder BGREI"                                                                          810
    "PowerWeeder NFSM"                                                                           862
    "PowerWeeder State Plan"                                                                   19933
    "Puddler State Plan"                                                                         144
    "Pump Set(Diesel)Up to 10 HP BGREI"                                                       186095
    "Pump Set(Diesel)Up to 10 HP NFSM"                                                        102011
    "Pump Set(Diesel)Up to 10 HP NFSM-oilseeds"                                                 1142
    "Pump Set(Diesel)Up to 10 HP State Plan"                                                   79445
    "Pump Set(Electric) Up to 10 HP BGREI"                                                    255087
    "Pump Set(Electric) Up to 10 HP NFSM"                                                      12341
    end
    There are few observations which go upto more than 500 days. Is there a way to include those in the graph without making it look too clumsy.

  • #2
    Originally posted by Saini Smriti View Post
    I want to divide the categories from 0-30 days, 30-60 days, and so on.

    There are few observations which go upto more than 500 days.
    More like 500,000 days and up. The manual chaff cutter, alone, has more than a 7,000-year state plan. Now, that's planning! Or am I reading these wrong?

    Anyway, you might want to think about the bucket size a little more. What is it that you're trying to portray, the point you're trying to make about the distribution of subsidy-release duration?

    Comment


    • #3
      Hi Joseph

      My bad! The date example I posted had the days summed from collapse command. Original data example is below.
      What I am trying to do is create categories of days 0-30 etc and graph out the number of implements which were subsidised during that time period or the number of farmers who availed that subsidy. The dataset has 40,000 observations. Say, 1000 farmers availed the subsidy amount on implementscheme during 0-30 days or more than that. Does this make sense?

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input str77 farmersname str86 implementscheme float date_diff
      "AJAJ"                               "PumpSet State Plan"                             97
      "IRFAN"                              "PumpSet State Plan"                             73
      "MANTI DEVI"                         "PumpSet NFSM"                                   37
      "MD LATIF"                           "PumpSet State Plan"                             16
      "MD. JABIR"                          "PumpSet State Plan"                             73
      "Parvez Alam"                        "Rotavator State Plan"                           91
      "PARWEZ"                             "Folding LDPE Irrigation Pipe State Plan"        30
      "Punyanand Singh"                    "IrrigationPipe NFSM"                            96
      end
      Could you help me with the variable generation? and the plotting?

      Comment


      • #4
        I don't know. Maybe something like
        Code:
        generate int bucket = date_diff == 0
        forvalues days = 0(30)<whatever> {
            quietly replace bucket = bucket + 1 if date_diff > `days' & !mi(date_diff)
        }
        contract bucket, freq(count)
        graph twoway line count bucket, sort <etc.>
        Presumably, you'll choose <whatever> to be shorter than 500 days, and so the last bucket will contain the remainder, which might look okay for the point the you're trying to drive across.

        Have you considered histogram? There might be others, too, including user-written graphics commands that give you what you're looking for.

        Comment


        • #5
          Hi Joseph

          I figured out the problem by choosing histogram.

          Comment

          Working...
          X