# Re: st: How to test for equality of variance in data with sampling weights

 From "Stas Kolenikov" To statalist@hsphsun2.harvard.edu Subject Re: st: How to test for equality of variance in data with sampling weights Date Fri, 25 May 2007 10:17:41 -0500

```The substantive answer to your question would run as follows: the
variance is a function of moments (the second moment minus the square
of the first moment), so what you could do is

gen income2 = income*income
svy: mean income2 income, over(whatevergroup)
* over groups
nlcom [income2]1 - ([income]1)^2
* between groups
testnl ([income2]1 - ([income]1)^2 = [income2]2 - ([income]2)^2 )

The syntax is very tentative of course -- you would need to fill in a
lot of details. But you really need to take care of all the design
features, as Steven insists.

The World Bank should get a methodology division to be able to answer
questions like that internally -- I was surprised that you guys don't
have any.

On 5/16/07, jmetzler@worldbank.org <jmetzler@worldbank.org> wrote:
```
```Dear statalist users,

I am faced with a problem for which I have not been able to find a solution yet,
neither in statalist archives nor through googling, (even though it does not
strike me as something extremely fancy that I am trying)

I am working with household survey data, where the sample is not clustered, not
stratified, but has sampling weights. Ultimately, I would like to test the
equality of the variance of my labor wage variable
1) for the whole sample and for specific subgroups (such as age groups) over
time
2) for subgroups at the same point in time.

I am aware of the command "robvar" but
a) it does not feature weights
b) I am wondering if it is statistically appropriate to pool my data for two
years and specify 'year' as the groupvar in the by() option.

What would you advise me? Is there another command implemented?
Thank you very much in advance,

Johannes

*
*   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/

```
```
--
Stas Kolenikov
http://stas.kolenikov.name
*
*   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/
```