Announcement

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

  • plotting unconditional quantile graph using xtrifreg

    I have some difficulty in plotting unconditional quantile graph using xtrifreg

    I found an example for rifreg here (http://faculty.arts.ubc.ca/nfortin/g...ifreg_coef1.do) but when I simply changed rifreg to xtrifreg, the code does not work.
    I got an error "new variables cannot be uniquely named or already defined" at line " svmat double B, name(coef)".
    If possible, I would like to also incorporate 95% CI (something like lfitci) on the graph

    Code:
     set more off
    save tempcf, replace emptyok  
    
    forvalues q = 0.1(0.1)0.9 {
      use graph, clear
      quietly xtrifreg depvar lag_depvar indepvar time_dummy_list [aweight = matching_weights], quantile(`q') fe i(id)
      matrix B=e(b)
      svmat double B, name(coef)
      gen quant=`q'
      keep quant coef*
      keep if _n==1  
      append using tempcf 
      save tempcf, replace
     }
     
    
    use tempcf, clear
    sort quant
    label var quant "Quantile"
    *** choose the coefficient(s) that you want to graph, here coef2 is the coefficient of interest 
    graph twoway (connected coef2 quant if quant>0.0 & quant<1.0  ) /*
       */, xlabel(0.0 0.2 0.4 0.6 0.8 1.0) title("indepvar") ytitle(" ") /*
       */  yline(0.0, lw(thin) lc(black)) saving(quantile_graph,replace)
    
    graph export quantile_graph.wmf, replace

Working...
X