Statalist


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

Re: st: sum of missing values returned as zero


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: sum of missing values returned as zero
Date   Sat, 4 Oct 2008 09:27:18 +0100 (BST)

Stata uses the most common convention when dealing with missing data:
it ignores observations (rows) with missing data. So you asked Stata to
compute the sum of nothing, which is zero. This is not uncontroversial,
but it is probably the most practical way of dealing with this issue.
Any other method of dealing with missing data will require a
considerable modeling effort, so it is not suitable as a default, and
refusing to give an estimates whenever a missing value occurs in the
data is not a practical solution either as it is way too common.

-- Maarten

--- Jacob Wegelin <[email protected]> wrote:

> The following code
> 
> clear 
> set obs 4
> gen Finished=.
> list
> summarize Finished
> return list
> 
> returns a value of zero for the sum of Finished, as is seen below.  I
> do not understand. I would think that the sum of a list of numbers,
> at least one of which is missing, would be missing, not zero. Can
> someone explain?
> 
> . set obs 4
> obs was 0, now 4
> 
> . gen Finished=.
> (4 missing values generated)
> 
> . list
> 
>       +----------+
>       | Finished |
>       |----------|
>    1. |        . |
>    2. |        . |
>    3. |        . |
>    4. |        . |
>       +----------+
> 
> . summarize Finished
> 
>      Variable |       Obs        Mean    Std. Dev.       Min       
> Max
>
-------------+--------------------------------------------------------
>      Finished |         0
> 
> . return list
> 
> scalars:
>                    r(N) =  0
>                r(sum_w) =  0
>                  r(sum) =  0
> 
> 
> Thanks
> 
> Jacob A. Wegelin
> [email protected] 
> Assistant Professor
> Department of Biostatistics
> Virginia Commonwealth University
> 730 East Broad Street Room 3006
> P. O. Box 980032
> Richmond VA 23298-0032
> U.S.A. 
> http://www.people.vcu.edu/~jwegelin
> 
> *
> *   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/
> 


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


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