Init

options(digits = 2)
library(pacman)
p_load(kirkegaard, readr, polycor)

Data

#call the NLSY R file to load the data
source("data/nlsy97_race_income.R")

#rename
d = new_data; rm(new_data)

#var table
var_table = data_frame(
  var = names(d),
  label = varlabels
)

Recode

##INCOME
#average the income data
income_data = d[var_table$var[which(str_detect(var_table$label, "^TTL"))]]

#add years
income_years = str_match(var_table$label, "PAST YR (\\d{4})") %>% .[, 2] %>% na.omit()
colnames(income_data) = "income_" + income_years

#z score
income_data_z = income_data %>% df_standardize()

#log
income_log_data = df_colFunc(income_data, function(x) log(x + 1))

#cors
wtd.cors(income_data) %>% 
  MAT_half() %>% 
  describe() %>% unclass()
## $vars
## [1] 1
## 
## $n
## [1] 120
## 
## $mean
## [1] 0.37
## 
## $sd
## [1] 0.21
## 
## $median
## [1] 0.33
## 
## $trimmed
## [1] 0.36
## 
## $mad
## [1] 0.25
## 
## $min
## [1] 0.064
## 
## $max
## [1] 0.84
## 
## $range
## [1] 0.78
## 
## $skew
## [1] 0.46
## 
## $kurtosis
## [1] -1
## 
## $se
## [1] 0.019
## 
## attr(,"row.names")
## [1] "X1"
wtd.cors(income_log_data) %>% 
  MAT_half() %>% 
  describe() %>% unclass()
## $vars
## [1] 1
## 
## $n
## [1] 120
## 
## $mean
## [1] 0.27
## 
## $sd
## [1] 0.13
## 
## $median
## [1] 0.24
## 
## $trimmed
## [1] 0.26
## 
## $mad
## [1] 0.15
## 
## $min
## [1] 0.077
## 
## $max
## [1] 0.55
## 
## $range
## [1] 0.48
## 
## $skew
## [1] 0.45
## 
## $kurtosis
## [1] -1
## 
## $se
## [1] 0.012
## 
## attr(,"row.names")
## [1] "X1"
#missing data
miss_plot(income_data)

#impute
income_data_imputed = miss_impute(income_data, max_na = 10)

#average of imputed
d$income_imputed = rowMeans(income_data_imputed)

#average all data without imputing
#results in higher N, but some bias due to selective missing data
d$income_simple = rowMeans(income_data, na.rm = T)

#log version
d$income_log = rowMeans(income_log_data, na.rm = T)

#post-education income only; age >= 25
post_edu_income = income_data["income_" + c(2007:2011, 2013)]
d$income_post_edu = post_edu_income %>% df_standardize() %>% rowMeans(na.rm=T)
d$income_post_edu_log = post_edu_income %>% df_colFunc(function(x) log(x + 1) %>% standardize()) %>% rowMeans(na.rm=T)

##AGE
#born
d$born = d$R0536402
GG_denhist(d, "born")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

#calculate age from month and year
#subtract from 2013, last year of data
d$age = (parse_date("06 2013", "%m %Y") - sprintf("%d %d", d$R0536401, d$R0536402) %>% parse_date(format = "%m %Y")) %>% as.numeric() %>% divide_by(365.24)
GG_denhist(d, "age")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##SEX
d$sex = if_else(d$R0536300 == 1, true = "Male", false = "Female") %>% factor()

##IQ
#AFQT
d$AFQT = d$R9829600 %>% 
  #recode 0 and 100 centiles
  winsorise(99999, 1) %>% 
  #convert to fraction
  divide_by(100000) %>% 
  #convert to Z score
  qnorm()

#plot
GG_denhist(d, "AFQT")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 1891 rows containing non-finite values (stat_bin).
## Warning: Removed 1891 rows containing non-finite values (stat_density).

#PPAT
#multiple scores
PIAT_data = d[var_table$var[which(str_detect(var_table$label, "^CV_PIAT"))]]

#z score
PIAT_data %<>% df_standardize()

#cors
wtd.cors(PIAT_data) %T>% 
  print() %>% 
  MAT_half() %>% 
  describe() %>% unclass()
##          R5473700 R7237400 S1552700
## R5473700     1.00     0.76     0.78
## R7237400     0.76     1.00     0.77
## S1552700     0.78     0.77     1.00
## $vars
## [1] 1
## 
## $n
## [1] 3
## 
## $mean
## [1] 0.77
## 
## $sd
## [1] 0.0092
## 
## $median
## [1] 0.77
## 
## $trimmed
## [1] 0.77
## 
## $mad
## [1] 0.0036
## 
## $min
## [1] 0.76
## 
## $max
## [1] 0.78
## 
## $range
## [1] 0.017
## 
## $skew
## [1] 0.36
## 
## $kurtosis
## [1] -2.3
## 
## $se
## [1] 0.0053
## 
## attr(,"row.names")
## [1] "X1"
#simple mean will do
d$PIAT = rowMeans(PIAT_data, na.rm=T)

#plot
GG_denhist(d, "PIAT")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 7335 rows containing non-finite values (stat_bin).
## Warning: Removed 7335 rows containing non-finite values (stat_density).

#SAT and ACT for comparison
d$SAT_math = d$Z9033700
d$SAT_verbal = d$Z9033900
d$SAT = rowMeans(d[c("SAT_verbal", "SAT_math")], na.rm=T)
d$ACT = d$Z9034100

#g factor
d$GCA = rowMeans(d[c("AFQT", "PIAT")], na.rm = T)

##RACE
#self-perceived dummy version, 2002
SPRE_data = d[c("S122490" + 0:5, "R0538600")] %>% 
  set_colnames(c("White", "Black", "Asian", "Pacific Islander", "American Indian", "Other", "Hispanic")) %>% 
  df_colFunc(as.logical)

#standard coding
d$SPRE = plyr::aaply(SPRE_data, .margins = 1, .expand = F, function(x) {
  #all NA? code missing
  if (all(is.na(x))) return(NA)
  
  #otherwise, impute false
  x[is.na(x)] = F
  
  #is hispanic?
  if (x$Hispanic) return("Hispanic")
  
  #is only 1 non-hipanic?
  if (sum(x %>% unlist()) == 1) {
    return(names(which(x %>% unlist())))
  }
  
  #multiracial
  "Multi-racial"
}) %>% factor() %>% fct_relevel("White")

#table
table2(d$SPRE)
#other-perceived
d$OPRE = d$R2395200 %>% plyr::mapvalues(1:3, c("White", "Black", "Other")) %>% factor() %>% fct_relevel("White")
table2(d$OPRE)
#skin tone
skin_data = d[c("T3173000", "T4584700", "T6217800")]

