Skip to content
Prev 76675 / 398502 Next

survey weights

On Sun, 4 Sep 2005, A Das wrote:

            
No, it would not imply the object was created.  If it was an error message 
(rather than a warning) the object would not have been created.

I presume the full message was
  Error in na.fail.default(object) : missing values in object

If so, it sounds as though you have missing values in the id, weights, or 
strata variable.
    summary(China[,c("psu","stata","weight0x"])
will verify this.

Stata will just have dropped these observations (use -svydes- to verify 
this).  If you want to drop the observations in R you need to do this 
explicitly. Having missing data may be unavoidable, but if you have 
observations in a sample it seems that you should know how they were 
sampled.
To drop these observations you could use

obsChina <- subset(China, !is.na(psu) & !is.na(strata) & !is.na(weight0x))

and then use obsChina rather than China in the svydesign() function.

 	-thomas
Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle