| [3] | litgov_est.dta | |||
| 
    
      
    ch10.1.do:6 | 
[8] | litgov_estsample.dta | ||
| master.do:4 | ||||
| → | ch10.1.do | ↘ | ||
| 
      
    table2tex |  
[53] | |||
| 
      
    litgov_estsample.dta |  
[6] | 
      
    ch10.1.do:8 | 
||
ch10.1.do open
file:script:do
| # | content | 
|---|---|
| 1 [+] | * ITSP 10.1 - | 
| 3 [+] | use "litgov_est.dta" , | 
| 4 [+] | drop if !t56s | 
| 5 [+] | matrix drop _all | 
| 6 [+] | save litgov_estsample , | 
| 8 [+] | use litgov_estsample.dta , | 
| 9 [+] | tabstat insider , | 
| 10 [+] | return list | 
 * N  | 
|
| 13 [+] | makematrix t2a, from(r(Stat1) r(Stat2)): tabstat insider , | 
| 14 [+] | summarize insider , | 
| 15 [+] | matrix temp = r(N) | 
| 16 [+] | matrix t2a = t2a , | 
 * CEO  | 
|
| 19 [+] | makematrix t2aa, from(r(Stat1) r(Stat2)): tabstat ceo , | 
| 20 [+] | mat t2aa[1,1] = . | 
| 21 [+] | summarize ceo if insider , | 
| 22 [+] | mat temp = r(N) | 
| 23 [+] | mat t2aa = t2a \ (t2aa, temp) | 
| 25 [+] | * Outcome, Involvement, Demographics * gen tenure = exp(entrench) | 
| 28 [+] | foreach v of varlist audit defendant_ANY ins_trade_ANY departed age tenure stkholding { | 
| 29 [+] | qui makematrix t2b, from(r(Stat1) r(Stat2)): tabstat `v' , | 
| 30 [+] | summarize `v' , | 
| 31 [+] | matrix `v'1 = r(N) | 
| 32 [+] | qui ttest `v' , | 
| 33 [+] | matrix `v'2 = r(p) | 
| 34 [+] | qui ranksum `v' , | 
| 35 [+] | matrix `v'3 = 1 - normprob(abs(r(z))) | 
| 36 [+] | matrix `v' = t2b, `v'1, `v'2 , | 
| 37 [+] | matrix t2bb = (nullmat(t2bb) \ `v') | 
| 38 [+] | } | 
| 40 [+] | matrix colnames t2aa = Outsider Insider Total | 
| 41 [+] | matrix rownames t2aa = Observations CEO | 
| 42 [+] | matrix list t2aa | 
| 43 [+] | matrix colnames t2bb = Outsider Insider N t_pval MW_pval | 
| 44 [+] | matrix list t2bb | 
| 46 [+] | local inv Audit Defendant Ins\_Trading Departed Age Tenure Voting\_Share | 
| 47 [+] | local inv1 "Member Audit Committee (0/1)" | 
| 48 [+] | local inv2 "Defendant (0/1)" | 
| 49 [+] | local inv5 "Age (Years)" | 
| 50 [+] | local inv6 "Board Tenure (Years)" | 
| 51 [+] | local inv7 "Voting Share (\%)" | 
| 52 [+] | tempname hh | 
| 53 [+] | file open `hh' using table2.tex , | 
| 54 [+] | file write `hh' "\begin{table}[htbp]\caption{Director-level variables}\bigskip" _newline | 
| 56 [+] | file write `hh' "\begin{tabular}{lrrrrr}" _newline "\hline" _newline | 
| 57 [+] | file write `hh' " Variable & Outside & Inside & & \multicolumn{2}{c}{\$p\$-value of Difference} \\" _newline | 
| 58 [+] | file write `hh' "& Directors & Directors & & \multicolumn{2}{c}{in Location} \\" _newline | 
| 59 [+] | file write `hh' "\hline & Mean & Mean & \$N\$ & \$t\$ test & Mann--Whitney \\" _newline | 
| 60 [+] | file write `hh' "\hline" _newline | 
| 61 [+] | file write `hh' "Observations (\$N\$) & " (t2aa[1, 1]) " & " (t2aa[1, 2]) " & " (t2aa[1, 3]) " \\" _newline | 
| 62 [+] | file write `hh' "\\{\sl Involvement} \\" _newline | 
| 63 [+] | file write `hh' "CEO (0/1) & N/A & " %7.3f (t2aa[2, 2]) " & " (t2aa[2, 3]) " \\" _newline | 
| 64 [+] | forv i = 1/2 { | 
| 65 [+] | file write `hh' "`inv`i'' & " %7.3f (t2bb[`i', 1]) " & " %7.3f (t2bb[`i', 2]) " & " (t2bb[`i', 3]) " & " %7.3f (t2bb[`i', 4]) " & " %7.3f (t2bb[`i', 5]) " \\" _newline | 
| 66 [+] | } | 
| 67 [+] | file write `hh' "\\{\sl Outcome} \\" _newline | 
| 68 [+] | local i 4 | 
| 69 [+] | file write `hh' "Departed (0/1) & " %7.3f (t2bb[`i', 1]) " & " %7.3f (t2bb[`i', 2]) " & " (t2bb[`i', 3]) " & " %7.3f (t2bb[`i', 4]) " & " %7.3f (t2bb[`i', 5]) " \\" _newline | 
| 70 [+] | file write `hh' "\\{\sl Demographics} \\" _newline | 
| 71 [+] | forv i = 5/7 { | 
| 72 [+] | file write `hh' "`inv`i'' & " %7.3f (t2bb[`i', 1]) " & " %7.3f (t2bb[`i', 2]) " & " (t2bb[`i', 3]) " & " %7.3f (t2bb[`i', 4]) " & " %7.3f (t2bb[`i', 5]) " \\" _newline | 
| 73 [+] | } | 
| 74 [+] | file write `hh' "\hline" _n "\end{tabular}" "\medskip" _newline | 
| 75 [+] | file write `hh' "\end{table}" _newline | 
| 76 [+] | file close `hh' | 
* ITSP 10.1 -
use "litgov_est.dta", clear
drop if !t56s
matrix drop _all
save litgov_estsample, replace
use litgov_estsample.dta, clear
tabstat insider, by(insider) stat(N) save
return list
* N
makematrix t2a, from(r(Stat1) r(Stat2)): tabstat insider, by(insider) stat(N) save
summarize insider, mean
matrix temp = r(N)
matrix t2a = t2a, temp
* CEO
makematrix t2aa, from(r(Stat1) r(Stat2)): tabstat ceo, by(insider) stat(mean) save
mat t2aa[1,1] = .
summarize ceo if insider, mean
mat temp = r(N)
mat t2aa = t2a \ (t2aa, temp)
* Outcome, Involvement, Demographics
* gen tenure = exp(entrench)
foreach v of varlist audit defendant_ANY ins_trade_ANY departed age tenure stkholding {
    qui makematrix t2b, from(r(Stat1) r(Stat2)): tabstat `v', by(insider) stat(mean) save
    summarize `v', mean
    matrix `v'1 = r(N)
    qui ttest `v', by(insider)
    matrix `v'2 = r(p)
    qui ranksum `v', by(insider)
    matrix `v'3 = 1 - normprob(abs(r(z)))
    matrix `v' = t2b, `v'1, `v'2, `v'3
    matrix t2bb = (nullmat(t2bb) \ `v')
}
matrix colnames t2aa = Outsider Insider Total
matrix rownames t2aa = Observations CEO
matrix list t2aa
matrix colnames t2bb = Outsider Insider N t_pval MW_pval
matrix list t2bb
local inv Audit Defendant Ins\_Trading Departed Age Tenure Voting\_Share
local inv1 "Member Audit Committee (0/1)"
local inv2 "Defendant (0/1)"
local inv5 "Age (Years)"
local inv6 "Board Tenure (Years)"
local inv7 "Voting Share (\%)"
tempname hh
file open `hh' using table2.tex, write replace
file write `hh' "\begin{table}[htbp]\caption{Director-level variables}\bigskip" _newline
file write `hh' "\begin{tabular}{lrrrrr}" _newline "\hline" _newline
file write `hh' " Variable & Outside & Inside & & \multicolumn{2}{c}{\$p\$-value of Difference} \\" _newline
file write `hh' "& Directors & Directors & & \multicolumn{2}{c}{in Location} \\" _newline
file write `hh' "\hline & Mean & Mean & \$N\$ & \$t\$ test & Mann--Whitney \\" _newline
file write `hh' "\hline" _newline
file write `hh' "Observations (\$N\$) & " (t2aa[1, 1]) " & " (t2aa[1, 2]) " & " (t2aa[1, 3]) " \\" _newline
file write `hh' "\\{\sl Involvement} \\" _newline
file write `hh' "CEO (0/1) & N/A & " %7.3f (t2aa[2, 2]) " & " (t2aa[2, 3]) " \\" _newline
forv i = 1/2 {
	file write `hh' "`inv`i'' & "  %7.3f (t2bb[`i', 1]) " & "  %7.3f (t2bb[`i', 2]) " & " (t2bb[`i', 3])  " & " %7.3f (t2bb[`i', 4])  " & " %7.3f (t2bb[`i', 5]) " \\" _newline
}
file write `hh' "\\{\sl Outcome} \\" _newline
local i 4
file write `hh' "Departed (0/1) & "  %7.3f (t2bb[`i', 1]) " & "  %7.3f (t2bb[`i', 2]) " & " (t2bb[`i', 3])  " & " %7.3f (t2bb[`i', 4])  " & " %7.3f (t2bb[`i', 5]) " \\" _newline
file write `hh' "\\{\sl Demographics} \\" _newline
forv i = 5/7 {
	file write `hh' "`inv`i'' & "  %7.3f (t2bb[`i', 1]) " & "  %7.3f (t2bb[`i', 2]) " & " (t2bb[`i', 3])  " & " %7.3f (t2bb[`i', 4])  " & " %7.3f (t2bb[`i', 5]) " \\" _newline
}
file write `hh' "\hline" _n "\end{tabular}" "\medskip" _newline
file write `hh'  "\end{table}" _newline
file close `hh'