multiphase: Multiphase sampling designs

View source: R/multiphase_inference.R

multiphaseR Documentation

Multiphase sampling designs

Description

These objects represent designs with arbitrarily many nested phases of sampling, allowing estimation and (in the future) calibration/raking at each phase

Usage

multiphase(ids, subset, strata, probs, data, fpc = NULL,
check.variable.phase=TRUE)

Arguments

ids

List of as many model formulas as phases describing ids for each phase. Each formula may indicate multistage sampling

subset

list of model formulas for each phase except the first, specifying a logical vector of which observations from the previous phase are included

strata

List of as many model formulas as phases describing strata for each phase. Each formula may indicate multistage sampling, or NULL for no strata

probs

List of as many model formulas or pps_spec objects as phases describing sampling probabilities for each phase. Each formula may indicate multistage sampling. Typically will either be NULL except for phase 1 if strata are specified, or a matrix of class pps_spec specifying pairwise probabilities or covariances. Use ~1 at phase 1 to specify iid sampling from a generating model.

data

data frame of data

fpc

Finite population correction for the first phase, if needed

check.variable.phase

Work out which phase each variable is observed in by looking at missing value patterns. You may want FALSE for simulations where the values aren't actually missing

Details

Variance calculation uses a decomposition with sampling contributions at each stage, which are returned as the phases attribution of a variance-covariance matrix. The computations broadly follow the description for two-phase sampling in chapter 9 of Sarndal et al (1991); there is more detail in the vignette

Value

Object of class multiphase

Note

There are currently methods for svytotal, svymean, svyglm, svyvar. Calibration is not yet implemented, nor is NA handling.

References

Sarndal, Swensson, and Wretman (1991) "Model Assisted Survey Sampling" (Chapter 9)

See Also

twophase for older implementations of two-phase sampling

vignette("multiphase") for computational details

Examples

data(nwtco)
dcchs<-twophase(id = list(~seqno, ~seqno), strata = list(NULL, ~rel), 
    subset = ~I(in.subcohort | rel), data = nwtco)
mcchs<-multiphase(id = list(~seqno, ~seqno), strata = list(NULL, ~rel), 
    subset = list(~I(in.subcohort | rel)), probs = list(~1, NULL), 
    data = nwtco)
dcchs
mcchs
svymean(~edrel, dcchs)
svymean(~edrel, mcchs)

summary(svyglm(edrel~rel+histol+stage, design=dcchs))
summary(svyglm(edrel~rel+histol+stage, design=mcchs))

m<-calibrate(mcchs,~factor(stage)+rel, phase=2, calfun="raking")
vcov(svytotal(~factor(stage), m))

survey documentation built on Aug. 28, 2024, 3 a.m.