On Fri, 26 Mar 2010, Richard Valliant wrote:
> 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
Like this> a <- svyby(~api99, ~stype, rclus1, svymean, return.replicates=TRUE)
> attr(a,"replicates")
[,1] [,2] [,3]
[1,] 598.3077 607.3676 608.6087
[2,] 609.6923 610.8239 617.1250
[3,] 595.7143 609.2168 616.9583
[4,] 595.7143 606.4701 606.4091
[5,] 595.7143 609.2817 608.6000
[6,] 587.2308 608.3803 607.2500
[7,] 605.4615 610.1761 610.0000
[8,] 595.7143 600.5267 595.3182
[9,] 554.9000 605.1571 606.3750
[10,] 595.7143 601.1364 608.6000
[11,] 591.5833 607.9688 607.9545
[12,] 622.8182 630.6491 634.8095
[13,] 595.7143 601.5746 594.5909
[14,] 595.7143 608.5315 608.6000
[15,] 590.1538 601.2593 598.1304
The help page says that the replicates are returned as an attribute of the
result. I will make it explicit that it is the "replicates" attribute
of the result.
-thomas
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle