These data are from Section 12.2 of Levy and Lemeshow. They describe (a possibly apocryphal) study of survival in out-of-hospital cardiac arrest. Two out of five ambulance stations were sampled from each of three emergency service areas.

data(scd)

Format

This data frame contains the following columns:

ESA

Emergency Service Area (strata)

ambulance

Ambulance station (PSU)

arrests

estimated number of cardiac arrests

alive

number reaching hospital alive

Source

Levy and Lemeshow. "Sampling of Populations" (3rd edition). Wiley.

Examples

data(scd)

## survey design objects
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")
# or to Rao-Wu bootstrap
scd2boot <- as.svrepdesign(scdnofpc, type="subboot")

# use BRR replicate weights from Levy and Lemeshow
repweights<-2*cbind(c(1,0,1,0,1,0), c(1,0,0,1,0,1), c(0,1,1,0,0,1),
c(0,1,0,1,1,0))
scdrep<-svrepdesign(data=scd, type="BRR", repweights=repweights)
#> Warning: No sampling weights provided: equal probability assumed

# ratio estimates
svyratio(~alive, ~arrests, design=scddes)
#> Ratio estimator: svyratio.survey.design2(~alive, ~arrests, design = scddes)
#> Ratios=
#>         arrests
#> alive 0.1535064
#> SEs=
#>           arrests
#> alive 0.007596705
svyratio(~alive, ~arrests, design=scdnofpc)
#> Ratio estimator: svyratio.survey.design2(~alive, ~arrests, design = scdnofpc)
#> Ratios=
#>         arrests
#> alive 0.1535064
#> SEs=
#>           arrests
#> alive 0.009807304
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=scd2boot)
#> Ratio estimator: svyratio.svyrep.design(~alive, ~arrests, design = scd2boot)
#> Ratios=
#>         arrests
#> alive 0.1535064
#> SEs=
#>            [,1]
#> [1,] 0.01004616
svyratio(~alive, ~arrests, design=scdrep)
#> Ratio estimator: svyratio.svyrep.design(~alive, ~arrests, design = scdrep)
#> Ratios=
#>         arrests
#> alive 0.1535064
#> SEs=
#>             [,1]
#> [1,] 0.009418401

# or a logistic regression
summary(svyglm(cbind(alive,arrests-alive)~1, family=quasibinomial, design=scdnofpc))
#> 
#> Call:
#> svyglm(formula = cbind(alive, arrests - alive) ~ 1, design = scdnofpc, 
#>     family = quasibinomial)
#> 
#> Survey design:
#> svydesign(data = scd, prob = ~1, id = ~ambulance, strata = ~ESA, 
#>     nest = TRUE)
#> 
#> Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)    
#> (Intercept) -1.70736    0.07547  -22.62 0.000189 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> (Dispersion parameter for quasibinomial family taken to be 5.645324)
#> 
#> Number of Fisher Scoring iterations: 4
#> 
summary(svyglm(cbind(alive,arrests-alive)~1, family=quasibinomial, design=scdrep))
#> 
#> Call:
#> svyglm(formula = cbind(alive, arrests - alive) ~ 1, family = quasibinomial, 
#>     design = scdrep)
#> 
#> Survey design:
#> svrepdesign.default(data = scd, type = "BRR", repweights = repweights)
#> 
#> Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)    
#> (Intercept)  -1.7074     0.1241  -13.75 0.000832 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> (Dispersion parameter for quasibinomial family taken to be 31.63925)
#> 
#> Number of Fisher Scoring iterations: 4
#> 

# Because no sampling weights are given, can't compute design effects
# without replacement: use deff="replace"

svymean(~alive+arrests, scddes, deff=TRUE)
#>             mean       SE DEff
#> alive    46.3333   2.7749  Inf
#> arrests 301.8333  19.6694  Inf
svymean(~alive+arrests, scddes, deff="replace")
#>             mean       SE   DEff
#> alive    46.3333   2.7749 0.0791
#> arrests 301.8333  19.6694 0.0400