TSSlade/unesco_equity

graph with differences

mavzunat opened this issue · 5 comments

Hello, @TSSlade @lcrouch1952

This is an old issue I mentioned in the email. I am moving it here for the sake of consistency. Plus, I didn't hear back.

I noticed I missed creating one of the graphs in the paper, particularly the one page 25. It turned out to be more involved than the rest of the graphs. I had to run a quantile regression on the differences. The slope of the fitted lines in the paper appears to be steeper than what I show. I think it has to do with how I specified the regression model. Please take a look at the code on GitHub

Please see the graph here: https://www.dropbox.com/home/dukeInternInequalityOutputs/Mavzuna?preview=CS20-mt-S03-V01-qreg_diff_lfit.png

Thanks for pointing that out, @mavzunat , and apologies for not responding sooner. @lcrouch1952 - do you happen to have the regression line you specified for this graph readily accessible so we can compare with what Mavzuna generated?

@mavzunat - please confirm that the code you used to generate the regression model is the below, taken from lines 257-266 of the quantile_regressions.do file

 gen mean_diff_squared = mean_diff^2
    foreach n of num 15 85 {
        qreg gini_diff mean_diff mean_diff_squared, quantile(0.`n')
        matrix diff_qreg`n' = r(table)
        scalar diff_qreg_coeff`n' = diff_qreg`n'[1,1]
        scalar diff_qreg_coeff`n'_squared = diff_qreg`n'[1,2]
        scalar diff_qreg_coeff`n'_int = diff_qreg`n'[1,3]

        gen diff_line_at_`n' = diff_qreg_coeff`n'_int + (mean_diff * diff_qreg_coeff`n') + (mean_diff_squared * diff_qreg_coeff`n'_squared)
    }

Also, it's tough to infer from the code what the actual slope of the line wound up being - did you store that someplace, and could you add that in a comment here?

(Looks like I should have referred to the above as I did below, using the instructions in this link...) @ColeCampton, FYI, since you wouldn't otherwise be notified about goings-on in this thread.

**** Quantile regression using differences
gen mean_diff_squared = mean_diff^2
foreach n of num 15 85 {
qreg gini_diff mean_diff mean_diff_squared, quantile(0.`n')
matrix diff_qreg`n' = r(table)
scalar diff_qreg_coeff`n' = diff_qreg`n'[1,1]
scalar diff_qreg_coeff`n'_squared = diff_qreg`n'[1,2]
scalar diff_qreg_coeff`n'_int = diff_qreg`n'[1,3]
gen diff_line_at_`n' = diff_qreg_coeff`n'_int + (mean_diff * diff_qreg_coeff`n') + (mean_diff_squared * diff_qreg_coeff`n'_squared)
}

Yes. I confirm.

I have a stata output for the regressions, which I have been trying to attach here for the past 10 mins. Attach button is just not working for me. I have Windows 10 on my desktop. Could that be the case that it is too old for all GitHub functionality?

Please see an appropriately generated link to the regression file instead.
https://www.dropbox.com/s/ryzuyd8lf55v2ro/CS20-mt-S03_V01-qreg_diff.pdf?dl=0

Not sure what you mean about not being able to attach output, @mavzunat - do you want to attempt a screenshare?
Note also that this was one of the reasons I was recommending the use of the dyndoc-based literate programming approach to sharing analyses: since the result of that workflow is an HTML file, it can easily be rendered/shared via GitHub and other similar platforms.

Not sure what you mean about not being able to attach output, @mavzunat - do you want to attempt a screenshare?
Note also that this was one of the reasons I was recommending the use of the dyndoc-based literate programming approach to sharing analyses: since the result of that workflow is an HTML file, it can easily be rendered/shared via GitHub and other similar platforms.

I figured this out. I just needed to open github in Chrome instead of Explorer. Whenever I click on the link through my Outlook it automatically opens it in the Explorer. I am sure there is a setting I can change... But it works now!