Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
703 views
in Technique[技术] by (71.8m points)

correlation - Stata: Adding significance stars to a custom esttab report

I have taken the code from the forum post (https://www.statalist.org/forums/for...relation-table) and modified it for me. But now I want to add the significance stars to the correlation part. In the command "pwcorr" the specification is mentioned (obs sig star(0.05)), but it is not displayed in the output. How do I have to change the code to show them?

Thanks a lot!

Also posted: Stata Forum

** Set variables used in Summary and Correlation
local variables tobins_q_w xrdat_w ivol_w firm_size_log_w industry_q_w growth_w lev_w os_w industry_growth_w hostility_w
local labels `" "Tobins q" "Innovativness" "Risk-taking" "Firm Size" "Industry q" "Growth" "Leverage" "Organizational Slack" "Environmental Munificience" "Environmental Hostility""'       
        
** Descriptive statistics
estpost sum tobins_q_w xrdat_w ivol_w firm_size_log_w industry_q_w growth_w lev_w os_w industry_growth_w hostility_w, detail
matrix table = (e(mean)  e(sd)  e(min)  e(max))
matrix rownames table = mean sd min max
matrix list table

** Correlation matrix
pwcorr tobins_q_w xrdat_w ivol_w firm_size_log_w industry_q_w growth_w lev_w os_w industry_growth_w hostility_w, obs sig star(0.05)
matrix C = r(C)
local corr : rownames C
matrix table = ( table  C )
matrix list table

estadd matrix table = table

local cells table[mean](fmt(3) label(Mean)) table[sd](fmt(3) label(Standard Deviation)) table[min](fmt(3) label(min)) table[max](fmt(3) label(max))
local collab
local drop
local i 0
foreach row of local corr {
    local drop `drop' `row'
    local cells `cells' table[`row']( fmt(4) drop(`drop') label((`++i')) )
    local lbl : word `i' of `labels'
    local collab `" `collab' `row' "(`i') `lbl'" "'
}
display "`cells'"
display `"`collab'"'

esttab using Report.csv, ///
        replace ///
        noobs ///
        nonumbers ///
        compress ///
        cells("`cells'") ///
        coeflabels(`collab')
question from:https://stackoverflow.com/questions/65621338/stata-adding-significance-stars-to-a-custom-esttab-report

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...