Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Graphing complex sample data in Stata 9


From   Ulrich Kohler <kohler@wz-berlin.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Graphing complex sample data in Stata 9
Date   Thu, 14 Sep 2006 10:04:26 +0200

Honey, Wayne, DOH wrote:
> I find no reference to a corresponding special set of graphics commands
> for use with complex sample data.  In fact, I find no discussions
> whatsoever regarding the graphing of complex sample data.  Does anyone
> know where one can find information that will settle my concerns that
> Stata's graphs will present properly generated proportions/means,
> confidence intervals, etc., for complex samples?

I have a general note on this. The graphs you are looking for can be "easily" 
produced with Stata. Therefore you have to apply the "resultsset" concept, 
which is fairly general and not restricted to the complex sample statistics. 
It goes like this:

(1) Calculate the statistics with the commands you like
(2) Collect the statistics in a data set ("resultsset")
(3) Load the resultsset
(4) Draw the results using standard graph commands.

Below my signature  is an example for producing and graphing a resultsset for 
a survey statistic which I accidentely made yesterday. It uses -postfile-, 
which is sort of low level. Several helper programs, mostly by Roger Newson, 
exist for the concept in general. -findit resultsset- will point you to these 
programs.

Hope this helps
Uli

-- 
kohler@wz-berlin.de
+49 (030) 25491-361


-------------------------------------------andeff_ess.do
* Analyse Design-effects in ESS
* -----------------------------

version 9.2

use XYZ, clear

// Produce Resultsset
// -------------------

svyset intnum
postfile deffs str2 cntry deff_gndr deff_stflife deff_hinctnt using `deff'
levelsof cntry, local(K)
foreach k of local K {
	quietly svy: mean gndr stflife hinctnt if cntry == "`k'"
	estat effects
	matrix deff = r(deff)
	post deffs ("`k'") (deff[1,1]) (deff[1,2]) (deff[1,3])
}
postclose deffs

// Process Resultsset
// -------------------
			
use `deff', clear
	
// Table Output
format %3.1f deff*
listtex using andeff_ess.tex, replace rstyle(tabular) ///
  head("\begin{tabular}{lccc}\hline \\" " & Gender & Life satisf. & Income \\ 
\hline") ///
  foot("\hline" "\end{tabular}")
	
// Graphical Output
graph dot (asis) deff*, over(cntry, sort(deff_gnd))

exit




*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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