Package 'strat'

Title: An Implementation of the Stratification Index
Description: An implementation of the stratification index proposed by Zhou (2012) <DOI:10.1177/0081175012452207>. The package provides two functions, srank, which returns stratum-specific information, including population share and average percentile rank; and strat, which returns the stratification index and its approximate standard error. When a grouping factor is specified, strat also provides a detailed decomposition of the overall stratification into between-group and within-group components.
Authors: Xiang Zhou [aut, cre]
Maintainer: Xiang Zhou <[email protected]>
License: GPL (>= 3)
Version: 0.1
Built: 2024-11-07 03:11:38 UTC
Source: https://github.com/xiangzhou09/strat

Help Index


A Subset of March CPS 2015 Sample

Description

A dataset containing income, big class, microclass, and education of 14,358 male respondents from March CPS 2015

Usage

cpsmarch2015

Format

A data frame with 14358 rows and 5 variables:

income

personal market income, in US dollars

big_class

big class membership

micro_class

microclass membership

education

educational attainment

weight

sampling weight given by CPS


Print an object of class srank

Description

Print an object of class srank

Usage

## S3 method for class 'srank'
print(x, digits = 3, ...)

Arguments

x

An object of class srank

digits

the number of significant digits to use when printing

...

further arguments passed to or from other methods


Print an object of class strat

Description

Print an object of class strat

Usage

## S3 method for class 'strat'
print(x, digits = 3, ...)

Arguments

x

An object of class strat

digits

the number of significant digits to use when printing

...

further arguments passed to or from other methods


Ranking strata.

Description

Ranking strata according to the average percentile rank of members in each stratum.

Usage

srank(outcome, strata, weights = NULL, group = NULL)

Arguments

outcome

A numeric vector of outcome.

strata

A vector of length(outcome) indicating strata membership. The elements are coerced to factors by factor.

weights

An optional vector of weights.

group

An optional grouping factor.

Value

An object of class srank.

raw

a data frame consisting of complete cases of all inputs.

summary

a data frame of stratum-specific information, including name, population share, and average percentile rank.

Examples

strata_info <- with(cpsmarch2015, srank(income, big_class,
 weights = weight, group = education))
print(strata_info, digits = 3)

Stratification index.

Description

strat computes the stratification index proposed in Zhou (2012). When group is specified, it also returns between-group and within-group components of the overall stratification.

Usage

strat(outcome, strata, weights = NULL, ordered = FALSE, group = NULL)

Arguments

outcome

A numeric vector of outcome.

strata

A vector of length(outcome) indicating strata membership. The elements are coerced to factors by factor.

weights

An optional vector of weights.

ordered

Logical. If TRUE strata are pre-ordered ascendingly.

group

An optional grouping factor. If specified, strat also returns between-group and within-group components of the overall stratification.

Value

An object of class strat.

overall

a vector of two, giving computed stratification index and approximate standard error.

strata_info

a data frame of stratum-specific information, including name, population share, and average percentile rank.

decomposition

between-group and within-group components of the overall stratification.

within_group

within-group indices of stratification by group.

References

Zhou, Xiang. 2012. "A Nonparametric Index of Stratification." Sociological Methodology, 42(1): 365-389.

Examples

s <- with(cpsmarch2015, strat(income, big_class,
 weights = weight, group = education))
print(s, digits = 4)
print(s$strata_info, digits = 4)
print(s$within_group, digits = 4)