Skip to content

Commit

Permalink
update according to CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
elbersb committed Apr 15, 2018
1 parent 6890379 commit bc0e3ff
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 61 deletions.
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
MIT License

Copyright (c) 2018 Benjamin Elbers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2018
COPYRIGHT HOLDER: Benjamin Elbers
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on the Mutual Information Index (M).
- calculate total, between, within, and local segregation
- decompose differences in total segregation over time
- estimate standard errors via bootstrapping
- every method returns a [tidy](https://cran.r-project.org/web/packages/tidyr/vignettes/tidy-data.html) data frame (or [tibble](https://cran.r-project.org/web/packages/tibble/vignettes/tibble.html), if the package is installed) for easy post-processing and plotting
- every method returns a [tidy](http://vita.had.co.nz/papers/tidy-data.html) data frame (or [tibble](http://tibble.tidyverse.org), if the package is installed) for easy post-processing and plotting
- it's fast, because it uses the [`data.table`](https://github.com/Rdatatable/data.table/wiki) package internally

## Example
Expand Down
103 changes: 65 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@
segregation
===========

An R package to calculate entropy-based segregation indices, with a focus on the Mutual Information Index (M).
An R package to calculate entropy-based segregation indices, with a
focus on the Mutual Information Index (M).

- calculate total, between, within, and local segregation
- decompose differences in total segregation over time
- estimate standard errors via bootstrapping
- every method returns a [tidy](https://cran.r-project.org/web/packages/tidyr/vignettes/tidy-data.html) data frame (or [tibble](https://cran.r-project.org/web/packages/tibble/vignettes/tibble.html), if the package is installed) for easy post-processing and plotting
- it's fast, because it uses the [`data.table`](https://github.com/Rdatatable/data.table/wiki) package internally
- every method returns a
[tidy](http://vita.had.co.nz/papers/tidy-data.html) data frame (or
[tibble](http://tibble.tidyverse.org), if the package is installed)
for easy post-processing and plotting
- it’s fast, because it uses the
[`data.table`](https://github.com/Rdatatable/data.table/wiki)
package internally

Example
-------

The package provides an easy way to calculate total and local segregation, based on the Mutual Information Index.
The package provides an easy way to calculate total and local
segregation, based on the Mutual Information Index.

``` r
library(segregation)
Expand All @@ -22,7 +29,7 @@ mutual_total(schools00, "school", "race", weight = "n")
#> # A tibble: 3 x 2
#> stat est
#> * <chr> <dbl>
#> 1 M 0.425
#> 1 M 0.426
#> 2 M_min 0.
#> 3 M_max 1.61
```
Expand All @@ -35,50 +42,52 @@ mutual_total(schools00, "school", "race", weight = "n", se = TRUE)
#> # A tibble: 3 x 3
#> stat est se
#> * <chr> <dbl> <dbl>
#> 1 M 0.429 0.000851
#> 1 M 0.429 0.000935
#> 2 M_min 0. 0.
#> 3 M_max 1.61 0.
```

Local segregation (`ls`) of racial groups, with group-specific standard errors:
Local segregation (`ls`) of racial groups, with group-specific standard
errors:

``` r
mutual_local(schools00, "school", "race", weight = "n", se = TRUE)
#> ..........
#> # A tibble: 15 x 4
#> race stat est se
#> <fct> <fct> <dbl> <dbl>
#> 1 native ls 1.53 0.0134
#> 2 asian ls 0.663 0.00302
#> 3 hisp ls 0.781 0.00141
#> 4 black ls 0.889 0.00251
#> 5 white ls 0.184 0.000806
#> 6 native p 0.00760 0.0000859
#> 7 asian p 0.0227 0.000136
#> 8 hisp p 0.152 0.000426
#> 9 black p 0.189 0.000254
#> 10 white p 0.629 0.000584
#> 11 native M_group 0.0116 0.000162
#> 12 asian M_group 0.0151 0.000134
#> 13 hisp M_group 0.119 0.000391
#> 14 black M_group 0.168 0.000502
#> 15 white M_group 0.115 0.000427
#> race stat est se
#> <fct> <fct> <dbl> <dbl>
#> 1 asian ls 0.667 0.00674
#> 2 black ls 0.885 0.00259
#> 3 hisp ls 0.782 0.00258
#> 4 white ls 0.184 0.000725
#> 5 native ls 1.53 0.0229
#> 6 asian p 0.0226 0.000124
#> 7 black p 0.190 0.000465
#> 8 hisp p 0.152 0.000317
#> 9 white p 0.628 0.000687
#> 10 native p 0.00745 0.000135
#> 11 asian M_group 0.0151 0.000193
#> 12 black M_group 0.168 0.000354
#> 13 hisp M_group 0.119 0.000336
#> 14 white M_group 0.116 0.000357
#> 15 native M_group 0.0114 0.000101
```

Decompose the difference in segregation between 2000 and 2005, using the method developed by Mora and Ruiz-Castillo (2009):
Decompose the difference in segregation between 2000 and 2005, using the
method developed by Mora and Ruiz-Castillo (2009):

``` r
mutual_difference(schools00, schools05, "school", "race",
weight = "n", method = "mrc")
#> # A tibble: 6 x 2
#> stat est
#> * <chr> <dbl>
#> 1 M1 0.425
#> 2 M2 0.415
#> 3 diff -0.0102
#> 4 group_marginal 0.00768
#> 5 unit_entropy -0.0639
#> 6 invariant 0.0460
#> 1 M1 0.426
#> 2 M2 0.413
#> 3 diff -0.0122
#> 4 group_marginal 0.00747
#> 5 unit_entropy -0.0641
#> 6 invariant 0.0445
```

How to install
Expand All @@ -103,18 +112,36 @@ Papers using the Mutual information index

(list incomplete)

- DiPrete, T. A., Eller, C. C., Bol, T., & van de Werfhorst, H. G. (2017). School-to-Work Linkages in the United States, Germany, and France. American Journal of Sociology, 122(6), 1869-1938. <https://doi.org/10.1086/691327>
- Forster, A. G., & Bol, T. (2017). Vocational education and employment over the life course using a new measure of occupational specificity. Social Science Research, 70, 176-197. <https://doi.org/10.1016/j.ssresearch.2017.11.004>
- Van Puyenbroeck, T., De Bruyne, K., & Sels, L. (2012). More than ‘Mutual Information’: Educational and sectoral gender segregation and their interaction on the Flemish labor market. Labour Economics, 19(1), 1-8. <https://doi.org/10.1016/j.labeco.2011.05.002>
- Mora, R., & Ruiz-Castillo, J. (2003). Additively decomposable segregation indexes. The case of gender segregation by occupations and human capital levels in Spain. The Journal of Economic Inequality, 1(2), 147-179. <https://doi.org/10.1023/A:1026198429377>
- DiPrete, T. A., Eller, C. C., Bol, T., & van de Werfhorst, H. G.
(2017). School-to-Work Linkages in the United States, Germany, and
France. American Journal of Sociology, 122(6), 1869-1938.
<https://doi.org/10.1086/691327>
- Forster, A. G., & Bol, T. (2017). Vocational education and
employment over the life course using a new measure of occupational
specificity. Social Science Research, 70, 176-197.
<https://doi.org/10.1016/j.ssresearch.2017.11.004>
- Van Puyenbroeck, T., De Bruyne, K., & Sels, L. (2012). More than
‘Mutual Information’: Educational and sectoral gender segregation
and their interaction on the Flemish labor market. Labour Economics,
19(1), 1-8. <https://doi.org/10.1016/j.labeco.2011.05.002>
- Mora, R., & Ruiz-Castillo, J. (2003). Additively decomposable
segregation indexes. The case of gender segregation by occupations
and human capital levels in Spain. The Journal of Economic
Inequality, 1(2), 147-179. <https://doi.org/10.1023/A:1026198429377>

References on entropy-based segregation indices
-----------------------------------------------

Theil, Henri. (1971). Principles of Econometrics. New York: Wiley.

Frankel, D. M., & Volij, O. (2011). Measuring school segregation. Journal of Economic Theory, 146(1), 1-38. <https://doi.org/10.1016/j.jet.2010.10.008>
Frankel, D. M., & Volij, O. (2011). Measuring school segregation.
Journal of Economic Theory, 146(1), 1-38.
<https://doi.org/10.1016/j.jet.2010.10.008>

Mora, R., & Ruiz-Castillo, J. (2009). The Invariance Properties of the Mutual Information Index of Multigroup Segregation. Research on Economic Inequality, 17, 33-53.
Mora, R., & Ruiz-Castillo, J. (2009). The Invariance Properties of the
Mutual Information Index of Multigroup Segregation. Research on Economic
Inequality, 17, 33-53.

Mora, R., & Ruiz-Castillo, J. (2011). Entropy-based Segregation Indices. Sociological Methodology, 41(1), 159–194. <https://doi.org/10.1111/j.1467-9531.2011.01237.x>
Mora, R., & Ruiz-Castillo, J. (2011). Entropy-based Segregation Indices.
Sociological Methodology, 41(1), 159–194.
<https://doi.org/10.1111/j.1467-9531.2011.01237.x>
5 changes: 4 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
This is the first submission of this package.
This is a resubmission.

* fixed LICENSE file
* updated URLs in README

## Test environments

Expand Down

0 comments on commit bc0e3ff

Please sign in to comment.