Hello,
I 'd like to plot a twoway graph of 2 histogram and add some summary statistics direct on the graph using previous local command but the text is not displayed when I run the command. Can someone help me ?
*plot LP distribution by outcome, with summary statistics
sum linear_predictor_PREVENT_ASCVD if PREVENT_CVD == 0, detail
local mean_0 = r(mean)
local median_0 = r(p50)
local sd_0 = r(sd)
local lq_0 = r(p25)
local uq_0 = r(p75)
sum linear_predictor_PREVENT_ASCVD if PREVENT_CVD == 1, detail
local mean_1 = r(mean)
local median_1 = r(p50)
local sd_1 = r(sd)
local lq_1 = r(p25)
local uq_1 = r(p75)
twoway (hist linear_predictor_PREVENT_ASCVD if PREVENT_CVD == 0, dens color(navy%40) lcolor(black) width(0.1)) ///
(hist linear_predictor_PREVENT_ASCVD if PREVENT_CVD== 1, dens color(dkgreen%40) lcolor(black) width(0.1)) ///
(kdensity linear_predictor_PREVENT_ASCVD if PREVENT_CVD == 0, lcolor(navy) bwidth(0.35)) ///
(kdensity linear_predictor_PREVENT_ASCVD if PREVENT_CVD == 1, lcolor(dkgreen) bwidth(0.35)), ///
xtitle("Linear predictor value") scheme(s1color) ///
legend(order(1 "No ASCVD event within 10 years" 2 "ASCVD event within 10 years" )) ///
text(1 0.8 ///
"No ASCVD:" ///
" Mean = `: display %3.2f `mean_0''" ///
" Median = `: display %3.2f `median_0''" ///
" SD = `: display %3.2f `sd_0''" ///
" IQR = `: display %3.2f `lq_0'' to `: display %3.2f `uq_0''" ///
" " ///
"ASCVD:" ///
" Mean = `: display %3.2f `mean_1''" ///
" Median = `: display %3.2f `median_1''" ///
" SD = `: display %3.2f `sd_1''" ///
" IQR = `: display %3.2f `lq_1'' to `: display %3.2f `uq_1''" ///
, place(se) just(left))
I 'd like to plot a twoway graph of 2 histogram and add some summary statistics direct on the graph using previous local command but the text is not displayed when I run the command. Can someone help me ?
*plot LP distribution by outcome, with summary statistics
sum linear_predictor_PREVENT_ASCVD if PREVENT_CVD == 0, detail
local mean_0 = r(mean)
local median_0 = r(p50)
local sd_0 = r(sd)
local lq_0 = r(p25)
local uq_0 = r(p75)
sum linear_predictor_PREVENT_ASCVD if PREVENT_CVD == 1, detail
local mean_1 = r(mean)
local median_1 = r(p50)
local sd_1 = r(sd)
local lq_1 = r(p25)
local uq_1 = r(p75)
twoway (hist linear_predictor_PREVENT_ASCVD if PREVENT_CVD == 0, dens color(navy%40) lcolor(black) width(0.1)) ///
(hist linear_predictor_PREVENT_ASCVD if PREVENT_CVD== 1, dens color(dkgreen%40) lcolor(black) width(0.1)) ///
(kdensity linear_predictor_PREVENT_ASCVD if PREVENT_CVD == 0, lcolor(navy) bwidth(0.35)) ///
(kdensity linear_predictor_PREVENT_ASCVD if PREVENT_CVD == 1, lcolor(dkgreen) bwidth(0.35)), ///
xtitle("Linear predictor value") scheme(s1color) ///
legend(order(1 "No ASCVD event within 10 years" 2 "ASCVD event within 10 years" )) ///
text(1 0.8 ///
"No ASCVD:" ///
" Mean = `: display %3.2f `mean_0''" ///
" Median = `: display %3.2f `median_0''" ///
" SD = `: display %3.2f `sd_0''" ///
" IQR = `: display %3.2f `lq_0'' to `: display %3.2f `uq_0''" ///
" " ///
"ASCVD:" ///
" Mean = `: display %3.2f `mean_1''" ///
" Median = `: display %3.2f `median_1''" ///
" SD = `: display %3.2f `sd_1''" ///
" IQR = `: display %3.2f `lq_1'' to `: display %3.2f `uq_1''" ///
, place(se) just(left))
Comment