|
Size: 341
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 3: | Line 3: |
| The '''`graph`''' command generates an external graph file. | '''`-graph-`''' renders a visual graph. |
| Line 15: | Line 15: |
| graph export foo.png | 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 24: | Line 45: |
| [[https://www.stata.com/manuals/dgraph.pdf|Stata manual for graph]] | [[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)
