Announcement

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

  • Difference in differences error

    Hi all

    I'm looking to work out the difference in effect (time to surgery) between two patient populations (exposed and unexposed groups) and compare between two countries (i.e. difference in differences).

    I have tried using the didregress command below although am getting the error "invalid group specification. None of the groups defined by country is a control.". Not really sure what this means and how to fix it. I have checked that i have fairly good numbers in all four variables below when i cross-tab them.

    didregress (timetosurgeryinhours) (patient_anticoagulant_med), group(country) time(month10)


    any help would be much appreciated

    here is some of my data

    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float timetosurgeryinhours byte patient_anticoagulant_med float(country month10)
     43.90548 0 0 6
     56.73095 0 1 6
     14.90566 0 0 7
     50.74575 0 0 6
    33.193012 0 0 7
    18.767643 0 0 7
     34.22039 0 0 5
     50.06162 0 0 7
    18.023438 0 0 6
     48.51983 0 0 6
    28.820833 0 1 5
     22.56784 0 0 6
     17.54719 0 0 5
     39.43437 0 0 5
     6.062158 0 0 6
     21.13416 0 0 5
     42.54428 0 0 5
    18.128193 0 0 7
    146.48012 0 0 7
    38.038704 0 0 7
     46.28093 0 2 5
     71.67136 0 0 5
     41.37807 0 1 7
     32.78094 0 0 6
      45.8409 0 0 6
    64.999825 0 2 6
     52.75509 0 0 6
     50.60921 0 0 5
     24.00983 0 0 7
     41.07802 0 0 6
     168.0117 0 0 6
    73.433105 0 0 5
    134.03046 0 3 5
    143.10442 0 0 7
     36.26608 0 0 5
     43.87835 0 0 5
    31.392994 0 0 6
      29.4903 0 0 7
    17.899597 0 0 5
     51.33377 0 0 5
      27.9648 0 0 7
    35.343395 0 0 7
    71.253265 0 0 5
    16.164976 0 0 7
     22.49412 0 0 6
      53.4966 0 0 6
    19.040194 0 0 6
     52.83084 0 0 6
    35.370434 0 0 7
    end
    label values patient_anticoagulant_med patient_anticoagulant_med_
    label values country country
    label def country 0 "england", modify
    label def country 1 "scotland", modify
    label def country 2 "wales", modify
    label def country 3 "NI", modify
    ------------------ copy up to and including the previous line ------------------



    . tab country month10

    month10
    country 5 6 7 Total

    0 2,756 2,696 2,587 8,039
    1 402 416 365 1,183
    2 118 111 120 349
    3 105 69 66 240

    Total 3,381 3,292 3,138 9,811


    . tab patient_anticoagulant_med country

    Does
    patient
    take an
    anticoagul
    ant
    medication country
    ? 0 1 2 3 Total

    0 1,503 173 70 52 1,798
    Yes 6,538 1,010 279 188 8,015

    Total 8,041 1,183 349 240 9,813

    Last edited by ahmed farhan; 11 Sep 2023, 16:17.

  • #2
    i appreciate it may be confusing to understand, so here is a basic equation.

    difference between groups between countries = (country1 group A - country 1 group B) - (country group A - country 2 group B)

    i dont have any missing data.

    any advice on model, approach, or stata commands would be hugely appreciated. ive been researching this for days and have not had any luck

    thank you for your time

    Comment

    Working...
    X