stratify-utilities: Utility functions for stratifying data

Description Usage Arguments Value Methods for function getStrataLegend Methods for function getStrataSplit Methods for function getStrataTable Methods for function getStratumSizes Methods for function getStratumValues Author(s) See Also Examples

Description

Generic utility functions for stratifying data. These are useful if not all the information of class "Strata" is necessary.

Usage

1
2
3
4
5
6
7
8
9
getStrataLegend(x, design)

getStrataSplit(x, design, USE.NAMES = TRUE)

getStrataTable(x, design)

getStratumSizes(x, design, USE.NAMES = TRUE)

getStratumValues(x, design, split)

Arguments

x

the data.frame to be stratified. For getStratumSizes, it is also possible to supply a list in which each list element contains the indices of the observations belonging to the corresponding stratum (as returned by getStrataSplit).

design

a character, logical or numeric vector specifying the variables (columns) to be used for stratification.

USE.NAMES

a logical indicating whether information about the strata should be used as names for the result.

split

an optional list in which each list element contains the indices of the observations belonging to the corresponding stratum (as returned by getStrataSplit).

Value

For getStrataLegend, a data.frame describing the strata.

For getStrataSplit, a list in which each element contains the indices of the observations belonging to the corresponding stratum.

For getStrataTable, a data.frame describing the strata and containing the stratum sizes.

For getStratumSizes, a numeric vector of the stratum sizes.

For getStratumValues, a numeric vector giving the stratum number for each observation.

Methods for function getStrataLegend

x = "data.frame", design = "BasicVector"

get a data.frame describing the strata, according to the variables specified by design.

Methods for function getStrataSplit

x = "data.frame", design = "BasicVector"

get a list in which each element contains the indices of the observations belonging to the corresponding stratum, according to the variables specified by design.

Methods for function getStrataTable

x = "data.frame", design = "BasicVector"

get a data.frame describing the strata and containing the stratum sizes, according to the variables specified by design.

Methods for function getStratumSizes

x = "list", design = "missing"

get the stratum sizes for a list in which each list element contains the indices of the observations belonging to the corresponding stratum (as returned by getStrataSplit).

x = "data.frame", design = "BasicVector"

get the stratum sizes of a data set, according to the variables specified by design.

Methods for function getStratumValues

x = "data.frame", design = "BasicVector", split = "list"

get the stratum number for each observation, according to the variables specified by design. A previously computed list in which each list element contains the indices of the observations belonging to the corresponding stratum (as returned by getStrataSplit) speeds things up a bit.

x = "data.frame", design = "BasicVector", split = "missing"

get the stratum number for each observation, according to the variables specified by design.

Author(s)

Andreas Alfons

See Also

stratify, Strata

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(eusilcP)

## all data
getStrataLegend(eusilcP, c("region", "gender"))
getStrataTable(eusilcP, c("region", "gender"))
getStratumSizes(eusilcP, c("region", "gender"))

## small sample
sam <- draw(eusilcP, size = 25)
getStrataSplit(sam, "gender")
getStratumValues(sam, "gender")

simFrame documentation built on Oct. 14, 2021, 5:24 p.m.