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

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.

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
#> Stratified 2 - Stage Cluster Sampling Design #> - [5] strata #> - [10, 19] clusters #> #> Call: #> e.svydesign(data = fpcdat, ids = ~psu + ssu, strata = ~stratum, #> weights = ~w, fpc = ~fpc1 + fpc2)
# Find lonely strata: find.lon.strata(fpcdes)
#> # No lonely PSUs found! #>
# 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
#> Stratified 2 - Stage Cluster Sampling Design (with replacement) #> - [5] strata #> - [10, 19] clusters #> #> Call: #> e.svydesign(data = fpcdat, ids = ~psu + ssu, strata = ~stratum, #> weights = ~w)
# Find lonely strata: find.lon.strata(fpcdes.nofpc)
#> [1] "S.3" "S.5"
# A trivial check: collapsing strata eliminates lonely PSUs # Apply the collapse strata technique: fpcdes.nofpc.clps<-collapse.strata(fpcdes.nofpc)
#> #> # All lonely strata (2) successfully collapsed! #>
#> Warning: No similarity score specified: achieved strata aggregation depends on the ordering of sample data
fpcdes.nofpc.clps
#> Stratified 2 - Stage Cluster Sampling Design (with replacement) #> - [3] strata (collapsed) #> - [10, 19] clusters #> #> Call: #> e.svydesign(data = fpcdat, ids = ~psu + ssu, strata = ~stratum, #> weights = ~w)
clps.strata.status
#> $message #> [1] "All lonely strata (2) successfully collapsed!" #> #> $clps.table #> block stratum lonely stratum.collapsed #> 1 G S.1 0 G.clps.1 #> 2 G S.3 1 G.clps.1 #> 3 G S.2 0 G.clps.2 #> 4 G S.5 1 G.clps.2 #>
# Find lonely strata: find.lon.strata(fpcdes.nofpc.clps)
#> # No lonely PSUs found! #>
# ...as it must be.