Announcement

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

  • Rotating Panel Dataset Using Multi-period Difference in Difference Regression

    Hi, thank you for coming here help me. My question is about how to run STATA code on a rotating panel dataset using multi-period Difference in Difference method.

    The dataset contains survey which is a rotating panel survey. Approximately 10,000 addresses are contacted each calendar quarter. One-fourth of the addresses that are contacted each quarter are new to the survey. After a housing unit has been in the sample for four consecutive quarters, it is dropped from the survey, and a new address is selected to replace it.
    The treatment is a law change that happened in states level during different time.

    Let's say 3 states (state 1, 2, and 3) changed the law on 2008 Q1, 2010 Q2, and 2013 Q4. The dataset contains figures from 55 states. Time variable is "qyear", where 20101 means 2010Q1. "id" is unique for each family. The outcome variable is "Y", and the other control variable is "X".
    The regression model should be: Y_it=beta_0+beta_1*Treat_it+beta*X+mu_i, where mu_i is individual fixed effect.

    The example is like the following (since it is a long format data, I also include the whole dataset as the attachment):
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(qyear id) str2 state double(Y X)
    20101 199554 "39"   0 64
    20101 199556 "51"   0 63
    20101 199559 "08"   0 31
    20101 199560 "12"   0 87
    20101 199561 "34"   0 43
    20101 199565 "01"   0 73
    20101 199568 "36"   0 42
    20101 199570 "09"   0 40
    20101 199571 "42"   0 46
    20101 199572 "36"   0 75
    20101 199573 "16"   0 49
    20101 199574 "55"  60 33
    20101 199577 "17"   0 57
    20101 199578 "39"   0 79
    20101 199579 "26"   0 28
    20101 199580 "22"   0 70
    20101 199582 "51"   0 81
    20101 199584 "12"   0 46
    20101 199587 "51"   0 53
    20101 199588 "17"   0 67
    20101 199589 "51"   0 87
    20101 199590 "51"   0 56
    20101 199591 "36"   0 48
    20101 199592 "06"   0 39
    20101 199593 "12"   0 53
    20101 199595 "21"   0 68
    20101 199596 "48"   0 74
    20101 199597 "06"   0 33
    20101 199598 "47"   0 36
    20101 199599 "26"   0 43
    20101 199600 "06"   0 53
    20101 199602 "48"   0 54
    20101 199603 "25"   0 45
    20101 199604 "48"   0 42
    20101 199605 "02"   0 28
    20101 199608 "29"   0 55
    20101 199611 "34"   0 43
    20101 199613 "21"   0 49
    20101 199614 "01"   0 72
    20101 199617 "06"   0 59
    20101 199619 "36"   0 87
    20101 199620 "55" 145 59
    20101 199621 "06"   0 47
    20101 199622 "08"   0 50
    20101 199623 "36"   0 41
    20101 199624 "34"   0 52
    20101 199625 "41"  30 55
    20101 199626 "02"   0 30
    20101 199630 "04" 120 52
    20101 199634 "06"   0 63
    20101 199638 "32"   0 65
    20101 199639 "25"   0 49
    20101 199643 "48"   0 36
    20101 199644 "12"   0 30
    20101 199645 "09"   0 62
    20101 199646 "45"   0 78
    20101 199649 "06"   0 54
    20101 199650 "06"   0 62
    20101 199652 "53"   0 77
    20101 199655 "31" 900 33
    20101 199656 "51"   0 57
    20101 199657 "41"   0 78
    20101 199658 "45"   0 42
    20101 199660 "27"   0 53
    20101 199661 "17"   0 29
    20101 199662 "26"   0 74
    20101 199663 "06"  60 24
    20101 199664 "39"  30 63
    20101 199667 "41"   0 50
    20101 199670 "36"   0 65
    20101 199671 "41"   0 68
    20101 199675 "06"   0 35
    20101 199676 "22"   0 31
    20101 199677 "26"   0 56
    20101 199679 "48"   0 62
    20101 199680 "15"  30 43
    20101 199681 "34"   0 36
    20101 199683 "42"   0 82
    20101 199684 "42"   0 66
    20101 199686 "42"   0 60
    20101 199691 "18"   0 29
    20101 199693 "42"   0 74
    20101 199695 "06"   0 81
    20101 199696 "39"   0 58
    20101 199698 "39"   0 28
    20101 199699 "36"   0 41
    20101 199700 "17" 225 63
    20101 199702 "06"   0 58
    20101 199703 "16"   0 56
    20101 199704 "51"  90 48
    20101 199705 "06"   0 76
    20101 199709 "06"   0 57
    20101 199710 "34"   0 47
    20101 199714 "06"   0 38
    20101 199716 "55"   0 87
    20101 199717 "48"   0 37
    20101 199722 "17"   0 80
    20101 199723 "26"  30 46
    20101 199724 "17"   0 74
    20101 199725 "01"   0 44
    end

    I want to use STATA code -reghdfe- to run a Time-varying DiD regression. But I am not sure if the code is just the same for rotating panel data. I would appreciate help from you.

    Best regards,
    SL.
    Attached Files

  • #2
    Sorry, I just found my dataset contains some duplicates and unbalanced problem. Please ignore the post. Thank you.

    Comment

    Working...
    X