Announcement

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

  • Trouble with Dummy Variables

    Hi,

    I currently have data on recycling rates for different local authorities in the UK and would like to control for the method and frequency of collection. I currently have a set of dummy variables for method, that take the value 1 if that local authority takes that method of collection and zero if they do not, where there are 30 methods. I also have a set of dummy variables that take the value 1 if the local authority uses that method of collection and the frequency of collection is longer than once a week, zero if the frequency is weekly or more, and missing if the local authority does not use that method of collection.

    What is the best way to build my regression and control for these factors. Ideally i want a coefficient for each method and a coefficient for frequency, which tells us the effect of frequency of the method being longer than once a week, even though not every Local authority takes each method.

    Thank You

    Darcy Hill

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str43 name float(dummyfrequency11 dummyfrequency12 dummyfrequency13) long(methoddummy11 methoddummy12 methoddummy13)
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Adur District Council"        0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Allerdale Borough Council"    0 0 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Amber Valley Borough Council" 1 1 . 1 1 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Arun District Council"        . . . 0 0 0
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 1 1 1 1
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 1 1 1 1
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 1 1 1 1
    "Ashfield District Council"    1 1 1 1 1 1
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 . 1 1 0
    "Ashfield District Council"    1 1 . 1 1 0
    end

  • #2
    For purposes of inclusion in a regression analysis (and for most other purpose) a "dummy" variable that conveys information through the use of missing values is useless. I think for your purpose you need to build 30 new variables (one for each method). The variable would take on value 0 if the authority does not use that method at all, 1 if it uses the method at most once a week, and 2 if it uses the method more than once a week. So something like:

    Code:
    forvalues i = 11/13 {
        gen byte utilization`i' = 0 if methoddummy`i' == 0
        replace utilization`i' = 1 if methoddummy`i' == 1 & dummyfrequency`i' == 0
        replace utilization`i' = 2 if methoddummy`i' == 1 & dummyfrequency`i' == 1
    }
    Then when you do your regression, you can regress them against i.(utilization*). [If you are not familiar with factor variable notation, read -help fvvarlist- to understand what this means and how it works.]

    Now, this will give you separate estimate of the effects of each method when used at most once a week and when used more than once a week.

    Comment


    • #3
      Thanks Clyde, this looks great. So just to confirm if I do this what is the intuition behind my methoddummy coefficient or do I not need to include it at all anymore if I use 'utilization'?

      Comment


      • #4
        Use utilization only. It incorporates the methoddumy coefficient's information, as well as that of the frequency variables. The methoddummy and dummyfrequency variables you started with are not needed now.

        Comment

        Working...
        X