find.lon.strata: Find Strata with Lonely PSUs

View source: R/find.lon.strata.R

find.lon.strataR Documentation

Find Strata with Lonely PSUs

Description

Checks whether a stratified design object contains lonely PSUs: if this is the case, returns the lonely strata levels.

Usage

find.lon.strata(design)

Arguments

design

Object of class analytic (or inheriting from it) containing survey data and sampling design metadata.

Details

Lonely PSUs (i.e. PSUs which are alone inside a not self-representing stratum) are a concern from the viewpoint of variance estimation. The suggested ReGenesees facility to handle the lonely PSUs problem is the strata aggregation technique provided in function collapse.strata (for further alternatives, see also ReGenesees.options).

Function find.lon.strata (originally a private function intended to be called only by collapse.strata) is a simple diagnostic tool whose purpose is to identify the levels of the strata containing lonely PSUs (lonely strata for short).

Value

The lonely strata levels, if design actually contains lonely PSUs; invisible(NULL) otherwise.

Author(s)

Diego Zardetto

See Also

collapse.strata for the suggested way of handling lonely PSUs, ReGenesees.options for a different way to face the same problem (namely by setting variance estimation options), and fpcdat for useful data examples.

Examples

# Load sbs data:
data(fpcdat)

# A negative example first:

  # Build a design object:
    fpcdes<-e.svydesign(data=fpcdat,ids=~psu+ssu,strata=~stratum,weights=~w,
            fpc=~fpc1+fpc2)
    fpcdes

  # Find lonely strata:
    find.lon.strata(fpcdes)


# Recall that the difference between certainty PSUs (those sampled with
# probability 1, contained inside self-representing strata) and lonely PSUs
# rests on the fpc information passed to e.svydesign, e.g.:

  # Build a new design object with the same data, now IGNORING fpcs:
    fpcdes.nofpc<-e.svydesign(data=fpcdat,ids=~psu+ssu,strata=~stratum,
                  weights=~w)
    fpcdes.nofpc

  # Find lonely strata:
    find.lon.strata(fpcdes.nofpc)


# A trivial check: collapsing strata eliminates lonely PSUs

  # Apply the collapse strata technique:
    fpcdes.nofpc.clps<-collapse.strata(fpcdes.nofpc)
    fpcdes.nofpc.clps
    clps.strata.status

  # Find lonely strata:
    find.lon.strata(fpcdes.nofpc.clps)

# ...as it must be.

DiegoZardetto/ReGenesees documentation built on Dec. 16, 2024, 2:03 p.m.