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 |
A dataset containing income, big class, microclass, and education of 14,358 male respondents from March CPS 2015
cpsmarch2015
cpsmarch2015
A data frame with 14358 rows and 5 variables:
personal market income, in US dollars
big class membership
microclass membership
educational attainment
sampling weight given by CPS
srank
Print an object of class srank
## S3 method for class 'srank' print(x, digits = 3, ...)
## S3 method for class 'srank' print(x, digits = 3, ...)
x |
An object of class |
digits |
the number of significant digits to use when printing |
... |
further arguments passed to or from other methods |
strat
Print an object of class strat
## S3 method for class 'strat' print(x, digits = 3, ...)
## S3 method for class 'strat' print(x, digits = 3, ...)
x |
An object of class |
digits |
the number of significant digits to use when printing |
... |
further arguments passed to or from other methods |
Ranking strata according to the average percentile rank of members in each stratum.
srank(outcome, strata, weights = NULL, group = NULL)
srank(outcome, strata, weights = NULL, group = NULL)
outcome |
A numeric vector of outcome. |
strata |
A vector of |
weights |
An optional vector of weights. |
group |
An optional grouping factor. |
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. |
strata_info <- with(cpsmarch2015, srank(income, big_class, weights = weight, group = education)) print(strata_info, digits = 3)
strata_info <- with(cpsmarch2015, srank(income, big_class, weights = weight, group = education)) print(strata_info, digits = 3)
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.
strat(outcome, strata, weights = NULL, ordered = FALSE, group = NULL)
strat(outcome, strata, weights = NULL, ordered = FALSE, group = NULL)
outcome |
A numeric vector of outcome. |
strata |
A vector of |
weights |
An optional vector of weights. |
ordered |
Logical. If |
group |
An optional grouping factor. If specified, |
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. |
Zhou, Xiang. 2012. "A Nonparametric Index of Stratification." Sociological Methodology, 42(1): 365-389.
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)
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)