Announcement

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

  • Two way plot with RD design

    Hi,

    I am running an RDD regression with covariates and clustered standard errors using rdrobust package in Stata/SE 16.1. I wanted to plot the RD estimates using confidence intervals as lines. I have tried reproducing the rdplot using a twoway graph and it works well. I am trying to restrict the yscale for better visualization of the plot, but none of the usual options work. Any help will be much appreciated!

    Code to reproduce the graph:
    Code:
    rdrobust y x, c(0) vce(cluster cluster_id) covs(yr1-yr9)  
    
    local bw=e(h_l)
    local doublebw=(e(h_l)*2)
    local halfbw=(e(h_l)/2)
    local cct_n = e(N_h_l)+e(N_h_r)
    
    rdplot y x if inrange(x, -`bw',`bw'), c(0) kernel(triangular) genvars nbins(20 20) covs(yr1-yr9) vce(cluster cluster_id) p(1) hide  
    
    tw (scatter rdplot_mean_y rdplot_mean_x ) ///    
    (lfitci y x if x < 0 & inrange(x, -`bw', `bw') , ciplot(rline)) ///    
    (lfitci y x if  x>= 0 & inrange(x, -`bw', `bw'), ciplot(rline)), ///  
     xline(0)
    Last edited by abhinav khemka; 04 Mar 2024, 09:24.

  • #2
    Cross-posted on Stack Overflow at https://stackoverflow.com/questions/...esign-in-stata

    Here is what I said there

    That's not code to reproduce the graph without the variables concerned. I can't see what code you are trying to restrict the yscale, but it's documented that ysc() never reduces what is shown; at most it extends the axis. What you're talking about seems to mean chopping some of what Stata would show and that's not trivial without extensive coding. It's usually a bad idea statistically too. I am guessing because your post doesn't constitute a precise problem yet. Sorry if that is disappointing
    Please note our longstanding request that you tell us about cross-posting. https://www.statalist.org/forums/help#crossposting

    EDIT: Stack Overflow version now deleted.
    Last edited by Nick Cox; 04 Mar 2024, 10:28.

    Comment

    Working...
    X