[R] return.replicates in survey pkg

Richard Valliant rvalliant at survey.umd.edu
Fri Mar 26 15:29:17 CET 2010


How do I retrieve the replicates estimates from a crosstab done using
svyby?
Here is an example from the help page for svyby in the package:

> data(api)
> dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
> rclus1<-as.svrepdesign(dclus1)
> 
> a <- svyby(~api99, ~stype, rclus1, svymean, return.replicates=TRUE)
> a$replicates
NULL

But, compare to
> b <- svymean(~api99, design=rclus1, return.replicates=TRUE)
> b$replicates
 [1] 606.8488 611.5866 609.1989 605.5765 608.1381 606.6927 609.8101
599.4371 602.4368 601.8792 606.7531 630.6575 600.1882 607.5549 599.9942
> 

The object b, created via svymean, contains "replicates" but object a,
created via svyby + svymean does not. But str(a) gives (in part)
 - attr(*, "replicates")= num [1:15, 1:3] 598 610 596 596 596 ...

which makes it look like the reps are in there somewhere. I'm using
Package survey version 3.21-2 on Windows XP.


Thanks
R. Valliant



More information about the R-help mailing list