#regress out interviewer effect on ratings
#code interviewer data
interviewer_race_data = d[c("T2023300", "T3614100", "T5214000")] %>% df_colFunc(function(x) plyr::mapvalues(x, 1:6, c("White", "Black", "American Indian", "Asian", "Other", "Multiracial")))
## The following `from` values were not present in `x`: 3
## The following `from` values were not present in `x`: 3, 4, 5
## The following `from` values were not present in `x`: 3
#regression
skin_data_fixed = map2_df(skin_data, interviewer_race_data, function(x, y) {
  #make temp df
  tmp = data.frame(x, y) %>% set_colnames(c("skin_tone", "interviewer"))
  
  #model, resids, standardize
  lm(skin_tone ~ interviewer, data = tmp, na.action = na.exclude) %>% resid() %>% standardize()
})

#use mean; no repeated measures
d$skin_tone = rowMeans(skin_data, na.rm=T)
d$skin_tone_fixed = rowMeans(skin_data_fixed, na.rm=T)

#short versions
d$income = d$income_post_edu

#standardized versions
d2 = d[c("GCA", "income", "age", "sex", "SPRE", "OPRE", "skin_tone", "skin_tone_fixed")] %>% df_standardize()
## Skipped sex because it is a factor.
## Skipped SPRE because it is a factor.
## Skipped OPRE because it is a factor.

Results

Correlations

