Statalist The Stata Listserver

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

Re: st: Minor question

From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: Minor question
Date   Wed, 22 Nov 2006 17:47:59 -0600

Arnold Levinson <[email protected]> asks the following:

> When requesting svy-adjusted means over population classes, is there a way
> to include the overall mean in the output, or must it be requested
> separately?

The overall mean is not directly computed by -svy: mean- when the -over()-
option is specified, thus there is no way to get -svy: mean- to report it
without using -svy: mean- to estimate it directly.

However, if Arnold is building a custom table using something like -estout-,
he can compute the overall mean using the estimation results at hand.
Here is an example using the auto data:

	. * estimate some subpopulation means
	. sysuse auto
	. svyset rep78 [pw=weight], strata(for)
	. gen subpop = mod(_n-1,5) + 1
	. svy: mean mpg, over(subpop)

	. * use the results to compute the overall mean and list it
	. matrix overallmean = e(b)*e(_N_subp)'/e(N_pop)
	. matrix list overallmean

	. * visually verify that we got the correct answer
	. svy: mean mpg


[email protected]
*   For searches and help try:

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