Announcement

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

  • Plotting the decomposition of differences in distribution

    Hi everybody

    ​​​​​​I am a graduate student writing my master thesis on the topic of " welfare differential between rural and urban Areas". I am trying to decompose the gape between urban and rural areas using Oaxaca and blinder decomposition at first and then a quintile regression based decomposition following Machado( I use cdeco command ) .

    ​​​​​However, my question is, after counterfactual regression is done the paper I am following have plotted the decomposition of differences in distribution as the image I have attached in this post. I have no idea how to do this graph. Could not find online any code to use . I am also new in stata . Please help!
    Attached Files
    Last edited by Kassim Ibiro; 25 Oct 2019, 10:23.

  • #2
    Dear Kassim,

    You best visit the website of the author, and in particular the page where materials are published related to the cdeco command (counterfactual decomposition of differences in distributions).
    Beside instructions how to install directly, you can (and should now) also download the CDECO zip file, located on that page.
    Next, unzip the example_cdeco.do file and load it into your Do-file editor. To get your example, run this code:
    Code:
    *Setup
    webuse nlsw88, clear
    gen lwage=log(wage)
    *Inference
    *To avoid overloading the screen, we do not print the results of the decomposition but only the tests
    cdeco lwage tenure ttl_exp grade, group(union) method(logit) quantiles(0.01(0.01)0.99) noprintdeco
    *The results of the decomposition can be found in the matrices returned by cdeco
    ereturn list
    *First all elements of the decomposition
    mat tot=e(total_difference)
    mat char=e(characteristics)
    mat coef=e(coefficients)
    mat quant=e(quantiles)
    svmat tot 
    svmat char 
    svmat coef
    svmat quant
    *We plot the results
    twoway (line tot1 quant1) (line char1 quant1) (line coef1 quant1), ytitle(Quantile Effect) xtitle(Quantile) legend(order(1 "Total difference" 2 "Effects of characteristics" 3 "Effects of coefficients"))
    graph export "ExampleCDECOdecomposition.png", width(600) height(400) replace // Change path as required
    The result should look like:
    Click image for larger version

Name:	ExampleCDECOdecomposition.png
Views:	1
Size:	137.7 KB
ID:	1522095

    I assume you can work further on the code yourself with your own data.
    http://publicationslist.org/eric.melse

    Comment


    • #3
      Dear Ericmelse,

      Thank you very much. I will work this very soon and will get back to you if I encounter any difficulty to implement your code. I appreciate your help. Again, thank you very much.

      Comment

      Working...
      X