#cors
hetcor(d[c("GCA", "AFQT", "PIAT", "SAT", "ACT", "income_imputed", "income_simple", "income_log", "income_post_edu", "income_post_edu_log", "skin_tone", "skin_tone_fixed", "age", "sex")], use = "pairwise")
## Warning in hetcor.data.frame(d[c("GCA", "AFQT", "PIAT", "SAT", "ACT",
## "income_imputed", : the correlation matrix has been adjusted to make it
## positive-definite
## 
## Two-Step Estimates
## 
## Correlations/Type of Correlation:
##                         GCA     AFQT    PIAT     SAT      ACT
## GCA                       1  Pearson Pearson Pearson  Pearson
## AFQT                  0.958        1 Pearson Pearson  Pearson
## PIAT                  0.921    0.778       1 Pearson  Pearson
## SAT                   0.608    0.601   0.609       1  Pearson
## ACT                    0.66    0.669   0.576   0.552        1
## income_imputed        0.196    0.199   0.185   0.137   0.0754
## income_simple         0.228    0.224   0.211   0.134   0.0894
## income_log            0.151    0.147   0.133  0.0161 -0.00199
## income_post_edu       0.318    0.312   0.298   0.197    0.163
## income_post_edu_log   0.285    0.283   0.242   0.131    0.123
## skin_tone            -0.367   -0.364   -0.35  -0.263   -0.326
## skin_tone_fixed      -0.357   -0.357  -0.341  -0.279   -0.313
## age                 -0.0193 -0.00663  0.0173 -0.0191  0.00159
## sex                 -0.0314  -0.0463  0.0762  0.0925   0.0526
##                     income_imputed income_simple income_log
## GCA                        Pearson       Pearson    Pearson
## AFQT                       Pearson       Pearson    Pearson
## PIAT                       Pearson       Pearson    Pearson
## SAT                        Pearson       Pearson    Pearson
## ACT                        Pearson       Pearson    Pearson
## income_imputed                   1       Pearson    Pearson
## income_simple                0.914             1    Pearson
## income_log                   0.641          0.72          1
## income_post_edu              0.942         0.894      0.547
## income_post_edu_log          0.716         0.653      0.749
## skin_tone                   -0.142        -0.158     -0.112
## skin_tone_fixed             -0.138        -0.153     -0.102
## age                           0.29         0.149      0.176
## sex                          0.277         0.238      0.159
##                     income_post_edu income_post_edu_log skin_tone
## GCA                         Pearson             Pearson   Pearson
## AFQT                        Pearson             Pearson   Pearson
## PIAT                        Pearson             Pearson   Pearson
## SAT                         Pearson             Pearson   Pearson
## ACT                         Pearson             Pearson   Pearson
## income_imputed              Pearson             Pearson   Pearson
## income_simple               Pearson             Pearson   Pearson
## income_log                  Pearson             Pearson   Pearson
## income_post_edu                   1             Pearson   Pearson
## income_post_edu_log           0.693                   1   Pearson
## skin_tone                    -0.187              -0.169         1
## skin_tone_fixed               -0.18              -0.161     0.993
## age                           0.164              0.0943     0.018
## sex                           0.224               0.143    0.0262
##                     skin_tone_fixed      age        sex
## GCA                         Pearson  Pearson Polyserial
## AFQT                        Pearson  Pearson Polyserial
## PIAT                        Pearson  Pearson Polyserial
## SAT                         Pearson  Pearson Polyserial
## ACT                         Pearson  Pearson Polyserial
## income_imputed              Pearson  Pearson Polyserial
## income_simple               Pearson  Pearson Polyserial
## income_log                  Pearson  Pearson Polyserial
## income_post_edu             Pearson  Pearson Polyserial
## income_post_edu_log         Pearson  Pearson Polyserial
## skin_tone                   Pearson  Pearson Polyserial
## skin_tone_fixed                   1  Pearson Polyserial
## age                         0.00604        1 Polyserial
## sex                          0.0197 -0.00893          1
## 
## Standard Errors/Numbers of Observations:
##                          GCA   AFQT   PIAT    SAT    ACT income_imputed
## GCA                     7396   7093   1649   2132   1771           5420
## AFQT                0.000256   7093   1346   2057   1722           5262
## PIAT                 0.00263 0.0114   1649    487    409           1138
## SAT                   0.0137 0.0141 0.0285   2493    575           2053
## ACT                   0.0134 0.0133 0.0331 0.0291   2005           1677
## income_imputed         0.013 0.0132 0.0287 0.0217 0.0243           6340
## income_simple         0.0112 0.0114  0.024 0.0198 0.0223        0.00207
## income_log            0.0115 0.0118 0.0246 0.0201 0.0224         0.0074
## income_post_edu       0.0112 0.0115  0.024 0.0204 0.0229        0.00142
## income_post_edu_log   0.0115 0.0117 0.0248 0.0208 0.0232        0.00619
## skin_tone             0.0115 0.0117 0.0241 0.0215 0.0225         0.0134
## skin_tone_fixed       0.0127 0.0129 0.0265 0.0232  0.025         0.0147
## age                   0.0116 0.0119 0.0246   0.02 0.0223         0.0115
## sex                   0.0146 0.0149 0.0307 0.0249  0.028         0.0154
##                     income_simple income_log income_post_edu
## GCA                          7209       7209            6413
## AFQT                         6925       6925            6167
## PIAT                         1593       1593            1441
## SAT                          2464       2464            2232
## ACT                          1988       1988            1803
## income_imputed               6340       6340            6212
## income_simple                8685       8685            7634
## income_log                0.00517       8685            7634
## income_post_edu           0.00231    0.00802            7634
## income_post_edu_log       0.00657    0.00503         0.00596
## skin_tone                   0.012     0.0121          0.0122
## skin_tone_fixed            0.0131     0.0133          0.0133
## age                        0.0105     0.0104          0.0111
## sex                        0.0132     0.0132          0.0142
##                     income_post_edu_log skin_tone skin_tone_fixed    age
## GCA                                6413      5678            4745   7396
## AFQT                               6167      5447            4549   7093
## PIAT                               1441      1325            1115   1649
## SAT                                2232      1872            1580   2493
## ACT                                1803      1576            1307   2005
## income_imputed                     6212      5309            4474   6340
## income_simple                      7634      6636            5561   8685
## income_log                         7634      6636            5561   8685
## income_post_edu                    7634      6308            5284   7634
## income_post_edu_log                7634      6308            5284   7634
## skin_tone                        0.0122      6723            5631   6723
## skin_tone_fixed                  0.0134  0.000177            5631   5631
## age                              0.0113    0.0122          0.0133   8984
## sex                              0.0143    0.0153          0.0167 0.0132
##                      sex
## GCA                 7396
## AFQT                7093
## PIAT                1649
## SAT                 2493
## ACT                 2005
## income_imputed      6340
## income_simple       8685
## income_log          8685
## income_post_edu     7634
## income_post_edu_log 7634
## skin_tone           6723
## skin_tone_fixed     5631
## age                 8984
## sex                 8984
## 
## P-values for Tests of Bivariate Normality:
##                                       GCA      AFQT     PIAT       SAT
## GCA                                                                   
## AFQT                             1.44e-94                             
## PIAT                             2.52e-22  1.16e-06                   
## SAT                 4.94065645841247e-324  4.2e-298  1.1e-61          
## ACT                                     0         0 4.91e-88 2.16e-102
## income_imputed                   3.93e-81  2.45e-71 1.36e-88  1.22e-68
## income_simple                    2.13e-37  1.16e-32 6.86e-36  1.09e-83
## income_log                       6.4e-116 3.26e-118 9.91e-20 1.41e-131
## income_post_edu                  3.24e-62  7.87e-56 5.22e-53 1.61e-102
## income_post_edu_log             6.14e-287 2.22e-285 2.26e-78  9.1e-243
## skin_tone                               0         0  2.4e-85 1.12e-194
## skin_tone_fixed                 2.69e-201 3.95e-195 5.83e-48 4.82e-142
## age                              9.58e-83  1.14e-52        0  6.66e-97
## sex                               0.00206   0.00625 1.34e-07  1.48e-71
##                           ACT income_imputed income_simple income_log
## GCA                                                                  
## AFQT                                                                 
## PIAT                                                                 
## SAT                                                                  
## ACT                                                                  
## income_imputed      6.07e-249                                        
## income_simple       2.33e-286              0                         
## income_log                  0              0             0           
## income_post_edu      2.7e-271      7.39e-167     1.54e-246          0
## income_post_edu_log         0              0             0          0
## skin_tone                   0              0             0          0
## skin_tone_fixed     7.79e-257      1.44e-275     9.53e-250          0
## age                 4.28e-298      8.04e-112     6.89e-128  1.51e-206
## sex                 1.01e-284       3.56e-47      7.23e-48  2.69e-118
##                     income_post_edu income_post_edu_log skin_tone
## GCA                                                              
## AFQT                                                             
## PIAT                                                             
## SAT                                                              
## ACT                                                              
## income_imputed                                                   
## income_simple                                                    
## income_log                                                       
## income_post_edu                                                  
## income_post_edu_log               0                              
## skin_tone                         0                   0          
## skin_tone_fixed           1.23e-283                   0         0
## age                       7.11e-141                   0         0
## sex                        1.13e-69                   0         0
##                     skin_tone_fixed      age
## GCA                                         
## AFQT                                        
## PIAT                                        
## SAT                                         
## ACT                                         
## income_imputed                              
## income_simple                               
## income_log                                  
## income_post_edu                             
## income_post_edu_log                         
## skin_tone                                   
## skin_tone_fixed                             
## age                       1.93e-268         
## sex                       6.41e-223 3.09e-84
#for blacks and hispanics
hetcor(d %>% filter(SPRE == "Black") %>% .[c("GCA", "AFQT", "PIAT", "SAT", "ACT", "income_imputed", "income_simple", "income_log", "income_post_edu", "income_post_edu_log", "skin_tone", "skin_tone_fixed", "age", "sex")], use = "pairwise")
## Warning in hetcor.data.frame(d %>% filter(SPRE == "Black") %>% .[c("GCA", :
## the correlation matrix has been adjusted to make it positive-definite
## 
## Two-Step Estimates
## 
## Correlations/Type of Correlation:
##                         GCA    AFQT    PIAT     SAT     ACT income_imputed
## GCA                       1 Pearson Pearson Pearson Pearson        Pearson
## AFQT                  0.936       1 Pearson Pearson Pearson        Pearson
## PIAT                  0.879   0.682       1 Pearson Pearson        Pearson
## SAT                   0.426   0.394    0.54       1 Pearson        Pearson
## ACT                   0.404   0.415   0.352   0.291       1        Pearson
## income_imputed        0.327   0.343   0.295   0.114   0.069              1
## income_simple         0.375   0.376   0.354    0.17  0.0986          0.913
## income_log            0.316   0.312   0.333   0.131  0.0608          0.662
## income_post_edu       0.406   0.408   0.362   0.166   0.168          0.944
## income_post_edu_log   0.354   0.359   0.306   0.132   0.142          0.711
## skin_tone            -0.114    -0.1  -0.168 -0.0792 -0.0411         -0.013
## skin_tone_fixed     -0.0921 -0.0794   -0.15  -0.075 -0.0281        0.00318
## age                 -0.0682 -0.0325  0.0354 -0.0389  0.0655          0.265
## sex                 -0.0933  -0.106  0.0278 -0.0123  -0.117           0.16
##                     income_simple income_log income_post_edu
## GCA                       Pearson    Pearson         Pearson
## AFQT                      Pearson    Pearson         Pearson
## PIAT                      Pearson    Pearson         Pearson
## SAT                       Pearson    Pearson         Pearson
## ACT                       Pearson    Pearson         Pearson
## income_imputed            Pearson    Pearson         Pearson
## income_simple                   1    Pearson         Pearson
## income_log                  0.737          1         Pearson
## income_post_edu             0.915      0.602               1
## income_post_edu_log         0.668      0.796           0.695
## skin_tone                 -0.0364    -0.0265          -0.042
## skin_tone_fixed           -0.0215     -0.011          -0.019
## age                         0.121       0.15           0.147
## sex                         0.102     0.0038           0.103
##                     income_post_edu_log skin_tone skin_tone_fixed     age
## GCA                             Pearson   Pearson         Pearson Pearson
## AFQT                            Pearson   Pearson         Pearson Pearson
## PIAT                            Pearson   Pearson         Pearson Pearson
## SAT                             Pearson   Pearson         Pearson Pearson
## ACT                             Pearson   Pearson         Pearson Pearson
## income_imputed                  Pearson   Pearson         Pearson Pearson
## income_simple                   Pearson   Pearson         Pearson Pearson
## income_log                      Pearson   Pearson         Pearson Pearson
## income_post_edu                 Pearson   Pearson         Pearson Pearson
## income_post_edu_log                   1   Pearson         Pearson Pearson
## skin_tone                       -0.0378         1         Pearson Pearson
## skin_tone_fixed                 -0.0141     0.987               1 Pearson
## age                              0.0786   -0.0221         -0.0263       1
## sex                            -0.00901     0.126           0.134 -0.0312
##                            sex
## GCA                 Polyserial
## AFQT                Polyserial
## PIAT                Polyserial
## SAT                 Polyserial
## ACT                 Polyserial
## income_imputed      Polyserial
## income_simple       Polyserial
## income_log          Polyserial
## income_post_edu     Polyserial
## income_post_edu_log Polyserial
## skin_tone           Polyserial
## skin_tone_fixed     Polyserial
## age                 Polyserial
## sex                          1
## 
## Standard Errors/Numbers of Observations:
##                          GCA   AFQT   PIAT    SAT    ACT income_imputed
## GCA                     1697   1621    384    412    373           1124
## AFQT                0.000707   1621    308    399    359           1093
## PIAT                 0.00759 0.0326    384     98     88            211
## SAT                   0.0407 0.0422 0.0716    495    110            403
## ACT                   0.0435 0.0437 0.0938 0.0876    435            352
## income_imputed        0.0266 0.0268 0.0631 0.0492 0.0531           1326
## income_simple         0.0212 0.0216 0.0457  0.044 0.0476        0.00456
## income_log            0.0223 0.0227 0.0464 0.0445 0.0479         0.0154
## income_post_edu       0.0218 0.0222 0.0477 0.0456 0.0485        0.00303
## income_post_edu_log   0.0227 0.0232 0.0498 0.0461 0.0489         0.0137
## skin_tone             0.0259 0.0266 0.0531 0.0487 0.0513         0.0294
## skin_tone_fixed       0.0281 0.0288  0.057 0.0522 0.0549         0.0315
## age                   0.0241 0.0248  0.051 0.0449 0.0478         0.0255
## sex                   0.0303 0.0309  0.064 0.0566 0.0609         0.0338
##                     income_simple income_log income_post_edu
## GCA                          1646       1646            1475
## AFQT                         1577       1577            1415
## PIAT                          367        367             332
## SAT                           488        488             456
## ACT                           433        433             402
## income_imputed               1326       1326            1308
## income_simple                1979       1979            1769
## income_log                 0.0103       1979            1769
## income_post_edu           0.00387     0.0152            1769
## income_post_edu_log        0.0132     0.0087          0.0123
## skin_tone                  0.0244     0.0244          0.0254
## skin_tone_fixed            0.0263     0.0263          0.0273
## age                        0.0222      0.022          0.0233
## sex                        0.0282     0.0282          0.0297
##                     income_post_edu_log skin_tone skin_tone_fixed    age
## GCA                                1475      1451            1244   1697
## AFQT                               1415      1386            1188   1621
## PIAT                                332       335             295    384
## SAT                                 456       417             364    495
## ACT                                 402       379             332    435
## income_imputed                     1308      1160            1009   1326
## income_simple                      1769      1672            1443   1979
## income_log                         1769      1672            1443   1979
## income_post_edu                    1769      1547            1337   1769
## income_post_edu_log                1769      1547            1337   1769
## skin_tone                        0.0254      1718            1481   1718
## skin_tone_fixed                  0.0274  0.000666            1481   1481
## age                              0.0236    0.0241           0.026   2044
## sex                              0.0298    0.0298           0.032 0.0277
##                      sex
## GCA                 1697
## AFQT                1621
## PIAT                 384
## SAT                  495
## ACT                  435
## income_imputed      1326
## income_simple       1979
## income_log          1979
## income_post_edu     1769
## income_post_edu_log 1769
## skin_tone           1718
## skin_tone_fixed     1481
## age                 2044
## sex                 2044
## 
## P-values for Tests of Bivariate Normality:
##                           GCA      AFQT      PIAT      SAT       ACT
## GCA                                                                 
## AFQT                 1.05e-22                                       
## PIAT                  4.5e-18  6.09e-08                             
## SAT                  1.66e-38  1.97e-36  0.000274                   
## ACT                 1.36e-113 4.35e-110  8.89e-26 2.06e-19          
## income_imputed       7.56e-23  6.62e-22  4.97e-16 2.97e-07  1.94e-62
## income_simple        7.74e-11  1.26e-08  1.13e-11 1.69e-14  6.27e-85
## income_log           4.03e-20  1.83e-19  5.46e-07 6.47e-32 1.39e-105
## income_post_edu      1.63e-09  6.81e-08  2.73e-11 8.09e-17  9.86e-81
## income_post_edu_log  2.96e-53   2.2e-53  3.88e-14 6.96e-44 2.36e-110
## skin_tone            6.09e-10   1.3e-09   3.8e-06 1.48e-05   8.2e-70
## skin_tone_fixed         0.496     0.453  9.04e-05   0.0579  6.67e-65
## age                   1.3e-19  3.15e-10 2.27e-224 5.42e-14   1.2e-86
## sex                     0.144      0.36  5.39e-06 2.47e-08  7.77e-86
##                     income_imputed income_simple income_log
## GCA                                                        
## AFQT                                                       
## PIAT                                                       
## SAT                                                        
## ACT                                                        
## income_imputed                                             
## income_simple            3.74e-113                         
## income_log               3.86e-158     4.07e-126           
## income_post_edu           6.71e-79      2.19e-29  9.87e-106
## income_post_edu_log      3.49e-244      6.9e-188   4.24e-87
## skin_tone                 5.35e-11      1.67e-12   4.83e-29
## skin_tone_fixed            0.00412        0.0103   3.29e-15
## age                       5.95e-19      4.43e-24   9.65e-38
## sex                       3.29e-05      1.61e-08   2.36e-20
##                     income_post_edu income_post_edu_log skin_tone
## GCA                                                              
## AFQT                                                             
## PIAT                                                             
## SAT                                                              
## ACT                                                              
## income_imputed                                                   
## income_simple                                                    
## income_log                                                       
## income_post_edu                                                  
## income_post_edu_log               0                              
## skin_tone                  5.32e-15            2.03e-62          
## skin_tone_fixed            0.000341            2.17e-44  4.65e-67
## age                        1.07e-22            1.86e-78  5.32e-25
## sex                        8.39e-08            7.69e-64  1.39e-12
##                     skin_tone_fixed      age
## GCA                                         
## AFQT                                        
## PIAT                                        
## SAT                                         
## ACT                                         
## income_imputed                              
## income_simple                               
## income_log                                  
## income_post_edu                             
## income_post_edu_log                         
## skin_tone                                   
## skin_tone_fixed                             
## age                        5.35e-12         
## sex                           0.236 7.61e-23
#hispanic
hetcor(d %>% filter(SPRE == "Hispanic") %>% .[c("GCA", "AFQT", "PIAT", "SAT", "ACT", "income_imputed", "income_simple", "income_log", "income_post_edu", "income_post_edu_log", "skin_tone", "skin_tone_fixed", "age", "sex")], use = "pairwise")
## Warning in hetcor.data.frame(d %>% filter(SPRE == "Hispanic") %>% .
## [c("GCA", : the correlation matrix has been adjusted to make it positive-
## definite
## 
## Two-Step Estimates
## 
## Correlations/Type of Correlation:
##                         GCA    AFQT    PIAT     SAT     ACT income_imputed
## GCA                       1 Pearson Pearson Pearson Pearson        Pearson
## AFQT                  0.946       1 Pearson Pearson Pearson        Pearson
## PIAT                  0.913   0.739       1 Pearson Pearson        Pearson
## SAT                   0.448   0.447   0.459       1 Pearson        Pearson
## ACT                   0.472   0.459   0.454   0.587       1        Pearson
## income_imputed        0.161   0.161   0.196   0.176  0.0751              1
## income_simple         0.181   0.177   0.204   0.158  0.0626          0.926
## income_log            0.131   0.126   0.133  0.0603  -0.108          0.669
## income_post_edu       0.243   0.241   0.259     0.2   0.126          0.937
## income_post_edu_log   0.222    0.22   0.207   0.103  0.0823          0.723
## skin_tone            -0.138  -0.124  -0.124 -0.0523 -0.0882        0.00948
## skin_tone_fixed      -0.132  -0.128  -0.104 -0.0485 -0.0538       -0.00768
## age                 -0.0112 0.00874  0.0175   0.028  0.0332          0.282
## sex                   -0.02 -0.0462   0.101  0.0918 -0.0872          0.353
##                     income_simple income_log income_post_edu
## GCA                       Pearson    Pearson         Pearson
## AFQT                      Pearson    Pearson         Pearson
## PIAT                      Pearson    Pearson         Pearson
## SAT                       Pearson    Pearson         Pearson
## ACT                       Pearson    Pearson         Pearson
## income_imputed            Pearson    Pearson         Pearson
## income_simple                   1    Pearson         Pearson
## income_log                   0.72          1         Pearson
## income_post_edu             0.901      0.567               1
## income_post_edu_log         0.642      0.768           0.693
## skin_tone                 -0.0116    -0.0144         -0.0153
## skin_tone_fixed           -0.0251    -0.0113          -0.031
## age                         0.155      0.164           0.161
## sex                         0.303      0.236           0.292
##                     income_post_edu_log skin_tone skin_tone_fixed     age
## GCA                             Pearson   Pearson         Pearson Pearson
## AFQT                            Pearson   Pearson         Pearson Pearson
## PIAT                            Pearson   Pearson         Pearson Pearson
## SAT                             Pearson   Pearson         Pearson Pearson
## ACT                             Pearson   Pearson         Pearson Pearson
## income_imputed                  Pearson   Pearson         Pearson Pearson
## income_simple                   Pearson   Pearson         Pearson Pearson
## income_log                      Pearson   Pearson         Pearson Pearson
## income_post_edu                 Pearson   Pearson         Pearson Pearson
## income_post_edu_log                   1   Pearson         Pearson Pearson
## skin_tone                       -0.0333         1         Pearson Pearson
## skin_tone_fixed                 -0.0156     0.982               1 Pearson
## age                              0.0972    0.0473           0.046       1
## sex                               0.181     0.106          0.0976  0.0247
##                            sex
## GCA                 Polyserial
## AFQT                Polyserial
## PIAT                Polyserial
## SAT                 Polyserial
## ACT                 Polyserial
## income_imputed      Polyserial
## income_simple       Polyserial
## income_log          Polyserial
## income_post_edu     Polyserial
## income_post_edu_log Polyserial
## skin_tone           Polyserial
## skin_tone_fixed     Polyserial
## age                 Polyserial
## sex                          1
## 
## Standard Errors/Numbers of Observations:
##                         GCA   AFQT   PIAT    SAT    ACT income_imputed
## GCA                    1457   1358    358    333    164           1007
## AFQT                0.00076   1358    259    310    154            955
## PIAT                0.00547 0.0302    358     91     45            222
## SAT                   0.044 0.0455 0.0832    411     76            317
## ACT                   0.061 0.0639  0.119 0.0758    208            165
## income_imputed       0.0307 0.0315 0.0647 0.0545 0.0776           1274
## income_simple        0.0257 0.0267  0.052 0.0487   0.07        0.00398
## income_log           0.0261 0.0271 0.0533 0.0498 0.0695         0.0155
## income_post_edu      0.0263 0.0271 0.0539 0.0505 0.0717        0.00346
## income_post_edu_log  0.0266 0.0274 0.0553  0.052 0.0724         0.0134
## skin_tone            0.0292 0.0302 0.0578 0.0555 0.0774         0.0303
## skin_tone_fixed      0.0317  0.033 0.0623 0.0601 0.0848         0.0329
## age                  0.0262 0.0271 0.0529 0.0493 0.0694         0.0258
## sex                  0.0329  0.034 0.0656 0.0614 0.0874         0.0336
##                     income_simple income_log income_post_edu
## GCA                          1414       1414            1281
## AFQT                         1320       1320            1205
## PIAT                          341        341             301
## SAT                           401        401             363
## ACT                           203        203             189
## income_imputed               1274       1274            1262
## income_simple                1828       1828            1642
## income_log                 0.0113       1828            1642
## income_post_edu           0.00465     0.0168            1642
## income_post_edu_log        0.0145     0.0101          0.0128
## skin_tone                  0.0265     0.0265          0.0271
## skin_tone_fixed            0.0288     0.0289          0.0296
## age                        0.0228     0.0228           0.024
## sex                        0.0283     0.0295          0.0306
##                     income_post_edu_log skin_tone skin_tone_fixed    age
## GCA                                1281      1135             959   1457
## AFQT                               1205      1060             892   1358
## PIAT                                301       291             253    358
## SAT                                 363       324             276    411
## ACT                                 189       165             139    208
## income_imputed                     1262      1089             923   1274
## income_simple                      1642      1429            1201   1828
## income_log                         1642      1429            1201   1828
## income_post_edu                    1642      1357            1137   1642
## income_post_edu_log                1642      1357            1137   1642
## skin_tone                        0.0271      1445            1213   1445
## skin_tone_fixed                  0.0297   0.00103            1213   1213
## age                              0.0245    0.0263          0.0287   1899
## sex                              0.0314    0.0326          0.0357 0.0288
##                      sex
## GCA                 1457
## AFQT                1358
## PIAT                 358
## SAT                  411
## ACT                  208
## income_imputed      1274
## income_simple       1828
## income_log          1828
## income_post_edu     1642
## income_post_edu_log 1642
## skin_tone           1445
## skin_tone_fixed     1213
## age                 1899
## sex                 1899
## 
## P-values for Tests of Bivariate Normality:
##                          GCA     AFQT     PIAT      SAT      ACT
## GCA                                                             
## AFQT                 1.4e-19                                    
## PIAT                2.93e-09 0.000193                           
## SAT                 1.47e-31 1.78e-27  1.7e-06                  
## ACT                  5.5e-34    3e-32 3.57e-07 2.48e-09         
## income_imputed      3.51e-09 8.79e-06 1.03e-14 4.96e-07 1.97e-23
## income_simple       2.13e-06  0.00106 9.97e-08 1.05e-05 3.31e-25
## income_log          3.24e-23 1.17e-22 5.92e-07 1.57e-16 1.43e-29
## income_post_edu     8.79e-09 6.15e-05 2.12e-12  1.9e-09 1.19e-24
## income_post_edu_log 2.04e-68 6.93e-64 6.85e-25 9.76e-36 7.83e-40
## skin_tone           1.38e-23 3.89e-21 1.84e-10 1.09e-06 5.04e-22
## skin_tone_fixed     6.43e-10 1.79e-08  2.7e-07 0.000126 1.16e-17
## age                 8.76e-19 1.41e-07 1.1e-209 9.69e-07 4.75e-27
## sex                  0.00121   0.0118 4.26e-06  0.00024  1.8e-28
##                     income_imputed income_simple income_log
## GCA                                                        
## AFQT                                                       
## PIAT                                                       
## SAT                                                        
## ACT                                                        
## income_imputed                                             
## income_simple             3.82e-54                         
## income_log               5.22e-115     1.88e-128           
## income_post_edu           2.38e-27      5.48e-26   1.38e-96
## income_post_edu_log      1.88e-215     3.99e-204  5.78e-120
## skin_tone                 3.72e-25      4.39e-28    9.9e-58
## skin_tone_fixed           4.05e-12      2.18e-10   3.04e-34
## age                       7.18e-13      1.26e-16   1.71e-36
## sex                       6.52e-06      9.09e-06    4.5e-25
##                     income_post_edu income_post_edu_log skin_tone
## GCA                                                              
## AFQT                                                             
## PIAT                                                             
## SAT                                                              
## ACT                                                              
## income_imputed                                                   
## income_simple                                                    
## income_log                                                       
## income_post_edu                                                  
## income_post_edu_log               0                              
## skin_tone                  5.84e-31             7.8e-96          
## skin_tone_fixed             6.5e-14            3.23e-67   1.8e-74
## age                         3.3e-16             2.3e-92  7.73e-39
## sex                        1.22e-08            2.59e-89  4.76e-31
##                     skin_tone_fixed      age
## GCA                                         
## AFQT                                        
## PIAT                                        
## SAT                                         
## ACT                                         
## income_imputed                              
## income_simple                               
## income_log                                  
## income_post_edu                             
## income_post_edu_log                         
## skin_tone                                   
## skin_tone_fixed                             
## age                        7.59e-19         
## sex                        5.98e-13 1.45e-15

