*** District courts, terminations, and opinions
*** Study for:  
*** USING COURT RECORDS FOR RESEARCH, TEACHING, AND POLICYMAKING:  
*** THE CIVIL RIGHTS LITIGATION CLEARINGHOUSE
*** Margo Schlanger
*** Date: 9/10/2006


*** FIRST, CREATE SUMMARY FILE 

clear

set mem 50m

cd "H:\Articles-Projects\Court Records\Opinion and termination study\"

use "westlaw3.dta", clear

gen published = 0
replace published = 1 if reported == "F.Supp.2d"
replace published = 1 if reported == "B.R."
replace published = 1 if reported == "F.R.D."
replace published = 1 if reported == "Guam"
replace published = 1 if reported == "Vet.App."

drop if fiscal_y ~= 2004

drop original - origina2 date fiscal_y publishe reported

collapse (sum) published (count) opinions=published, by (district)

merge district using "H:\Articles-Projects\Court Records\Opinion and termination study\districtdata.dta", unique sort

drop if district == "Bkrtcy.D.N.J."
drop if district == "Bkrtcy.E.D.Va."
drop if district == "Bkrtcy.S.D.N.Y."

*** NOW THE ANALYSIS

gen op_pct = opinions/terminat
gen unpub = opinions - published
gen pub_pct = published/opinions

label variable published "Officially published opinions"
label variable opinions "Opinions in Westlaw"
label variable civil "Civil terminations"
label variable criminal "Criminal terminations"
label variable terminat "All civil and criminal terminations"
label variable pub_pct "published opinions, percentage of all opinions"
label variable op_pct "all opinions, percentage of terminations"

drop if district == "CIT" | district == "Guam Terr." 
drop if district == "Jud.Pan.Mult.Lit." | district == "Terr.V.I." | district == "Vet.App." 

drop _merge

histogram op_pct, width(.05) start(0) frequency /*
       */ fcolor(gs5) lcolor(none) lwidth(none) /*
       */ addlabels addlabopts(mlabsize(medium)) /*
       */ ytitle("Number of districts" " ", size(large)) /*
       */ xtitle(" " "Opinions as proportion of all terminations", size(large)) /*
       */ scheme(s1mono) graphregion(fcolor(none) ifcolor(none))

graph save opinions_pct_terminations, replace				
graph export opinions_pct_terminations.emf, fontface("Times New Roman") replace

*** HOW IMPORTANT ARE THE OUTLIERS

egen total_op = total(opinions)
egen total_term = total(terminat)

sort op_pct

gen op_cont = opinions/total_op
gen term_cont = terminat/total_term
gen op_cum = sum(op_cont)
gen term_cum = sum(term_cont)

label variable op_cont "district's contribution to total opinions"
label variable term_cont "district's contribution to total terminations"
label variable op_cum "running sum of contribution to total opinions"
label variable term_cum "running sum of contribution to total terminations"

*** NOW THE DATA HAS THE RESULTS REPORTED IN TEXT.

save "opinions_and_terminations_results.dta", replace

