Type: | Package |
Title: | An Implementation of the Stratification Index |
Version: | 0.1 |
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. |
Depends: | R (≥ 3.3.1), |
Imports: | Hmisc (≥ 4.0-0), Rcpp, stats |
LinkingTo: | Rcpp, RcppArmadillo |
License: | GPL (≥ 3) |
LazyData: | TRUE |
RoxygenNote: | 5.0.1 |
Suggests: | testthat |
URL: | https://github.com/xiangzhou09/strat |
BugReports: | https://github.com/xiangzhou09/strat/issues |
NeedsCompilation: | yes |
Packaged: | 2016-11-22 17:44:43 UTC; xiz225 |
Author: | Xiang Zhou [aut, cre] |
Maintainer: | Xiang Zhou <xiang_zhou@fas.harvard.edu> |
Repository: | CRAN |
Date/Publication: | 2016-11-23 01:26:06 |
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 |
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 |
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 |
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 |
weights |
An optional vector of weights. |
ordered |
Logical. If |
group |
An optional grouping factor. If specified, |
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)