Loading the dataset:
subset <- allspan
subset$Country[is.na(subset$Country)] <- 'Unknown'
subset$SES[is.na(subset$SES)] <- 1
subset$SES[subset$SES==''] <- 1
subset$SES[subset$SES=='c'] <- 1
subset$SE <- subset$SD/sqrt(subset$Size)
subset$pasteID <- paste0(subset$Authors, subset$Year)
unique(subset$Country)
[1] "Slovenia" "Italy" "Brazil" "USA" "China" "Netherlands" "Austria"
[8] "Canada" "Unknown" "Spain" "India" "Portugal" "Germany" "Finland"
[15] "Australia" "Argentina" "Israel" "Hungary" "UK" "Colombia" "New Zealand"
[22] "Tunisia" "Mexico" "Belgium" "France" "Sweden" "South Korea" "Croatia"
[29] "Hong Kong" "Japan" "Turkey" "South Africa" "Taiwan" "Iran" "Norway"
[36] "Denmark" "Jamaica" "Singapore" "Romania" "Malaysia" "Zimbabwe" "Switzerland"
[43] "Russia" "Czechia" "Cuba"
unique(subset$SES)
[1] "2" "1" "0"
Testing for various interaction effects involving the type of memory test (yes for age curve/test year, no for sample selectivity) a
#######First test: interactions between age curves and test type (yes)
lr <- lm(data=subset, Mean ~ rcs(Age, 5)*type + as.factor(SES) + Year + Country, weights=sqrt(Size))
summary(lr)
Call:
lm(formula = Mean ~ rcs(Age, 5) * type + as.factor(SES) + Year +
Country, data = subset, weights = sqrt(Size))
Weighted Residuals:
Min 1Q Median 3Q Max
-10.4270 -1.0718 -0.0236 1.0457 8.5262
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -21.357214 4.338855 -4.922 0.00000093828453776 ***
rcs(Age, 5)Age 0.339874 0.022176 15.326 < 0.0000000000000002 ***
rcs(Age, 5)Age' -6.043695 0.569471 -10.613 < 0.0000000000000002 ***
rcs(Age, 5)Age'' 8.611654 0.865872 9.946 < 0.0000000000000002 ***
rcs(Age, 5)Age''' -2.566181 0.331136 -7.750 0.00000000000001576 ***
typebackwardcorsi 0.666217 0.666636 0.999 0.31776
typeforward 2.143678 0.265131 8.085 0.00000000000000117 ***
typeforwardcorsi 1.438646 0.322223 4.465 0.00000854421267580 ***
as.factor(SES)1 0.601806 0.126460 4.759 0.00000211210720359 ***
as.factor(SES)2 0.643849 0.136658 4.711 0.00000266096938028 ***
Year 0.010545 0.002144 4.918 0.00000095974268285 ***
CountryAustralia 0.807310 0.387214 2.085 0.03723 *
CountryAustria 0.866296 0.553086 1.566 0.11747
CountryBelgium 0.054623 0.396880 0.138 0.89055
CountryBrazil -0.242888 0.399179 -0.608 0.54296
CountryCanada 0.849992 0.387050 2.196 0.02822 *
CountryChina 0.923252 0.410176 2.251 0.02452 *
CountryColombia 0.965591 0.629840 1.533 0.12544
CountryCroatia 0.427534 0.455177 0.939 0.34773
CountryCuba -0.617125 0.721515 -0.855 0.39250
CountryCzechia 0.100415 0.716888 0.140 0.88862
CountryDenmark -0.040888 0.494281 -0.083 0.93408
CountryFinland 0.500954 0.412660 1.214 0.22493
CountryFrance 0.431287 0.406046 1.062 0.28831
CountryGermany 0.575038 0.387062 1.486 0.13756
CountryHong Kong 1.403860 0.455403 3.083 0.00208 **
CountryHungary 1.055550 0.671042 1.573 0.11590
CountryIndia -0.692278 0.534436 -1.295 0.19538
CountryIran 0.276815 0.565812 0.489 0.62474
CountryIsrael 0.617147 0.475884 1.297 0.19486
CountryItaly 0.177713 0.382126 0.465 0.64195
CountryJamaica 0.295936 0.504399 0.587 0.55748
CountryJapan 0.420867 0.424288 0.992 0.32137
CountryMalaysia 0.669230 0.715910 0.935 0.35003
CountryMexico -0.282854 0.407313 -0.694 0.48750
CountryNetherlands 0.522518 0.391289 1.335 0.18193
CountryNew Zealand 0.054648 0.395958 0.138 0.89025
CountryNorway 0.336132 0.442582 0.759 0.44767
CountryPortugal 0.383194 0.446533 0.858 0.39093
CountryRomania -0.106193 0.534000 -0.199 0.84239
CountryRussia 0.246494 0.616069 0.400 0.68913
CountrySingapore 0.440322 0.432389 1.018 0.30866
CountrySlovenia 0.857802 0.540036 1.588 0.11238
CountrySouth Africa -0.523938 0.506764 -1.034 0.30133
CountrySouth Korea 0.350885 0.441038 0.796 0.42638
CountrySpain 0.731101 0.389583 1.877 0.06074 .
CountrySweden 0.308317 0.392859 0.785 0.43268
CountrySwitzerland 1.029331 0.537859 1.914 0.05582 .
CountryTaiwan 1.261575 0.437204 2.886 0.00396 **
CountryTunisia 0.522770 0.412964 1.266 0.20572
CountryTurkey 0.619658 0.706340 0.877 0.38046
CountryUK 0.473501 0.385981 1.227 0.22009
CountryUnknown 0.576833 0.388747 1.484 0.13804
CountryUSA 0.678179 0.379771 1.786 0.07432 .
CountryZimbabwe -1.859901 0.903828 -2.058 0.03976 *
rcs(Age, 5)Age:typebackwardcorsi -0.004862 0.071679 -0.068 0.94592
rcs(Age, 5)Age':typebackwardcorsi -0.125377 1.809553 -0.069 0.94477
rcs(Age, 5)Age'':typebackwardcorsi 0.182141 2.743474 0.066 0.94707
rcs(Age, 5)Age''':typebackwardcorsi -0.062855 1.036501 -0.061 0.95165
rcs(Age, 5)Age:typeforward -0.064058 0.029145 -2.198 0.02809 *
rcs(Age, 5)Age':typeforward 1.018996 0.756078 1.348 0.17792
rcs(Age, 5)Age'':typeforward -1.350067 1.151346 -1.173 0.24112
rcs(Age, 5)Age''':typeforward 0.245347 0.442381 0.555 0.57924
rcs(Age, 5)Age:typeforwardcorsi -0.042481 0.036181 -1.174 0.24050
rcs(Age, 5)Age':typeforwardcorsi 0.107799 0.965565 0.112 0.91112
rcs(Age, 5)Age'':typeforwardcorsi 0.024781 1.478495 0.017 0.98663
rcs(Age, 5)Age''':typeforwardcorsi -0.237848 0.580186 -0.410 0.68189
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.989 on 1697 degrees of freedom
Multiple R-squared: 0.658, Adjusted R-squared: 0.6447
F-statistic: 49.48 on 66 and 1697 DF, p-value: < 0.00000000000000022
lr2 <- lm(data=subset, Mean ~ rcs(Age, 5)*type + as.factor(SES) + Year + Country, weights=sqrt(Size))
summary(lr2)
Call:
lm(formula = Mean ~ rcs(Age, 5) * type + as.factor(SES) + Year +
Country, data = subset, weights = sqrt(Size))
Weighted Residuals:
Min 1Q Median 3Q Max
-10.4270 -1.0718 -0.0236 1.0457 8.5262
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -21.357214 4.338855 -4.922 0.00000093828453776 ***
rcs(Age, 5)Age 0.339874 0.022176 15.326 < 0.0000000000000002 ***
rcs(Age, 5)Age' -6.043695 0.569471 -10.613 < 0.0000000000000002 ***
rcs(Age, 5)Age'' 8.611654 0.865872 9.946 < 0.0000000000000002 ***
rcs(Age, 5)Age''' -2.566181 0.331136 -7.750 0.00000000000001576 ***
typebackwardcorsi 0.666217 0.666636 0.999 0.31776
typeforward 2.143678 0.265131 8.085 0.00000000000000117 ***
typeforwardcorsi 1.438646 0.322223 4.465 0.00000854421267580 ***
as.factor(SES)1 0.601806 0.126460 4.759 0.00000211210720359 ***
as.factor(SES)2 0.643849 0.136658 4.711 0.00000266096938028 ***
Year 0.010545 0.002144 4.918 0.00000095974268285 ***
CountryAustralia 0.807310 0.387214 2.085 0.03723 *
CountryAustria 0.866296 0.553086 1.566 0.11747
CountryBelgium 0.054623 0.396880 0.138 0.89055
CountryBrazil -0.242888 0.399179 -0.608 0.54296
CountryCanada 0.849992 0.387050 2.196 0.02822 *
CountryChina 0.923252 0.410176 2.251 0.02452 *
CountryColombia 0.965591 0.629840 1.533 0.12544
CountryCroatia 0.427534 0.455177 0.939 0.34773
CountryCuba -0.617125 0.721515 -0.855 0.39250
CountryCzechia 0.100415 0.716888 0.140 0.88862
CountryDenmark -0.040888 0.494281 -0.083 0.93408
CountryFinland 0.500954 0.412660 1.214 0.22493
CountryFrance 0.431287 0.406046 1.062 0.28831
CountryGermany 0.575038 0.387062 1.486 0.13756
CountryHong Kong 1.403860 0.455403 3.083 0.00208 **
CountryHungary 1.055550 0.671042 1.573 0.11590
CountryIndia -0.692278 0.534436 -1.295 0.19538
CountryIran 0.276815 0.565812 0.489 0.62474
CountryIsrael 0.617147 0.475884 1.297 0.19486
CountryItaly 0.177713 0.382126 0.465 0.64195
CountryJamaica 0.295936 0.504399 0.587 0.55748
CountryJapan 0.420867 0.424288 0.992 0.32137
CountryMalaysia 0.669230 0.715910 0.935 0.35003
CountryMexico -0.282854 0.407313 -0.694 0.48750
CountryNetherlands 0.522518 0.391289 1.335 0.18193
CountryNew Zealand 0.054648 0.395958 0.138 0.89025
CountryNorway 0.336132 0.442582 0.759 0.44767
CountryPortugal 0.383194 0.446533 0.858 0.39093
CountryRomania -0.106193 0.534000 -0.199 0.84239
CountryRussia 0.246494 0.616069 0.400 0.68913
CountrySingapore 0.440322 0.432389 1.018 0.30866
CountrySlovenia 0.857802 0.540036 1.588 0.11238
CountrySouth Africa -0.523938 0.506764 -1.034 0.30133
CountrySouth Korea 0.350885 0.441038 0.796 0.42638
CountrySpain 0.731101 0.389583 1.877 0.06074 .
CountrySweden 0.308317 0.392859 0.785 0.43268
CountrySwitzerland 1.029331 0.537859 1.914 0.05582 .
CountryTaiwan 1.261575 0.437204 2.886 0.00396 **
CountryTunisia 0.522770 0.412964 1.266 0.20572
CountryTurkey 0.619658 0.706340 0.877 0.38046
CountryUK 0.473501 0.385981 1.227 0.22009
CountryUnknown 0.576833 0.388747 1.484 0.13804
CountryUSA 0.678179 0.379771 1.786 0.07432 .
CountryZimbabwe -1.859901 0.903828 -2.058 0.03976 *
rcs(Age, 5)Age:typebackwardcorsi -0.004862 0.071679 -0.068 0.94592
rcs(Age, 5)Age':typebackwardcorsi -0.125377 1.809553 -0.069 0.94477
rcs(Age, 5)Age'':typebackwardcorsi 0.182141 2.743474 0.066 0.94707
rcs(Age, 5)Age''':typebackwardcorsi -0.062855 1.036501 -0.061 0.95165
rcs(Age, 5)Age:typeforward -0.064058 0.029145 -2.198 0.02809 *
rcs(Age, 5)Age':typeforward 1.018996 0.756078 1.348 0.17792
rcs(Age, 5)Age'':typeforward -1.350067 1.151346 -1.173 0.24112
rcs(Age, 5)Age''':typeforward 0.245347 0.442381 0.555 0.57924
rcs(Age, 5)Age:typeforwardcorsi -0.042481 0.036181 -1.174 0.24050
rcs(Age, 5)Age':typeforwardcorsi 0.107799 0.965565 0.112 0.91112
rcs(Age, 5)Age'':typeforwardcorsi 0.024781 1.478495 0.017 0.98663
rcs(Age, 5)Age''':typeforwardcorsi -0.237848 0.580186 -0.410 0.68189
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.989 on 1697 degrees of freedom
Multiple R-squared: 0.658, Adjusted R-squared: 0.6447
F-statistic: 49.48 on 66 and 1697 DF, p-value: < 0.00000000000000022
anova(lr, lr2)
Analysis of Variance Table
Model 1: Mean ~ rcs(Age, 5) * type + as.factor(SES) + Year + Country
Model 2: Mean ~ rcs(Age, 5) * type + as.factor(SES) + Year + Country
Res.Df RSS Df Sum of Sq F Pr(>F)
1 1697 6714
2 1697 6714 0 0
#######Second test: interactions between test year and test type (yes)
lr <- lm(data=subset, Mean ~ rcs(Age, 5) + as.factor(SES) + Year + type + Country, weights=sqrt(Size))
summary(lr)
Call:
lm(formula = Mean ~ rcs(Age, 5) + as.factor(SES) + Year + type +
Country, data = subset, weights = sqrt(Size))
Weighted Residuals:
Min 1Q Median 3Q Max
-9.9245 -1.0841 -0.0316 1.0637 8.4165
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -20.482326 4.356629 -4.701 0.00000279 ***
rcs(Age, 5)Age 0.301476 0.013445 22.422 < 0.0000000000000002 ***
rcs(Age, 5)Age' -5.507562 0.351779 -15.656 < 0.0000000000000002 ***
rcs(Age, 5)Age'' 7.916451 0.536188 14.764 < 0.0000000000000002 ***
rcs(Age, 5)Age''' -2.459307 0.206579 -11.905 < 0.0000000000000002 ***
as.factor(SES)1 0.616803 0.127659 4.832 0.00000148 ***
as.factor(SES)2 0.646534 0.137898 4.688 0.00000297 ***
Year 0.010241 0.002152 4.758 0.00000212 ***
typebackwardcorsi 0.255430 0.094869 2.692 0.007162 **
typeforward 1.550769 0.040948 37.872 < 0.0000000000000002 ***
typeforwardcorsi 0.801358 0.058439 13.713 < 0.0000000000000002 ***
CountryAustralia 0.940124 0.389568 2.413 0.015916 *
CountryAustria 1.257868 0.554540 2.268 0.023435 *
CountryBelgium 0.227984 0.398031 0.573 0.566869
CountryBrazil -0.138842 0.401723 -0.346 0.729675
CountryCanada 0.992639 0.388852 2.553 0.010774 *
CountryChina 1.059591 0.412925 2.566 0.010371 *
CountryColombia 1.076625 0.636013 1.693 0.090681 .
CountryCroatia 0.546397 0.458525 1.192 0.233567
CountryCuba -0.502756 0.728876 -0.690 0.490433
CountryCzechia 0.428076 0.721107 0.594 0.552833
CountryDenmark 0.130738 0.498382 0.262 0.793103
CountryFinland 0.667126 0.415045 1.607 0.108161
CountryFrance 0.494728 0.409321 1.209 0.226962
CountryGermany 0.690509 0.389942 1.771 0.076772 .
CountryHong Kong 1.553581 0.459316 3.382 0.000735 ***
CountryHungary 1.247289 0.676585 1.844 0.065428 .
CountryIndia -0.531206 0.539039 -0.985 0.324534
CountryIran 0.523381 0.567542 0.922 0.356560
CountryIsrael 0.769048 0.479180 1.605 0.108695
CountryItaly 0.255593 0.385005 0.664 0.506863
CountryJamaica 0.449404 0.508676 0.883 0.377102
CountryJapan 0.567073 0.427063 1.328 0.184407
CountryMalaysia 0.802285 0.721005 1.113 0.265981
CountryMexico -0.178110 0.410082 -0.434 0.664106
CountryNetherlands 0.603535 0.394148 1.531 0.125895
CountryNew Zealand 0.177972 0.398442 0.447 0.655170
CountryNorway 0.466413 0.445926 1.046 0.295736
CountryPortugal 0.471766 0.450323 1.048 0.294963
CountryRomania 0.115137 0.534672 0.215 0.829527
CountryRussia 0.485388 0.617067 0.787 0.431622
CountrySingapore 0.518105 0.434067 1.194 0.232798
CountrySlovenia 1.106935 0.543747 2.036 0.041929 *
CountrySouth Africa -0.350708 0.510805 -0.687 0.492441
CountrySouth Korea 0.451461 0.443544 1.018 0.308893
CountrySpain 0.865423 0.391797 2.209 0.027317 *
CountrySweden 0.475823 0.395090 1.204 0.228625
CountrySwitzerland 1.101865 0.543545 2.027 0.042799 *
CountryTaiwan 1.390680 0.438392 3.172 0.001540 **
CountryTunisia 0.750259 0.414060 1.812 0.070169 .
CountryTurkey 0.618722 0.715456 0.865 0.387273
CountryUK 0.619593 0.387984 1.597 0.110460
CountryUnknown 0.691925 0.391418 1.768 0.077283 .
CountryUSA 0.813705 0.382019 2.130 0.033313 *
CountryZimbabwe -1.863085 0.913276 -2.040 0.041503 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.015 on 1709 degrees of freedom
Multiple R-squared: 0.6467, Adjusted R-squared: 0.6355
F-statistic: 57.92 on 54 and 1709 DF, p-value: < 0.00000000000000022
lr2 <- lm(data=subset, Mean ~ rcs(Age, 5) + as.factor(SES) + Year*type + Country, weights=sqrt(Size))
summary(lr2)
Call:
lm(formula = Mean ~ rcs(Age, 5) + as.factor(SES) + Year * type +
Country, data = subset, weights = sqrt(Size))
Weighted Residuals:
Min 1Q Median 3Q Max
-9.9406 -1.0717 -0.0541 1.0710 8.4596
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -16.790696 6.711138 -2.502 0.012445 *
rcs(Age, 5)Age 0.298331 0.013472 22.144 < 0.0000000000000002 ***
rcs(Age, 5)Age' -5.408199 0.353142 -15.315 < 0.0000000000000002 ***
rcs(Age, 5)Age'' 7.762706 0.538390 14.418 < 0.0000000000000002 ***
rcs(Age, 5)Age''' -2.398068 0.207555 -11.554 < 0.0000000000000002 ***
as.factor(SES)1 0.616451 0.127394 4.839 0.00000142 ***
as.factor(SES)2 0.642779 0.137573 4.672 0.00000321 ***
Year 0.008418 0.003325 2.532 0.011435 *
typebackwardcorsi 61.809674 24.459107 2.527 0.011592 *
typeforward -11.869552 8.641123 -1.374 0.169743
typeforwardcorsi 8.851957 13.056646 0.678 0.497885
CountryAustralia 0.936687 0.389002 2.408 0.016149 *
CountryAustria 1.318972 0.553926 2.381 0.017368 *
CountryBelgium 0.215272 0.397532 0.542 0.588220
CountryBrazil -0.138393 0.401302 -0.345 0.730243
CountryCanada 0.979810 0.388424 2.523 0.011742 *
CountryChina 1.038447 0.412152 2.520 0.011840 *
CountryColombia 1.035606 0.634801 1.631 0.102993
CountryCroatia 0.524992 0.457655 1.147 0.251487
CountryCuba -0.524892 0.727577 -0.721 0.470747
CountryCzechia 0.436854 0.719833 0.607 0.544009
CountryDenmark 0.112695 0.497466 0.227 0.820810
CountryFinland 0.649393 0.414306 1.567 0.117201
CountryFrance 0.494461 0.408777 1.210 0.226596
CountryGermany 0.674081 0.389244 1.732 0.083496 .
CountryHong Kong 1.547652 0.458481 3.376 0.000753 ***
CountryHungary 1.243902 0.675082 1.843 0.065562 .
CountryIndia -0.530862 0.538523 -0.986 0.324384
CountryIran 0.483788 0.566405 0.854 0.393148
CountryIsrael 0.736061 0.478292 1.539 0.124005
CountryItaly 0.253849 0.384378 0.660 0.509078
CountryJamaica 0.427921 0.507840 0.843 0.399554
CountryJapan 0.559111 0.426404 1.311 0.189959
CountryMalaysia 0.766783 0.719633 1.066 0.286792
CountryMexico -0.252098 0.409730 -0.615 0.538452
CountryNetherlands 0.577192 0.393427 1.467 0.142536
CountryNew Zealand 0.153263 0.397797 0.385 0.700078
CountryNorway 0.456746 0.445302 1.026 0.305179
CountryPortugal 0.459010 0.449224 1.022 0.307028
CountryRomania 0.081038 0.534117 0.152 0.879423
CountryRussia 0.533523 0.617915 0.863 0.388026
CountrySingapore 0.515578 0.433025 1.191 0.233960
CountrySlovenia 1.139980 0.542954 2.100 0.035911 *
CountrySouth Africa -0.394406 0.509779 -0.774 0.439227
CountrySouth Korea 0.435878 0.442493 0.985 0.324739
CountrySpain 0.853610 0.391188 2.182 0.029239 *
CountrySweden 0.463018 0.394649 1.173 0.240864
CountrySwitzerland 1.076046 0.542612 1.983 0.047518 *
CountryTaiwan 1.410077 0.437392 3.224 0.001289 **
CountryTunisia 0.789628 0.413901 1.908 0.056589 .
CountryTurkey 0.620481 0.713645 0.869 0.384721
CountryUK 0.567041 0.387490 1.463 0.143550
CountryUnknown 0.672534 0.390745 1.721 0.085404 .
CountryUSA 0.800702 0.381402 2.099 0.035931 *
CountryZimbabwe -1.886992 0.911286 -2.071 0.038538 *
Year:typebackwardcorsi -0.030631 0.012175 -2.516 0.011962 *
Year:typeforward 0.006696 0.004310 1.554 0.120457
Year:typeforwardcorsi -0.004009 0.006504 -0.616 0.537726
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.01 on 1706 degrees of freedom
Multiple R-squared: 0.6491, Adjusted R-squared: 0.6373
F-statistic: 55.36 on 57 and 1706 DF, p-value: < 0.00000000000000022
anova(lr, lr2)
Analysis of Variance Table
Model 1: Mean ~ rcs(Age, 5) + as.factor(SES) + Year + type + Country
Model 2: Mean ~ rcs(Age, 5) + as.factor(SES) + Year * type + Country
Res.Df RSS Df Sum of Sq F Pr(>F)
1 1709 6937.1
2 1706 6889.8 3 47.285 3.9027 0.008597 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#######Second test: interactions between SES and test type (no)
lr <- lm(data=subset, Mean ~ rcs(Age, 5) + as.factor(SES) + Year + type + Country, weights=sqrt(Size))
summary(lr)
Call:
lm(formula = Mean ~ rcs(Age, 5) + as.factor(SES) + Year + type +
Country, data = subset, weights = sqrt(Size))
Weighted Residuals:
Min 1Q Median 3Q Max
-9.9245 -1.0841 -0.0316 1.0637 8.4165
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -20.482326 4.356629 -4.701 0.00000279 ***
rcs(Age, 5)Age 0.301476 0.013445 22.422 < 0.0000000000000002 ***
rcs(Age, 5)Age' -5.507562 0.351779 -15.656 < 0.0000000000000002 ***
rcs(Age, 5)Age'' 7.916451 0.536188 14.764 < 0.0000000000000002 ***
rcs(Age, 5)Age''' -2.459307 0.206579 -11.905 < 0.0000000000000002 ***
as.factor(SES)1 0.616803 0.127659 4.832 0.00000148 ***
as.factor(SES)2 0.646534 0.137898 4.688 0.00000297 ***
Year 0.010241 0.002152 4.758 0.00000212 ***
typebackwardcorsi 0.255430 0.094869 2.692 0.007162 **
typeforward 1.550769 0.040948 37.872 < 0.0000000000000002 ***
typeforwardcorsi 0.801358 0.058439 13.713 < 0.0000000000000002 ***
CountryAustralia 0.940124 0.389568 2.413 0.015916 *
CountryAustria 1.257868 0.554540 2.268 0.023435 *
CountryBelgium 0.227984 0.398031 0.573 0.566869
CountryBrazil -0.138842 0.401723 -0.346 0.729675
CountryCanada 0.992639 0.388852 2.553 0.010774 *
CountryChina 1.059591 0.412925 2.566 0.010371 *
CountryColombia 1.076625 0.636013 1.693 0.090681 .
CountryCroatia 0.546397 0.458525 1.192 0.233567
CountryCuba -0.502756 0.728876 -0.690 0.490433
CountryCzechia 0.428076 0.721107 0.594 0.552833
CountryDenmark 0.130738 0.498382 0.262 0.793103
CountryFinland 0.667126 0.415045 1.607 0.108161
CountryFrance 0.494728 0.409321 1.209 0.226962
CountryGermany 0.690509 0.389942 1.771 0.076772 .
CountryHong Kong 1.553581 0.459316 3.382 0.000735 ***
CountryHungary 1.247289 0.676585 1.844 0.065428 .
CountryIndia -0.531206 0.539039 -0.985 0.324534
CountryIran 0.523381 0.567542 0.922 0.356560
CountryIsrael 0.769048 0.479180 1.605 0.108695
CountryItaly 0.255593 0.385005 0.664 0.506863
CountryJamaica 0.449404 0.508676 0.883 0.377102
CountryJapan 0.567073 0.427063 1.328 0.184407
CountryMalaysia 0.802285 0.721005 1.113 0.265981
CountryMexico -0.178110 0.410082 -0.434 0.664106
CountryNetherlands 0.603535 0.394148 1.531 0.125895
CountryNew Zealand 0.177972 0.398442 0.447 0.655170
CountryNorway 0.466413 0.445926 1.046 0.295736
CountryPortugal 0.471766 0.450323 1.048 0.294963
CountryRomania 0.115137 0.534672 0.215 0.829527
CountryRussia 0.485388 0.617067 0.787 0.431622
CountrySingapore 0.518105 0.434067 1.194 0.232798
CountrySlovenia 1.106935 0.543747 2.036 0.041929 *
CountrySouth Africa -0.350708 0.510805 -0.687 0.492441
CountrySouth Korea 0.451461 0.443544 1.018 0.308893
CountrySpain 0.865423 0.391797 2.209 0.027317 *
CountrySweden 0.475823 0.395090 1.204 0.228625
CountrySwitzerland 1.101865 0.543545 2.027 0.042799 *
CountryTaiwan 1.390680 0.438392 3.172 0.001540 **
CountryTunisia 0.750259 0.414060 1.812 0.070169 .
CountryTurkey 0.618722 0.715456 0.865 0.387273
CountryUK 0.619593 0.387984 1.597 0.110460
CountryUnknown 0.691925 0.391418 1.768 0.077283 .
CountryUSA 0.813705 0.382019 2.130 0.033313 *
CountryZimbabwe -1.863085 0.913276 -2.040 0.041503 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.015 on 1709 degrees of freedom
Multiple R-squared: 0.6467, Adjusted R-squared: 0.6355
F-statistic: 57.92 on 54 and 1709 DF, p-value: < 0.00000000000000022
lr2 <- lm(data=subset, Mean ~ rcs(Age, 5) + as.factor(SES)*type + Year + Country, weights=sqrt(Size))
summary(lr2)
Call:
lm(formula = Mean ~ rcs(Age, 5) + as.factor(SES) * type + Year +
Country, data = subset, weights = sqrt(Size))
Weighted Residuals:
Min 1Q Median 3Q Max
-9.9069 -1.0834 -0.0287 1.0654 8.3755
Coefficients: (2 not defined because of singularities)
Estimate Std. Error t value Pr(>|t|)
(Intercept) -20.727258 4.361207 -4.753 0.000002176340 ***
rcs(Age, 5)Age 0.301739 0.013453 22.429 < 0.0000000000000002 ***
rcs(Age, 5)Age' -5.516419 0.352132 -15.666 < 0.0000000000000002 ***
rcs(Age, 5)Age'' 7.930527 0.536777 14.774 < 0.0000000000000002 ***
rcs(Age, 5)Age''' -2.465485 0.206873 -11.918 < 0.0000000000000002 ***
as.factor(SES)1 0.656940 0.149121 4.405 0.000011214622 ***
as.factor(SES)2 0.758868 0.170569 4.449 0.000009184026 ***
typebackwardcorsi 0.425277 0.249527 1.704 0.088502 .
typeforward 1.723851 0.263184 6.550 0.000000000076 ***
typeforwardcorsi 0.767317 0.157834 4.862 0.000001271816 ***
Year 0.010342 0.002154 4.802 0.000001708905 ***
CountryAustralia 0.937406 0.389746 2.405 0.016271 *
CountryAustria 1.155067 0.560450 2.061 0.039458 *
CountryBelgium 0.221507 0.398227 0.556 0.578125
CountryBrazil -0.150896 0.401903 -0.375 0.707370
CountryCanada 0.995315 0.389022 2.559 0.010598 *
CountryChina 1.066204 0.413183 2.580 0.009950 **
CountryColombia 1.102524 0.636726 1.732 0.083534 .
CountryCroatia 0.537141 0.458665 1.171 0.241724
CountryCuba -0.512746 0.729185 -0.703 0.482042
CountryCzechia 0.426954 0.721518 0.592 0.554101
CountryDenmark 0.122752 0.498534 0.246 0.805537
CountryFinland 0.661032 0.415311 1.592 0.111647
CountryFrance 0.490267 0.409688 1.197 0.231597
CountryGermany 0.687929 0.390077 1.764 0.077983 .
CountryHong Kong 1.547553 0.459472 3.368 0.000774 ***
CountryHungary 1.249044 0.676863 1.845 0.065161 .
CountryIndia -0.553607 0.539498 -1.026 0.304965
CountryIran 0.479953 0.569237 0.843 0.399262
CountryIsrael 0.769458 0.480122 1.603 0.109202
CountryItaly 0.250939 0.385267 0.651 0.514917
CountryJamaica 0.444152 0.508863 0.873 0.382877
CountryJapan 0.532111 0.427582 1.244 0.213500
CountryMalaysia 0.784968 0.721289 1.088 0.276623
CountryMexico -0.217375 0.411063 -0.529 0.597005
CountryNetherlands 0.594316 0.394298 1.507 0.131925
CountryNew Zealand 0.171844 0.398662 0.431 0.666485
CountryNorway 0.462517 0.446185 1.037 0.300068
CountryPortugal 0.456757 0.450629 1.014 0.310918
CountryRomania 0.102637 0.534959 0.192 0.847875
CountryRussia 0.482984 0.617566 0.782 0.434278
CountrySingapore 0.509776 0.434199 1.174 0.240535
CountrySlovenia 1.037939 0.546002 1.901 0.057473 .
CountrySouth Africa -0.358881 0.510986 -0.702 0.482569
CountrySouth Korea 0.463926 0.445105 1.042 0.297428
CountrySpain 0.860824 0.391977 2.196 0.028218 *
CountrySweden 0.469645 0.395302 1.188 0.234973
CountrySwitzerland 1.094788 0.543965 2.013 0.044313 *
CountryTaiwan 1.393353 0.438507 3.177 0.001512 **
CountryTunisia 0.752460 0.414337 1.816 0.069537 .
CountryTurkey 0.618626 0.715536 0.865 0.387400
CountryUK 0.617319 0.388149 1.590 0.111927
CountryUnknown 0.687659 0.391603 1.756 0.079266 .
CountryUSA 0.807304 0.382250 2.112 0.034833 *
CountryZimbabwe -1.881302 0.913542 -2.059 0.039612 *
as.factor(SES)1:typebackwardcorsi -0.200336 0.267598 -0.749 0.454173
as.factor(SES)2:typebackwardcorsi NA NA NA NA
as.factor(SES)1:typeforward -0.155211 0.266667 -0.582 0.560616
as.factor(SES)2:typeforward -0.322924 0.286916 -1.125 0.260536
as.factor(SES)1:typeforwardcorsi 0.035311 0.168115 0.210 0.833661
as.factor(SES)2:typeforwardcorsi NA NA NA NA
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.015 on 1705 degrees of freedom
Multiple R-squared: 0.6474, Adjusted R-squared: 0.6354
F-statistic: 53.98 on 58 and 1705 DF, p-value: < 0.00000000000000022
anova(lr, lr2)
Analysis of Variance Table
Model 1: Mean ~ rcs(Age, 5) + as.factor(SES) + Year + type + Country
Model 2: Mean ~ rcs(Age, 5) + as.factor(SES) * type + Year + Country
Res.Df RSS Df Sum of Sq F Pr(>F)
1 1709 6937.1
2 1705 6922.4 4 14.685 0.9043 0.4606
Creating scores that are controlled for selection bias, age (using spline), the type of memory test that was given, and year of publication. The standard deviations are also adjusted for these factors as well.
lr <- lm(data=subset, Mean ~ rcs(Age, 5) + type + as.factor(SES) + Year, weights=sqrt(Size))
metaobj2 <- metafor::rma(yi=Mean, sei=SE, data=subset, mods = ~ rcs(Age, 5) + type + as.factor(SES) + Year)
lr$coefficients <- metaobj2$b
metaobj32 <- metafor::rma(yi=SD, sei=SE, data=subset, mods = ~ rcs(Age, 5) + type + as.factor(SES) + Year)
lr3 <- lm(data=subset, SD ~ rcs(Age, 5) + type + as.factor(SES) + Year, weights=sqrt(Size))
lr3$coefficients <- metaobj32$b
uzi <- seq(from=3, to=95, by=.1)
uzi2 <- expand.grid(Age = uzi, type = unique(subset$type), SES = 1, Year = 2008)
uzi2$SD_age = predict(lr3, uzi2)
subset$residualscore <- lr$residuals
Then calculating IQ scores (normed at mean of 100) by dividing by the predicted standard deviation given the age/year of the sample.
subset$roundage <- format(round(subset$Age, 1), nsmall = 1)
uzi2$Age_formatted <- format(uzi2$Age, nsmall = 1)
subset2 <- left_join(
subset,
uzi2 %>% select(Age_formatted, type, SD_age),
by = c('roundage' = 'Age_formatted', 'type' = 'type')
)
subset2$IQ <- subset2$residualscore/subset2$SD_age*15+100
Then, the averages within studies are calculated to reduce heterogeneity, and the same sample size tested twice is counted as one sample.
zxc <- subset2 %>%
group_by(pasteID, type) %>%
summarise(IQ2 = mean(IQ), n = sum(Size), Country = first(Country), .groups = 'drop') %>%
group_by(pasteID) %>%
mutate(n_per_type = n / sum(n), n2 = n*n_per_type)
zxcv <- zxc %>%
group_by(Country) %>%
summarise(uwtdIQ = mean(IQ2), wtdIQ = wtd.mean(IQ2, n), medianIQ = median(IQ2), n3 = sum(n2), k = n_distinct(pasteID))
4th method of calculating averages that involves using a mixed-effects meta-analytic model:
lr <- lm(data=subset, Mean ~ Country + rcs(Age, 5)*type + as.factor(SES) + Year + type, weights=sqrt(Size))
metaobj2 <- metafor::rma(yi=Mean, sei=SE, data=subset, mods = ~ Country + rcs(Age, 5)*type + as.factor(SES) + Year + type, weights=sqrt(Size))
Warning: There are outcomes with non-positive sampling variances.Warning: Cannot compute QE-test, I^2, or H^2 when there are non-positive sampling variances in the data.
prenames <- names(lr$coefficients)
lr$coefficients <- metaobj2$b
intercept <- predict.lm(lr, newdata=data.frame(Country='Argentina', Age=40, SES=1, Year=2008, type='backward'))
death <- data.frame(name=prenames, backward=as.numeric(lr$coefficients)+intercept)
death$name[1] <- 'Argentina'
death$backward[1] <- intercept
death$name[2:45] <- sapply(death$name[2:45], function(x) substr(x, start = 8, stop = nchar(x)))
death <- death[1:45, ]
mean((subset %>% filter(type=='backward'))$SD)
[1] 1.215849
death$mIQ = (death$backward-5.018288)/1.215849*15+100
All 4 methods + the average of the 4. Some of these figures (e.g. high scores for Taiwan, Hong Kong, Switzerland) check out. Others (New Zealand at 94) look off. In fact this project has been rather disappointing. The figures simply don’t look accurate.
zxcv$name <- zxcv$Country
set <- left_join(death, zxcv, by='name')
set$Average <- (set$uwtdIQ + set$wtdIQ + set$medianIQ + set$mIQ)/4
print(set %>% select(Country, uwtdIQ, wtdIQ, medianIQ, mIQ, Average, n3, k) %>% arrange(-Average), n = 45)
NA