Init

library(kirkegaard)
## Loading required package: tidyverse
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.6     ✓ dplyr   1.0.8
## ✓ tidyr   1.2.0     ✓ stringr 1.4.0
## ✓ readr   2.1.2     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
## Loading required package: weights
## Loading required package: Hmisc
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## 
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:dplyr':
## 
##     src, summarize
## The following objects are masked from 'package:base':
## 
##     format.pval, units
## Loading required package: assertthat
## 
## Attaching package: 'assertthat'
## The following object is masked from 'package:tibble':
## 
##     has_name
## Loading required package: magrittr
## 
## Attaching package: 'magrittr'
## The following object is masked from 'package:purrr':
## 
##     set_names
## The following object is masked from 'package:tidyr':
## 
##     extract
## Loading required package: psych
## 
## Attaching package: 'psych'
## The following object is masked from 'package:Hmisc':
## 
##     describe
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
## Loading required package: metafor
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
## 
## Loading the 'metafor' package (version 3.0-2). For an
## introduction to the package please type: help(metafor)
## Loading required package: rlang
## 
## Attaching package: 'rlang'
## The following object is masked from 'package:magrittr':
## 
##     set_names
## The following object is masked from 'package:assertthat':
## 
##     has_name
## The following objects are masked from 'package:purrr':
## 
##     %@%, as_function, flatten, flatten_chr, flatten_dbl, flatten_int,
##     flatten_lgl, flatten_raw, invoke, splice
## 
## Attaching package: 'kirkegaard'
## The following objects are masked from 'package:rlang':
## 
##     is_error, is_logical
## The following object is masked from 'package:psych':
## 
##     rescale
## The following object is masked from 'package:assertthat':
## 
##     are_equal
## The following objects are masked from 'package:purrr':
## 
##     is_logical, is_numeric
## The following object is masked from 'package:base':
## 
##     +
load_packages(
  googlesheets4,
  ggrepel
)

theme_set(theme_bw())

Calculations

#68th centile in IQ scale
qnorm(.68, 100, 15)
## [1] 107.0155
#0.78 standard deviations in IQ scale
15*.78
## [1] 11.7
#99th centile on IQ scale
qnorm(.99, 100, 15)
## [1] 134.8952
#99th centile on SAT scale, with SD 200
qnorm(.99, 1010, 200)
## [1] 1475.27
#99th centile on SAT scale, with SD 195
qnorm(.99, 1010, 200)
## [1] 1475.27
#99th centile to z score
qnorm(.99)
## [1] 2.326348
#99th centile to z score, to IQ z score
qnorm(.99) * 0.8
## [1] 1.861078
#99th centile to z score, to IQ score
(qnorm(.99) * 0.8) * 15 + 100
## [1] 127.9162
#perfect SAT 1600 to centile
pnorm(1600, 1010, 200)
## [1] 0.9984111
#perfect SAT 1600 to z score
pnorm(1600, 1010, 200) %>% qnorm()
## [1] 2.95
#perfect SAT 1600 to z score to IQ z score
(pnorm(1600, 1010, 200) %>% qnorm()) * .8
## [1] 2.36
#perfect SAT 1600 to z score to IQ scale score
((pnorm(1600, 1010, 200) %>% qnorm()) * .8)*15+100
## [1] 135.4

A look-up table

map_df(seq(200, 1600, 10), function(SAT) {
  tibble(
    SAT = SAT,
    SAT_centile = pnorm(SAT, 1010, 200),
    SAT_z = qnorm(SAT_centile),
    IQ_z = SAT_z*0.8,
    IQ = IQ_z*15+100
  )
}) -> SAT_IQ_table

SAT_IQ_table

SAT to IQs by major

#read data
gs4_deauth()
sats = read_sheet(
  "https://docs.google.com/spreadsheets/d/13gaFgtCMnvdgZdxaR3zwwpPf_WrGru_AxzTKnaMwRpY/edit?usp=sharing",
  sheet = 2)
## ✓ Reading from "SAT to IQ table".
## ✓ Range ''SAT means by major''.
#add IQs
sats %<>% mutate(
    SAT_centile = pnorm(`Mean total`, 1010, 200),
    SAT_verbal_tilt = (`Mean verbal`-`Mean math`) %>% standardize(),
    SAT_z = qnorm(SAT_centile),
    IQ_z = SAT_z*0.8,
    IQ = IQ_z*15+100
)

