Announcement

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

  • Panel Data Autocorrelation and Estimator Choice

    I am trying to understand this paper by David McKenzie. One of the themes in the paper is how level of autocorrelation influences the choice between Difference-in-Differences, ANCOVA, and simple treatment-control post comparison in the context of an experiment on panel data.

    Under the simplifying assumption that the autocorrelation between all points in time is constant (cov(e_t, e_t-1) =cov(e_t, e_t-k) = rho for all k) and the disturbances are homoscedastic, there are some formulas that give the variance of the three estimators as function of the sample size, the number of pre and post periods, the sample sizes, and rho. David also gives some examples from his own work about what kinds of autocorrelation he has come across for various types of data from blood pressure to firm profits and test scores.

    It is not clear to me how to test this assumption with my own data. What would be the Stata command that could allow me to get a plot like this and to test that rho is constant and is the same in treatment and control groups:

    Click image for larger version

Name:	Screen Shot 2019-05-03 at 6.42.43 PM.png
Views:	1
Size:	72.7 KB
ID:	1496568


  • #2
    You didn't get a quick answer. You'll increase your chances of a useful answer by following the FAQ on asking questions.

    You can certainly estimate autocorrelation models on parts of your data. I would look at the time series analysis documentation - this seems like the kind of problem that would handle.

    Comment


    • #3
      Phil Bromiley If you have concrete suggestions on how to improve this question, I am all ears. I have definitely read the FAQ.

      I have also perused the ts documtation, but unless I am missing something commands like -corrgram- do not work on panel data.

      Comment


      • #4
        David McKenzie was kind enough to explain some of the details. Here's a toy example on the pig weights dataset:

        Code:
        webuse pig, clear
        xtset id week
        gen treated = mod(id,2)==1
        sort id week
        xtdes
        
        corr weight F(1/8).weight if treated==0
        corr weight F(1/8).weight if treated==1
        
        reshape wide weight, i(id t) j(week)
        bys treated: corr weight*
        
        gen lag    = .
        gen c_corr = .
        gen c_lb   = .
        gen c_ub   = .
        gen t_corr = .
        gen t_lb   = .
        gen t_ub   = .
        
        local i    = 1 
        
        forvalues v=2/9 {
            replace lag  = `v' in `i'
            
            ci2 weight1 weight`v' if treated==0, corr
            replace c_corr    = r(rho) in `i'
            replace c_lb    = r(lb)  in `i'
            replace c_ub     = r(ub)  in `i'
            
            ci2 weight1 weight`v' if treated==1, corr
            replace t_corr    = r(rho) in `i'
            replace t_lb    = r(lb)  in `i'
            replace t_ub     = r(ub)  in `i'
            
            local ++i
        }
        
        tw ///
        (connected c_corr lag, mcolor(maroon) lcolor(maroon)) (rcap c_lb c_ub lag, lcolor(maroon)) ///
        (connected t_corr lag, mcolor(navy) lcolor(navy)) (rcap t_lb t_ub lag, lcolor(navy)) ///
        , legend(label(1 "Control") label(3 "Treatment") order(1 3)) ///
        xlabel(#9, grid) ylabel(, angle(0) grid) xtitle("Weeks Between Measurements") ///
        plotregion(fcolor(white)) graphregion(fcolor(white)) ///
        ytitle("Autocorrelation") title("Pig Weight Autocorrelation")
        
        list lag c_corr t_corr c_lb-t_ub if !missing(lag), clean noobs
        The graph comes out like this:

        Click image for larger version

Name:	Screen Shot 2019-05-14 at 4.39.57 PM.png
Views:	1
Size:	122.9 KB
ID:	1498371

        Comment

        Working...
        X