Init
library(pacman)
p_load(kirkegaard, dplyr)
load("data/ICAR/sapaICARData18aug2010thru20may2013.rdata")
icar = sapaICARData18aug2010thru20may2013; rm(sapaICARData18aug2010thru20may2013)
load("data/personality/sapaTempData696items08dec2013thru26jul2014.RData")
pers = sapaTempData696items08dec2013thru26jul2014; rm(sapaTempData696items08dec2013thru26jul2014)
Sample size by country
icar$country %>% table2()
## # A tibble: 199 × 3
## Group Count Percent
## <chr> <dbl> <dbl>
## 1 USA 75740 78.1162978
## 2 CAN 4322 4.4576002
## 3 GBR 2082 2.1473215
## 4 AUS 1625 1.6759834
## 5 MYS 1466 1.5119949
## 6 IND 903 0.9313311
## 7 PHL 893 0.9210173
## 8 DEU 596 0.6146991
## 9 SWE 468 0.4826832
## 10 SGP 382 0.3939850
## # ... with 189 more rows
icar_items = str_subset(names(icar), "[A-Z0-9]+\\.\\d\\d")
country_CA = plyr::ddply(icar, "country", function(b) {
#mean item correct
mean_items = b[icar_items] %>% colMeans(na.rm = T)
#mean correct
mean_cor = mean(mean_items, na.rm = T)
sd_cor = sd(mean_items, na.rm = T)
data_frame(
mean_score = mean_cor,
sd_score = sd_cor,
n = nrow(b)
)
})
#inspect those with >50
country_CA %>% filter(n > 50) %>% arrange(-mean_score)
## country mean_score sd_score n
## 1 NLD 0.6372274 0.2276223 210
## 2 TUR 0.6152418 0.2424665 90
## 3 CHE 0.6013322 0.2494151 72
## 4 BEL 0.5959513 0.2516541 106
## 5 FIN 0.5930721 0.2480195 145
## 6 DEU 0.5881822 0.2283739 596
## 7 FRA 0.5879127 0.2445763 216
## 8 POL 0.5785486 0.2299739 167
## 9 BGR 0.5720609 0.3324657 59
## 10 ITA 0.5663144 0.2672788 126
## 11 CZE 0.5618671 0.2734046 63
## 12 HRV 0.5562421 0.2950524 86
## 13 CHN 0.5539784 0.2408589 360
## 14 PRT 0.5509224 0.2936677 79
## 15 AUT 0.5455126 0.2517483 62
## 16 IRN 0.5405326 0.2787687 69
## 17 TWN 0.5372400 0.2716416 74
## 18 KOR 0.5361917 0.2539384 176
## 19 SGP 0.5335865 0.2483463 382
## 20 NZL 0.5303756 0.2453946 271
## 21 SWE 0.5188640 0.2209762 468
## 22 SRB 0.5172406 0.2619086 149
## 23 IDN 0.5132907 0.2801849 156
## 24 DNK 0.5119294 0.2458524 117
## 25 IRL 0.5073820 0.2698259 200
## 26 ARG 0.5014125 0.2858421 73
## 27 BRA 0.5001248 0.2445863 216
## 28 JPN 0.5000454 0.2838320 119
## 29 GBR 0.4976409 0.2566372 2082
## 30 RUS 0.4965564 0.2695398 120
## 31 ESP 0.4940054 0.2698945 102
## 32 AUS 0.4922487 0.2511292 1625
## 33 VNM 0.4895790 0.2497653 95
## 34 NOR 0.4875717 0.2335455 366
## 35 ROU 0.4857763 0.2635645 199
## 36 HKG 0.4831844 0.2737520 236
## 37 GRC 0.4769979 0.3003235 86
## 38 IND 0.4733728 0.2740179 903
## 39 ZAF 0.4672794 0.2828818 267
## 40 CAN 0.4640510 0.2430983 4322
## 41 THA 0.4563408 0.3139223 72
## 42 LBN 0.4504836 0.3274871 77
## 43 UKR 0.4456687 0.3047114 57
## 44 EGY 0.4366311 0.2937821 72
## 45 KEN 0.4258129 0.3018063 99
## 46 ARE 0.4228557 0.2970464 84
## 47 PRI 0.4192239 0.2528325 69
## 48 USA 0.4179486 0.2539949 75740
## 49 MEX 0.4176345 0.2586489 320
## 50 NGA 0.4157297 0.2963079 213
## 51 TTO 0.4068309 0.3304514 55
## 52 SAU 0.3970575 0.2835122 99
## 53 COL 0.3948141 0.2990252 92
## 54 JAM 0.3869677 0.2799748 91
## 55 PHL 0.3804804 0.2659989 893
## 56 MYS 0.3556474 0.2444668 1466
## 57 PAK 0.3541264 0.2508817 221
## 58 GHA 0.3441959 0.2770726 53
## 59 AFG 0.3151051 0.2547079 53