#plot it
sats %>% 
  ggplot(aes(IQ, SAT_verbal_tilt)) +
  geom_point() +
  geom_text_repel(aes(label = Major), size = 3, max.overlaps = 99) +
  scale_x_continuous("Average IQ of probable undergraduates (from SAT)", breaks = seq(90, 130, 5), limits = c(95, 116)) +
  scale_y_continuous("Verbal tilt (verbal - math score, in z scale)")

GG_save("figs/SAT_major_IQ_tilt.png")

#simpler plot
sats %>% 
  mutate(
    Major = fct_reorder(Major, IQ),
  ) %>% 
  ggplot(aes(IQ, Major, color = SAT_verbal_tilt)) +
  # geom_bar(stat = "identity")
  geom_point() +
  scale_x_continuous("Average IQ of probable undergraduates (from SAT)", breaks = seq(90, 130, 5), limits = c(95, 116)) +
  scale_color_gradient2("Verbal tilt", mid = "grey")

GG_save("figs/SAT_major_IQ_tilt2.png")

Meta

write_sessioninfo()
## R version 4.1.3 (2022-03-10)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Linux Mint 20.2
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
## 
## locale:
##  [1] LC_CTYPE=en_DK.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_DK.UTF-8        LC_COLLATE=en_DK.UTF-8    
##  [5] LC_MONETARY=en_DK.UTF-8    LC_MESSAGES=en_DK.UTF-8   
##  [7] LC_PAPER=en_DK.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_DK.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] ggrepel_0.9.1         googlesheets4_1.0.0   kirkegaard_2022-04-12
##  [4] rlang_1.0.2           metafor_3.0-2         Matrix_1.4-1         
##  [7] psych_2.2.3           magrittr_2.0.3        assertthat_0.2.1     
## [10] weights_1.0.4         Hmisc_4.6-0           Formula_1.2-4        
## [13] survival_3.3-1        lattice_0.20-45       forcats_0.5.1        
## [16] stringr_1.4.0         dplyr_1.0.8           purrr_0.3.4          
## [19] readr_2.1.2           tidyr_1.2.0           tibble_3.1.6         
## [22] ggplot2_3.3.5         tidyverse_1.3.1      
## 
## loaded via a namespace (and not attached):
##  [1] nlme_3.1-157        fs_1.5.2            lubridate_1.8.0    
##  [4] RColorBrewer_1.1-3  httr_1.4.2          tools_4.1.3        
##  [7] backports_1.4.1     bslib_0.3.1         utf8_1.2.2         
## [10] R6_2.5.1            rpart_4.1.16        DBI_1.1.2          
## [13] colorspace_2.0-3    nnet_7.3-17         withr_2.5.0        
## [16] mnormt_2.0.2        tidyselect_1.1.2    gridExtra_2.3      
## [19] curl_4.3.2          compiler_4.1.3      cli_3.2.0          
## [22] rvest_1.0.2         htmlTable_2.4.0     mice_3.14.0        
## [25] xml2_1.3.3          labeling_0.4.2      sass_0.4.1         
## [28] scales_1.1.1        checkmate_2.0.0     digest_0.6.29      
## [31] minqa_1.2.4         foreign_0.8-82      rmarkdown_2.13     
## [34] base64enc_0.1-3     jpeg_0.1-9          pkgconfig_2.0.3    
## [37] htmltools_0.5.2     lme4_1.1-29         highr_0.9          
## [40] dbplyr_2.1.1        fastmap_1.1.0       htmlwidgets_1.5.4  
## [43] readxl_1.3.1        rstudioapi_0.13     farver_2.1.0       
## [46] jquerylib_0.1.4     generics_0.1.2      jsonlite_1.8.0     
## [49] gtools_3.9.2        Rcpp_1.0.8.3        munsell_0.5.0      
## [52] fansi_1.0.3         lifecycle_1.0.1     stringi_1.7.6      
## [55] yaml_2.3.5          mathjaxr_1.6-0      MASS_7.3-56        
## [58] grid_4.1.3          parallel_4.1.3      gdata_2.18.0       
## [61] crayon_1.5.1        haven_2.4.3         splines_4.1.3      
## [64] hms_1.1.1           tmvnsim_1.0-2       knitr_1.38         
## [67] pillar_1.7.0        boot_1.3-28         reprex_2.0.1       
## [70] glue_1.6.2          evaluate_0.15       latticeExtra_0.6-29
## [73] data.table_1.14.2   modelr_0.1.8        nloptr_2.0.0       
## [76] png_0.1-7           vctrs_0.4.0         tzdb_0.3.0         
## [79] cellranger_1.1.0    gtable_0.3.0        xfun_0.30          
## [82] broom_0.7.12        googledrive_2.0.0   gargle_1.2.0       
## [85] cluster_2.1.3       ellipsis_0.3.2