Modeling

#baseline
lm(income ~ SPRE + age + sex, data = d2) %T>% {summary(.) %>% print()} %>% MOD_summary()
## 
## Call:
## lm(formula = income ~ SPRE + age + sex, data = d2)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -2.288 -0.621 -0.135  0.438  5.708 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           0.00894    0.01975    0.45   0.6506    
## SPREAmerican Indian  -0.54663    0.17394   -3.14   0.0017 ** 
## SPREAsian             0.44186    0.09577    4.61  4.0e-06 ***
## SPREBlack            -0.49071    0.02776  -17.68  < 2e-16 ***
## SPREHispanic         -0.25769    0.02845   -9.06  < 2e-16 ***
## SPREMulti-racial     -0.19180    0.04215   -4.55  5.4e-06 ***
## SPREOther            -0.13319    0.18677   -0.71   0.4758    
## SPREPacific Islander  0.18968    0.19843    0.96   0.3392    
## age                   0.16968    0.01090   15.57  < 2e-16 ***
## sexMale               0.33732    0.02175   15.51  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.95 on 7622 degrees of freedom
##   (1352 observations deleted due to missingness)
## Multiple R-squared:  0.102,  Adjusted R-squared:  0.101 
## F-statistic: 95.8 on 9 and 7622 DF,  p-value: <2e-16
## 
##     ---- Model summary ----    
## Model coefficients
##                         Beta    SE CI_lower CI_upper
## SPRE: White             0.00    NA       NA       NA
## SPRE: American Indian  -0.55 0.174    -0.89    -0.21
## SPRE: Asian             0.44 0.096     0.25     0.63
## SPRE: Black            -0.49 0.028    -0.55    -0.44
## SPRE: Hispanic         -0.26 0.028    -0.31    -0.20
## SPRE: Multi-racial     -0.19 0.042    -0.27    -0.11
## SPRE: Other            -0.13 0.187    -0.50     0.23
## SPRE: Pacific Islander  0.19 0.198    -0.20     0.58
## age                     0.17 0.011     0.15     0.19
## sex: Female             0.00    NA       NA       NA
## sex: Male               0.34 0.022     0.29     0.38
## 
## 
## Model meta-data
##   outcome    N   df  R2 R2-adj. R2-cv
## 1  income 7632 7622 0.1     0.1    NA
## 
## 
## Etas from analysis of variance
##       Eta Eta_partial
## SPRE 0.21        0.22
## age  0.17        0.18
## sex  0.17        0.17
lm(income ~ OPRE + age + sex, data = d2) %T>% {summary(.) %>% print()} %>% MOD_summary()
## 
## Call:
## lm(formula = income ~ OPRE + age + sex, data = d2)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -1.945 -0.626 -0.141  0.423  5.692 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -0.0617     0.0182   -3.39   0.0007 ***
## OPREBlack    -0.4028     0.0260  -15.49   <2e-16 ***
## OPREOther    -0.0342     0.0387   -0.88   0.3774    
## age           0.1691     0.0112   15.04   <2e-16 ***
## sexMale       0.3409     0.0224   15.20   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.95 on 7240 degrees of freedom
##   (1739 observations deleted due to missingness)
## Multiple R-squared:  0.0876, Adjusted R-squared:  0.0871 
## F-statistic:  174 on 4 and 7240 DF,  p-value: <2e-16
## 
##     ---- Model summary ----    
## Model coefficients
##               Beta    SE CI_lower CI_upper
## OPRE: White  0.000    NA       NA       NA
## OPRE: Black -0.404 0.026    -0.45   -0.353
## OPRE: Other -0.034 0.039    -0.11    0.042
## age          0.169 0.011     0.15    0.191
## sex: Female  0.000    NA       NA       NA
## sex: Male    0.342 0.022     0.30    0.386
## 
## 
## Model meta-data
##   outcome    N   df    R2 R2-adj. R2-cv
## 1  income 7245 7240 0.088   0.087    NA
## 
## 
## Etas from analysis of variance
##       Eta Eta_partial
## OPRE 0.18        0.18
## age  0.17        0.17
## sex  0.17        0.18
lm(income ~ skin_tone + age + sex, data = d2) %T>% {summary(.) %>% print()} %>% MOD_summary()
## 
## Call:
## lm(formula = income ~ skin_tone + age + sex, data = d2)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -1.968 -0.600 -0.133  0.421  5.189 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -0.2160     0.0166   -13.0   <2e-16 ***
## skin_tone    -0.1894     0.0118   -16.1   <2e-16 ***
## age           0.1604     0.0116    13.8   <2e-16 ***
## sexMale       0.3712     0.0233    16.0   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.92 on 6304 degrees of freedom
##   (2676 observations deleted due to missingness)
## Multiple R-squared:  0.0981, Adjusted R-squared:  0.0977 
## F-statistic:  229 on 3 and 6304 DF,  p-value: <2e-16
## 
##     ---- Model summary ----    
## Model coefficients
##              Beta    SE CI_lower CI_upper
## skin_tone   -0.19 0.012    -0.22    -0.17
## age          0.17 0.012     0.14     0.19
## sex: Female  0.00    NA       NA       NA
## sex: Male    0.38 0.024     0.34     0.43
## 
## 
## Model meta-data
##   outcome    N   df    R2 R2-adj. R2-cv
## 1  income 6308 6304 0.098   0.098    NA
## 
## 
## Etas from analysis of variance
##            Eta Eta_partial
## skin_tone 0.19        0.20
## age       0.17        0.17
## sex       0.19        0.20
#full model
lm(income ~ GCA + OPRE + SPRE + skin_tone + age + sex, data = d2) %T>% {summary(.) %>% print()} %>% MOD_summary()
## 
## Call:
## lm(formula = income ~ GCA + OPRE + SPRE + skin_tone + age + sex, 
##     data = d2)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -2.608 -0.557 -0.111  0.409  4.854 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           -0.2018     0.0268   -7.54  5.6e-14 ***
## GCA                    0.2975     0.0136   21.89  < 2e-16 ***
## OPREBlack              0.0445     0.0826    0.54   0.5896    
## OPREOther              0.1034     0.0517    2.00   0.0455 *  
## SPREAmerican Indian   -0.4073     0.1905   -2.14   0.0326 *  
## SPREAsian              0.4482     0.1096    4.09  4.4e-05 ***
## SPREBlack             -0.0842     0.0841   -1.00   0.3169    
## SPREHispanic          -0.0197     0.0380   -0.52   0.6039    
## SPREMulti-racial      -0.0791     0.0623   -1.27   0.2043    
## SPREOther              0.2466     0.2240    1.10   0.2709    
## SPREPacific Islander   0.1472     0.2240    0.66   0.5110    
## skin_tone             -0.0570     0.0214   -2.67   0.0076 ** 
## age                    0.1699     0.0121   14.08  < 2e-16 ***
## sexMale                0.3745     0.0246   15.22  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.88 on 5186 degrees of freedom
##   (3784 observations deleted due to missingness)
## Multiple R-squared:  0.185,  Adjusted R-squared:  0.183 
## F-statistic: 90.6 on 13 and 5186 DF,  p-value: <2e-16
## 
##     ---- Model summary ----    
## Model coefficients
##                          Beta    SE CI_lower CI_upper
## GCA                     0.305 0.014   0.2781    0.333
## OPRE: White             0.000    NA       NA       NA
## OPRE: Black             0.046 0.085  -0.1203    0.212
## OPRE: Other             0.106 0.053   0.0021    0.210
## SPRE: White             0.000    NA       NA       NA
## SPRE: American Indian  -0.418 0.195  -0.8007   -0.035
## SPRE: Asian             0.460 0.112   0.2393    0.680
## SPRE: Black            -0.086 0.086  -0.2554    0.083
## SPRE: Hispanic         -0.020 0.039  -0.0965    0.056
## SPRE: Multi-racial     -0.081 0.064  -0.2063    0.044
## SPRE: Other             0.253 0.230  -0.1974    0.703
## SPRE: Pacific Islander  0.151 0.230  -0.2993    0.601
## skin_tone              -0.057 0.022  -0.0996   -0.015
## age                     0.177 0.013   0.1522    0.201
## sex: Female             0.000    NA       NA       NA
## sex: Male               0.384 0.025   0.3346    0.434
## 
## 
## Model meta-data
##   outcome    N   df   R2 R2-adj. R2-cv
## 1  income 5200 5186 0.19    0.18    NA
## 
## 
## Etas from analysis of variance
##             Eta Eta_partial
## GCA       0.274       0.291
## OPRE      0.025       0.028
## SPRE      0.066       0.073
## skin_tone 0.033       0.037
## age       0.177       0.192
## sex       0.191       0.207
##robustness
#fixed skin tone?
lm(income ~ GCA + OPRE + SPRE + skin_tone_fixed + age + sex, data = d2) %T>% {summary(.) %>% print()} %>% MOD_summary()
## 
## Call:
## lm(formula = income ~ GCA + OPRE + SPRE + skin_tone_fixed + age + 
##     sex, data = d2)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -2.651 -0.555 -0.106  0.418  4.841 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           -0.1901     0.0291   -6.53  7.4e-11 ***
## GCA                    0.2992     0.0147   20.35  < 2e-16 ***
## OPREBlack              0.0310     0.0856    0.36    0.717    
## OPREOther              0.1134     0.0557    2.04    0.042 *  
## SPREAmerican Indian   -0.4222     0.1928   -2.19    0.029 *  
## SPREAsian              0.5768     0.1170    4.93  8.6e-07 ***
## SPREBlack             -0.0933     0.0881   -1.06    0.290    
## SPREHispanic          -0.0322     0.0410   -0.79    0.432    
## SPREMulti-racial      -0.1300     0.0668   -1.95    0.052 .  
## SPREOther              0.2640     0.2286    1.15    0.248    
## SPREPacific Islander   0.1760     0.2370    0.74    0.458    
## skin_tone_fixed       -0.0336     0.0225   -1.49    0.136    
## age                    0.1807     0.0130   13.86  < 2e-16 ***
## sexMale                0.3884     0.0266   14.60  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.87 on 4332 degrees of freedom
##   (4638 observations deleted due to missingness)
## Multiple R-squared:  0.196,  Adjusted R-squared:  0.193 
## F-statistic:   81 on 13 and 4332 DF,  p-value: <2e-16
## 
##     ---- Model summary ----    
## Model coefficients
##                          Beta    SE CI_lower CI_upper
## GCA                     0.309 0.015   0.2791    0.339
## OPRE: White             0.000    NA       NA       NA
## OPRE: Black             0.032 0.088  -0.1411    0.205
## OPRE: Other             0.117 0.057   0.0043    0.230
## SPRE: White             0.000    NA       NA       NA
## SPRE: American Indian  -0.436 0.199  -0.8257   -0.046
## SPRE: Asian             0.595 0.121   0.3584    0.832
## SPRE: Black            -0.096 0.091  -0.2745    0.082
## SPRE: Hispanic         -0.033 0.042  -0.1161    0.050
## SPRE: Multi-racial     -0.134 0.069  -0.2692    0.001
## SPRE: Other             0.272 0.236  -0.1901    0.735
## SPRE: Pacific Islander  0.182 0.245  -0.2978    0.661
## skin_tone_fixed        -0.034 0.023  -0.0784    0.011
## age                     0.189 0.014   0.1625    0.216
## sex: Female             0.000    NA       NA       NA
## sex: Male               0.401 0.027   0.3469    0.455
## 
## 
## Model meta-data
##   outcome    N   df  R2 R2-adj. R2-cv
## 1  income 4346 4332 0.2    0.19    NA
## 
## 
## Etas from analysis of variance
##                   Eta Eta_partial
## GCA             0.277       0.295
## OPRE            0.028       0.031
## SPRE            0.086       0.096
## skin_tone_fixed 0.020       0.023
## age             0.189       0.206
## sex             0.199       0.217
#no skin tone?
lm(income ~ GCA + OPRE + SPRE + age + sex, data = d2) %T>% {summary(.) %>% print()} %>% MOD_summary()
## 
## Call:
## lm(formula = income ~ GCA + OPRE + SPRE + age + sex, data = d2)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -2.653 -0.572 -0.116  0.412  5.381 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           -0.1241     0.0216   -5.75  9.1e-09 ***
## GCA                    0.2962     0.0129   22.94  < 2e-16 ***
## OPREBlack             -0.0792     0.0708   -1.12  0.26347    
## OPREOther              0.0937     0.0488    1.92  0.05488 .  
## SPREAmerican Indian   -0.4390     0.1716   -2.56  0.01056 *  
## SPREAsian              0.3644     0.1064    3.43  0.00062 ***
## SPREBlack             -0.1035     0.0751   -1.38  0.16803    
## SPREHispanic          -0.0746     0.0356   -2.10  0.03620 *  
## SPREMulti-racial      -0.0650     0.0538   -1.21  0.22747    
## SPREOther              0.0576     0.2062    0.28  0.78016    
## SPREPacific Islander   0.2801     0.2071    1.35  0.17630    
## age                    0.1787     0.0115   15.52  < 2e-16 ***
## sexMale                0.3657     0.0233   15.73  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.91 on 6176 degrees of freedom
##   (2795 observations deleted due to missingness)
## Multiple R-squared:  0.173,  Adjusted R-squared:  0.172 
## F-statistic:  108 on 12 and 6176 DF,  p-value: <2e-16
## 
##     ---- Model summary ----    
## Model coefficients
##                          Beta    SE CI_lower CI_upper
## GCA                     0.294 0.013    0.269   0.3189
## OPRE: White             0.000    NA       NA       NA
## OPRE: Black            -0.079 0.071   -0.218   0.0595
## OPRE: Other             0.094 0.049   -0.002   0.1891
## SPRE: White             0.000    NA       NA       NA
## SPRE: American Indian  -0.438 0.171   -0.774  -0.1023
## SPRE: Asian             0.364 0.106    0.156   0.5718
## SPRE: Black            -0.103 0.075   -0.250   0.0436
## SPRE: Hispanic         -0.074 0.036   -0.144  -0.0048
## SPRE: Multi-racial     -0.065 0.054   -0.170   0.0405
## SPRE: Other             0.057 0.206   -0.346   0.4609
## SPRE: Pacific Islander  0.280 0.207   -0.126   0.6849
## age                     0.180 0.012    0.157   0.2029
## sex: Female             0.000    NA       NA       NA
## sex: Male               0.365 0.023    0.320   0.4105
## 
## 
## Model meta-data
##   outcome    N   df   R2 R2-adj. R2-cv
## 1  income 6189 6176 0.17    0.17    NA
## 
## 
## Etas from analysis of variance
##        Eta Eta_partial
## GCA  0.265       0.280
## OPRE 0.028       0.031
## SPRE 0.064       0.070
## age  0.180       0.194
## sex  0.182       0.196