Creates a replicate-weights survey design object from a traditional strata/cluster survey design object. JK1 and JKn are jackknife methods, BRR is Balanced Repeated Replicates and Fay is Fay's modification of this, bootstrap is Canty and Davison's bootstrap, subbootstrap is Rao and Wu's \((n-1)\) bootstrap, and mrbbootstrap is Preston's multistage rescaled bootstrap. With a svyimputationList object, the same replicate weights will be used for each imputation if the sampling weights are all the same and separate.replicates=FALSE.

as.svrepdesign(design,...)
# S3 method for default
as.svrepdesign(design, type=c("auto", "JK1", "JKn", "BRR", "bootstrap",
   "subbootstrap","mrbbootstrap","Fay"),
   fay.rho = 0, fpc=NULL,fpctype=NULL,..., compress=TRUE, 
   mse=getOption("survey.replicates.mse"))
# S3 method for svyimputationList
as.svrepdesign(design, type=c("auto", "JK1", "JKn", "BRR", "bootstrap",
   "subbootstrap","mrbbootstrap","Fay"),
   fay.rho = 0, fpc=NULL,fpctype=NULL, separate.replicates=FALSE, ..., compress=TRUE, 
   mse=getOption("survey.replicates.mse"))

Arguments

design

Object of class survey.design or svyimputationList. Must not have been post-stratified/raked/calibrated in R

type

Type of replicate weights. "auto" uses JKn for stratified, JK1 for unstratified designs

fay.rho

Tuning parameter for Fay's variance method

fpc,fpctype,...

Passed to jk1weights, jknweights, brrweights, bootweights, subbootweights, or mrbweights.

separate.replicates

Compute replicate weights separately for each design (useful for the bootstrap types, which are not deterministic

compress

Use a compressed representation of the replicate weights matrix.

mse

if TRUE, compute variances from sums of squares around the point estimate, rather than the mean of the replicates

Value

Object of class svyrep.design.

References

Canty AJ, Davison AC. (1999) Resampling-based variance estimation for labour force surveys. The Statistician 48:379-391

Judkins, D. (1990), "Fay's Method for Variance Estimation," Journal of Official Statistics, 6, 223-239.

Preston J. (2009) Rescaled bootstrap for stratified multistage sampling. Survey Methodology 35(2) 227-234

Rao JNK, Wu CFJ. Bootstrap inference for sample surveys. Proc Section on Survey Research Methodology. 1993 (866--871)

Examples

data(scd)
scddes<-svydesign(data=scd, prob=~1, id=~ambulance, strata=~ESA,
nest=TRUE, fpc=rep(5,6))
scdnofpc<-svydesign(data=scd, prob=~1, id=~ambulance, strata=~ESA,
nest=TRUE)

# convert to BRR replicate weights
scd2brr <- as.svrepdesign(scdnofpc, type="BRR")
scd2fay <- as.svrepdesign(scdnofpc, type="Fay",fay.rho=0.3)
# convert to JKn weights 
scd2jkn <- as.svrepdesign(scdnofpc, type="JKn")

# convert to JKn weights with finite population correction
scd2jknf <- as.svrepdesign(scddes, type="JKn")

## with user-supplied hadamard matrix
scd2brr1 <- as.svrepdesign(scdnofpc, type="BRR", hadamard.matrix=paley(11))

svyratio(~alive, ~arrests, design=scd2brr)
#> Ratio estimator: svyratio.svyrep.design(~alive, ~arrests, design = scd2brr)
#> Ratios=
#>         arrests
#> alive 0.1535064
#> SEs=
#>             [,1]
#> [1,] 0.009418401
svyratio(~alive, ~arrests, design=scd2brr1)
#> Ratio estimator: svyratio.svyrep.design(~alive, ~arrests, design = scd2brr1)
#> Ratios=
#>         arrests
#> alive 0.1535064
#> SEs=
#>            [,1]
#> [1,] 0.01001468
svyratio(~alive, ~arrests, design=scd2fay)
#> Ratio estimator: svyratio.svyrep.design(~alive, ~arrests, design = scd2fay)
#> Ratios=
#>         arrests
#> alive 0.1535064
#> SEs=
#>             [,1]
#> [1,] 0.009525187
svyratio(~alive, ~arrests, design=scd2jkn)
#> Ratio estimator: svyratio.svyrep.design(~alive, ~arrests, design = scd2jkn)
#> Ratios=
#>         arrests
#> alive 0.1535064
#> SEs=
#>             [,1]
#> [1,] 0.009846457
svyratio(~alive, ~arrests, design=scd2jknf)
#> Ratio estimator: svyratio.svyrep.design(~alive, ~arrests, design = scd2jknf)
#> Ratios=
#>         arrests
#> alive 0.1535064
#> SEs=
#>             [,1]
#> [1,] 0.007627033

data(api)
## one-stage cluster sample
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
## convert to JK1 jackknife
rclus1<-as.svrepdesign(dclus1)
## convert to bootstrap
bclus1<-as.svrepdesign(dclus1,type="bootstrap", replicates=100)

svymean(~api00, dclus1)
#>         mean     SE
#> api00 644.17 23.542
svytotal(~enroll, dclus1)
#>          total     SE
#> enroll 3404940 932235

svymean(~api00, rclus1)
#>         mean     SE
#> api00 644.17 26.329
svytotal(~enroll, rclus1)
#>          total     SE
#> enroll 3404940 932235

svymean(~api00, bclus1)
#>         mean     SE
#> api00 644.17 22.157
svytotal(~enroll, bclus1)
#>          total     SE
#> enroll 3404940 988476

dclus2<-svydesign(id = ~dnum + snum, fpc = ~fpc1 + fpc2, data = apiclus2)
mrbclus2<-as.svrepdesign(dclus2, type="mrb",replicates=100)
svytotal(~api00+stype, dclus2)
#>             total        SE
#> api00  3440375.75 926665.59
#> stypeE    3493.55   1119.75
#> stypeH     688.87    289.35
#> stypeM     946.25    311.81
svytotal(~api00+stype, mrbclus2)
#>             total         SE
#> api00  3440375.75 1025894.94
#> stypeE    3493.55    1222.10
#> stypeH     688.87     309.64
#> stypeM     946.25     336.74