View source: R/find.lon.strata.R
find.lon.strata | R Documentation |
Checks whether a stratified design object contains lonely PSUs: if this is the case, returns the lonely strata levels.
find.lon.strata(design)
design |
Object of class |
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).
The lonely strata levels, if design
actually contains lonely PSUs;
invisible(NULL)
otherwise.
Diego Zardetto
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.
# 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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.