Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Adding a Reference Point to a -tabplot- Graph


From   Marshall Garland <[email protected]>
To   [email protected]
Subject   st: Adding a Reference Point to a -tabplot- Graph
Date   Fri, 24 Jul 2009 10:26:11 -0500

Hello-

I'm attempting to generate graphs across multiple levels (schools)
that display the percentage of students within a particular school and
within a particular subgroup (let's say, gender, or ethnicity, etc.)
that accomplished a particular task. The data are longitudinal, so
these outcomes are captured across multiple years (two, to be
precise). Thus, my X and Y variable are both categorical. -tabplot-,
of course, works brilliantly for this.

However, I would also like to add a reference point to each category
that shows the aggregate percentage (that is, across all schools in a
given year, not just a particular one) for each task for each student
subgroup. It seems as though some overlay using the addplot option for
-tabplot- would work, but I can't seem to figure out how to do this.
I've experimented with using -combine graph- to add additional figures
of the aggregate results for each year, but I'm unhappy with the
results.

Here's my syntax thus far:

***figure 2***
levelsof school_name, local(levels)
foreach school_name of local levels {
	tabplot ethniccode enroll_type_final, by (hs_grad_year)
percent(ethniccode hs_grad_year) ytitle(, orient(hor)) ///
	scheme(s2color) showval ///
	ylabel(, nogrid) legend(nostack rows(1) size(small) nobox
region(lcolor(white) lwidth(vvvthin))) ///
	xtitle(`school_name') xtitle(, justification(center)) ///
	by(, note(, color(white)))
}

My data look like this:

Student	School	Year	Y	X
1	A	2007	1	3
2	A	2008	3	2
4	B	2008	4	5
5	B	2007	1	4
7	C	2007	2	2
8	C	2008	4	4

Any ideas or recommendations would be greatly appreciated.

Cheers,

-Marshall

-tabplot- reference:
http://www.stata-journal.com/sjpdf.html?articlenum=gr0004
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index