Statalist


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

Re: st: Strange behavior or bug? - svy : total returns different results


From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: Strange behavior or bug? - svy : total returns different results
Date   Fri, 28 Aug 2009 14:51:36 -0500

Zurab Sajaia <[email protected]> is using -svy: total- with a variable
containing missing values and zero sampling weights:

> I've encountered a strange behavior of -svy- commands and was wandering
> whether this is a bug or I'm doing something wrong, any thought would be
> greatly appreciated.
>  
> the setup:
>  
> sysuse auto, clear
> svyset [pw = weight]
>  
> generate mv = .
>  
> svy : total mv
>  
> all versions (I have) of Stata (9-11) return -no observation- error after
> this.
>  
>  
> but if we change weights:
>  
> replace weight = 0 in 1/5  // there might be other explanation but I found that this 
>                            // error happens only if I have some observations with zero weights
>  
> then Stata 9 still shows error 2000 but both 10 and 11 versions return an
> output with "(sum of weights equals zero)" message on the screen and e(b)
> matrix equal to 0.

In Stata 10, we fixed how -svy: total- (and all other -svy- estimation
commands) handle missing values in observations outside the subpopulation.
We no longer mark out missing values for observations that are outside the
subpopulation.

Zurab had constructed a degenerate case for subpopulation estimation, even
though the -subpop()- and -over()- options were not specified.

By setting the sampling weight to 0 in the first 5 observations, Zurab has
indicated to -svy- that those observations are out of the subpop of interest.
The missing values in 'mv' cause -svy: total- to drop all the remaining
observations.  Thus there are 5 observations outside the subpop and 0 inside.

The estimation sample contains 5 observations, all of which contain zero
valued sampling weights, and -svy: total- reports this in the estimation
table.

Stata 9 did not receive this fix, thus it drops all observations containing
missing values regardless of the values in the sampling weight variable.

--Jeff
[email protected]
*
*   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