|
Size: 360
Comment:
|
← Revision 7 as of 2025-12-17 18:21:09 ⇥
Size: 973
Comment: Notes
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| ## page was renamed from Stata/Graphing = Stata Graphing = |
= Stata Graph = '''`-graph-`''' renders a visual graph. |
| Line 10: | Line 11: |
| == Graphs == | == Usage == |
| Line 13: | Line 14: |
| graph hbar VAR, over(GROUPVAR1) over(GROUPVAR2) asyvars graph export foo.png |
graph hbar foo, over(bar) over(baz) asyvars graph save foo // native Stata graphic graph export foo.png // rendered graphic }}} === Plotting Aggregated Statistics === Consider a time series dataset that includes a time period indicator (`t`) that ranges from 3 to 9, an estimated population proportion (`p`), and upper/lower confidence interval bounds (`ci_upper` and `ci_lower`). This time series can be plotted like: {{{ tsset t graph twoway (rarea ci_lower ci_upper t, color(gs15)) (tsline p, ylabel(0(0.05)0.25 tlabel(3(1)9)) }}} It may be helpful to also plot a horizontal line for the overall mean. Try: {{{ quietly summ p generate m = r(mean) graph twoway ... (tsline m) |
| Line 21: | Line 43: |
| == Tables == | == See also == |
| Line 23: | Line 45: |
| {{{ regress OUTCOME TREATMENTS estimates store foo estimates table foo, b(%10.3f) star }}} |
[[https://www.stata.com/manuals/dgraph.pdf|Stata manual for -graph-]] |
Stata Graph
-graph- renders a visual graph.
Usage
graph hbar foo, over(bar) over(baz) asyvars graph save foo // native Stata graphic graph export foo.png // rendered graphic
Plotting Aggregated Statistics
Consider a time series dataset that includes a time period indicator (t) that ranges from 3 to 9, an estimated population proportion (p), and upper/lower confidence interval bounds (ci_upper and ci_lower). This time series can be plotted like:
tsset t graph twoway (rarea ci_lower ci_upper t, color(gs15)) (tsline p, ylabel(0(0.05)0.25 tlabel(3(1)9))
It may be helpful to also plot a horizontal line for the overall mean. Try:
quietly summ p generate m = r(mean) graph twoway ... (tsline m)
