Title: | 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. |
Authors: | Christiana Kartsonaki |
Maintainer: | Christiana Kartsonaki <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.3 |
Built: | 2024-11-19 05:25:03 UTC |
Source: | https://github.com/cran/DECIDE |
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.
Package: | DECIDE |
Type: | Package |
Version: | 1.3 |
Date: | 2022-06-06 |
License: | GPL (>= 2) |
LazyLoad: | yes |
See relative.importance
.
Christiana Kartsonaki
Maintainer: Christiana Kartsonaki <[email protected]>
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
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.
compare.relimp(dataset1, dataset2)
compare.relimp(dataset1, dataset2)
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. |
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 |
Christiana Kartsonaki
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
# 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)
# 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)
Takes a data frame and creates a list of data frames by splitting the data by the factor "class".
create.classdata(dataset)
create.classdata(dataset)
dataset |
A data frame produced by |
data_class |
A list with number of elements equal to the number of classes and each element a data frame for each class. |
Christiana Kartsonaki
# 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)
# 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)
Plots distribution of academic performance and probabilities of transition for each class.
plot_transition(dataset)
plot_transition(dataset)
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. |
A plot of the distributions of performance and transition propensities for each class.
Christiana Kartsonaki
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
# 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)
# 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)
relative.importance
Prepares datasets to be in the format required by the function relative.importance
. It is automatically called by relative.importance
.
prepare.data(dataset)
prepare.data(dataset)
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. |
dataset |
The data frame given as the argument, with column names changed and missing values removed. |
Christiana Kartsonaki
# 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)
# 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)
Presents various estimates for measures of educational differentials, the relative importance of primary and secondary effects and corresponding standard errors and confidence intervals.
print_relimp(dataset)
print_relimp(dataset)
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. |
Returns a more nicely presented version of the results given by relative.importance
.
Christiana Kartsonaki
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
# 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)
# 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)
Calculates various estimates for measures of educational differentials, the relative importance of primary and secondary effects and corresponding standard errors and confidence intervals.
relative.importance(dataset)
relative.importance(dataset)
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. |
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 |
Christiana Kartsonaki
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
# 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)
# 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)