Type: | Package |
Title: | DEComposition of Indirect and Direct Effects |
Version: | 1.3 |
Date: | 2022-06-06 |
Author: | Christiana Kartsonaki |
Maintainer: | Christiana Kartsonaki <christiana.kartsonaki@gmail.com> |
Description: | Calculates various estimates for measures of educational differentials, the relative importance of primary and secondary effects in the creation of such differentials and compares the estimates obtained from two datasets. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
LazyLoad: | yes |
NeedsCompilation: | no |
Packaged: | 2022-06-06 23:02:42 UTC; christianak |
Repository: | CRAN |
Date/Publication: | 2022-06-06 23:20:05 UTC |
Decomposition of Indirect and Direct Effects
Description
Calculates various estimates for measures of educational differentials, the relative importance of primary and secondary effects in the creation of such differentials and compares the estimates obtained from two datasets.
Details
Package: | DECIDE |
Type: | Package |
Version: | 1.3 |
Date: | 2022-06-06 |
License: | GPL (>= 2) |
LazyLoad: | yes |
See relative.importance
.
Author(s)
Christiana Kartsonaki
Maintainer: Christiana Kartsonaki <christiana.kartsonaki@gmail.com>
References
Kartsonaki, C., Jackson, M. and Cox, D. R. (2013). Primary and secondary effects: Some methodological issues, in Jackson, M. (ed.) Determined to succeed?, Stanford: Stanford University Press.
Erikson, R., Goldthorpe, J. H., Jackson, M., Yaish, M. and Cox, D. R. (2005) On Class Differentials in Educational Attainment. Proceedings of the National Academy of Sciences, 102: 9730–9733
Jackson, M., Erikson, R., Goldthorpe, J. H. and Yaish, M. (2007) Primary and secondary effects in class differentials in educational attainment: The transition to A-level courses in England and Wales. Acta Sociologica, 50 (3): 211–229
Compare estimates of log odds, log odds ratios and relative importance obtained by two datasets
Description
Computes 95% confidence intervals for the differences in log odds of transition, log odds ratios and relative importance estimates between the two datasets. Also calculates chi-squared test statistics and p-values for testing whether the differences are different from zero.
Usage
compare.relimp(dataset1, dataset2)
Arguments
dataset1 |
is the first dataset; a data frame with 4 columns, in the following order: 1: student's ID, 2: class, 3: transition (0 if not, 1 if yes) and 4: performance score. |
dataset2 |
is the second dataset; a data frame with 4 columns, in the following order: 1: student's ID, 2: class, 3: transition (0 if not, 1 if yes) and 4: performance score. |
Value
ci.diff.lo |
95% confidence intervals for differences in log odds of transition |
test.diff.lo |
Test statistic for differences in log odds |
test.diff.lo.pvalue |
p-value for testing for differences in log odds |
ci.diff.lor |
95% confidence intervals for differences in log odds ratios |
test.diff.lo |
Test statistic for differences in log odds ratios |
test.diff.lo.pvalue |
p-value for testing for differences in log odds ratios |
ci.diff.ri.1 |
95% confidence intervals for relative importance estimates - 1 |
ci.diff.ri.2 |
95% confidence intervals for relative importance estimates - 2 |
ci.diff.ri.avg |
95% confidence intervals for relative importance estimates - average |
Author(s)
Christiana Kartsonaki
References
Kartsonaki, C., Jackson, M. and Cox, D. R. (2013). Primary and secondary effects: Some methodological issues, in Jackson, M. (ed.) Determined to succeed?, Stanford: Stanford University Press.
Erikson, R., Goldthorpe, J. H., Jackson, M., Yaish, M. and Cox, D. R. (2005) On Class Differentials in Educational Attainment. Proceedings of the National Academy of Sciences, 102: 9730–9733
Jackson, M., Erikson, R., Goldthorpe, J. H. and Yaish, M. (2007) Primary and secondary effects in class differentials in educational attainment: The transition to A-level courses in England and Wales. Acta Sociologica, 50 (3): 211–229
Examples
# generate two datasets
set.seed(1)
data1 <- data.frame(seq(1:10), rep(c(1, 2), length.out = 10),
c(rep(0, times = 3), rep(1, times = 7)),
c(rnorm(4, 0, 1), rnorm(4, 0.5, 1), NA, NA))
data2 <- data.frame(seq(1:10), rep(c(1, 2), length.out = 10),
c(rep(0, times = 5), rep(1, times = 5)),
c(rnorm(5, 1, 1), rnorm(5, 0.5, 1)))
# run function
compare.relimp(data1, data2)
Create data frames for each class
Description
Takes a data frame and creates a list of data frames by splitting the data by the factor "class".
Usage
create.classdata(dataset)
Arguments
dataset |
A data frame produced by |
Value
data_class |
A list with number of elements equal to the number of classes and each element a data frame for each class. |
Author(s)
Christiana Kartsonaki
Examples
# generate a dataset
data <- data.frame(seq(1:10), rep(c(1, 2, 3), length.out = 10),
rbinom(1, n = 10, p = 0.7), c(rnorm(8, 0, 1), NA, NA))
data_clean <- prepare.data(data)
create.classdata(data_clean)
Plot distributions of performance and transition propensities
Description
Plots distribution of academic performance and probabilities of transition for each class.
Usage
plot_transition(dataset)
Arguments
dataset |
A data frame with 4 columns only, in the following order: 1: student's ID, 2: class, 3: transition (0 if not, 1 if yes) and 4: performance score. |
Value
A plot of the distributions of performance and transition propensities for each class.
Author(s)
Christiana Kartsonaki
References
Erikson, R., Goldthorpe, J. H., Jackson, M., Yaish, M. and Cox, D. R. (2005) On Class Differentials in Educational Attainment. Proceedings of the National Academy of Sciences, 102: 9730–9733
Kartsonaki, C., Jackson, M. and Cox, D. R. (2013). Primary and secondary effects: Some methodological issues, in Jackson, M. (ed.) Determined to succeed?, Stanford: Stanford University Press.
Jackson, M., Erikson, R., Goldthorpe, J. H. and Yaish, M. (2007) Primary and secondary effects in class differentials in educational attainment: The transition to A-level courses in England and Wales. Acta Sociologica, 50 (3): 211–229
Examples
# generate a dataset
set.seed(1)
data <- data.frame(seq(1:10), rep(c(1, 2), length.out = 10),
c(rep(0, times = 3), rep(1, times = 7)),
c(rnorm(4, 0, 1), rnorm(4, 0.5, 1), NA, NA))
# run function
plot_transition(data)
Prepare dataset to be used in relative.importance
Description
Prepares datasets to be in the format required by the function relative.importance
. It is automatically called by relative.importance
.
Usage
prepare.data(dataset)
Arguments
dataset |
A data frame with 4 columns only, in the following order: 1: student's ID, 2: class, 3: transition (0 if not, 1 if yes) and 4: performance score. |
Value
dataset |
The data frame given as the argument, with column names changed and missing values removed. |
Author(s)
Christiana Kartsonaki
Examples
# generate a dataset
data <- data.frame(seq(1:10), rep(c(1, 2, 3), length.out = 10),
rbinom(1, n = 10, p = 0.7), c(rnorm(8, 0, 1), NA, NA))
# run function
data_clean <- prepare.data(data)
Print tables of estimates
Description
Presents various estimates for measures of educational differentials, the relative importance of primary and secondary effects and corresponding standard errors and confidence intervals.
Usage
print_relimp(dataset)
Arguments
dataset |
A data frame with 4 columns only, in the following order: 1: student's ID, 2: class, 3: transition (0 if not, 1 if yes) and 4: performance score. |
Value
Returns a more nicely presented version of the results given by relative.importance
.
Author(s)
Christiana Kartsonaki
References
Kartsonaki, C., Jackson, M. and Cox, D. R. (2013). Primary and secondary effects: Some methodological issues, in Jackson, M. (ed.) Determined to succeed?, Stanford: Stanford University Press.
Erikson, R., Goldthorpe, J. H., Jackson, M., Yaish, M. and Cox, D. R. (2005) On Class Differentials in Educational Attainment. Proceedings of the National Academy of Sciences, 102: 9730–9733
Jackson, M., Erikson, R., Goldthorpe, J. H. and Yaish, M. (2007) Primary and secondary effects in class differentials in educational attainment: The transition to A-level courses in England and Wales. Acta Sociologica, 50 (3): 211–229
See Also
Examples
# generate a dataset
set.seed(1)
data <- data.frame(seq(1:10), rep(c(1, 2, 3), length.out = 10),
rbinom(1, n = 10, p = 0.7), c(rnorm(8, 0, 1), NA, NA))
# run function
print_relimp(data)
Relative importance of primary and secondary effects
Description
Calculates various estimates for measures of educational differentials, the relative importance of primary and secondary effects and corresponding standard errors and confidence intervals.
Usage
relative.importance(dataset)
Arguments
dataset |
A data frame with 4 columns only, in the following order: 1: student's ID, 2: class, 3: transition (0 if not, 1 if yes) and 4: performance score. |
Value
sample_size |
Total number of individuals |
no_classes |
Number of classes |
class_size |
A list of |
percentage_overall |
Overall percentage that made the transition |
percentage_class |
A list of |
fifty_point |
50% point of transition |
parameters |
A data frame with the parameters of logistic regression ( |
transition_prob |
A data frame with the transition probabilities |
log_odds |
A data frame with log odds of transition (diagonal elements: actual log odds for each class, off-diagonal: counterfactual log odds) |
se_logodds |
A data frame with the standard errors of the log odds of transition |
ci_logodds |
Approximate 95% confidence intervals for the log odds of transition |
odds |
Odds of transition |
log_oddsratios |
Log odds ratios |
se_logoddsratios |
Standard errors for the log odds ratios |
ci_logoddsratios |
Approximate 95% confidence intervals for the log odds ratios |
oddsratios |
Odds ratios |
rel_imp_prim1 |
Estimates of the relative importance of primary effects using the first equation for calculating the relative importance |
rel_imp_prim2 |
Estimates of the relative importance of primary effects using the second equation for calculating the relative importance |
rel_imp_prim_avg |
Estimates of the relative importance of primary effects using the the average of the two equations for calculating the relative importance |
rel_imp_sec1 |
Estimates of the relative importance of secondary effects using the first equation for calculating the relative importance |
rel_imp_sec2 |
Estimates of the relative importance of secondary effects using the second equation for calculating the relative importance |
rel_imp_sec_avg |
Estimates of the relative importance of secondary effects using the the average of the two equations for calculating the relative importance |
se.ri.1 |
Standard errors of the relative importance estimates given by the first equation |
ci.ri.1 |
Approximate 95% confidence intervals for the relative importance of secondary effects given by the first equation |
se.ri.2 |
Standard errors of the relative importance estimates given by the second equation |
ci.ri.2 |
Approximate 95% confidence intervals for the relative importance of secondary effects given by the second equation |
se.ri.avg |
Standard errors of the relative importance estimates given by the average of the two equations |
ci.ri.avg |
Approximate 95% confidence intervals for the relative importance of secondary effects given by the average of the two equations |
Author(s)
Christiana Kartsonaki
References
Kartsonaki, C., Jackson, M. and Cox, D. R. (2013). Primary and secondary effects: Some methodological issues, in Jackson, M. (ed.) Determined to succeed?, Stanford: Stanford University Press.
Erikson, R., Goldthorpe, J. H., Jackson, M., Yaish, M. and Cox, D. R. (2005) On Class Differentials in Educational Attainment. Proceedings of the National Academy of Sciences, 102: 9730–9733
Jackson, M., Erikson, R., Goldthorpe, J. H. and Yaish, M. (2007) Primary and secondary effects in class differentials in educational attainment: The transition to A-level courses in England and Wales. Acta Sociologica, 50 (3): 211–229
See Also
Examples
# generate a dataset
set.seed(1)
data <- data.frame(seq(1:10), rep(c(1, 2), length.out = 10),
c(rep(0, times = 3), rep(1, times = 7)),
c(rnorm(4, 0, 1), rnorm(4, 0.5, 1), NA, NA))
# run function
relative.importance(data)