In this script, I perform meta-analyses for the models with smaller time-spans, to put in the Appendix
rm(list=ls())
library(meta)
library(metafor)
library(dplyr)
library(kableExtra)
library(modelsummary)
set.seed(1)
# With the final data
load("./data/meta_analysis/total_results_waves_new.RData")
#Somehow some missings on first and mean year
total_results_waves$first_year[total_results_waves$dep_var == "env_ec_stat"] <- 1986
total_results_waves$first_year[total_results_waves$dep_var == "env_prsimp"] <- 1986
total_results_waves$mean_year[total_results_waves$dep_var == "env_ec_stat"] <- 1991
total_results_waves$mean_year[total_results_waves$dep_var == "env_prsimp"] <- 1991
total_results_waves$mean_year_centered <- total_results_waves$mean_year - mean(total_results_waves$mean_year, na.rm = TRUE)
total_results_waves$attitude_cat <- factor(total_results_waves$attitude_cat)
total_results_waves$attitude_cat <- relevel(total_results_waves$attitude_cat, ref = "behavioral")
# Start with step 2 here, as I don't make forest plots for these models
#Step 2. Empty model with meta-level indicators
model_step_1_att <- rma(yi = mu_time,
sei = mu_time_sd,
data = total_results_waves,
method = "ML",
test = "knha")
model_step_1_att
# Variance
model_step_1_var <- rma(yi = sig_time,
sei = sig_time_sd,
data = total_results_waves,
method = "ML",
test = "knha")
model_step_1_var
# Center mean year
table(total_results_waves$mean_year)
##
## 1991 1995 1997 2004 2005 2009 2010 2012 2013 2014 2015 2018 2020 2021
## 4 1 9 1 14 5 2 9 12 8 14 3 28 12
total_results_waves$mean_year_centered <- total_results_waves$mean_year - mean(total_results_waves$mean_year)
total_results_waves$attitude_cat <- factor(total_results_waves$attitude_cat)
total_results_waves$attitude_cat <- relevel(total_results_waves$attitude_cat, ref = "behavioral")
model_step_2_att <- rma(yi = mu_time,
sei = mu_time_sd,
data = total_results_waves,
mods = ~ attitude_cat,
method = "ML",
test = "knha")
model_step_2_att
##
## Mixed-Effects Model (k = 122; tau^2 estimator: ML)
##
## tau^2 (estimated amount of residual heterogeneity): 0.0303 (SE = 0.0040)
## tau (square root of estimated tau^2 value): 0.1742
## I^2 (residual heterogeneity / unaccounted variability): 99.70%
## H^2 (unaccounted variability / sampling variability): 335.13
## R^2 (amount of heterogeneity accounted for): 0.58%
##
## Test for Residual Heterogeneity:
## QE(df = 119) = 6663.0912, p-val < .0001
##
## Test of Moderators (coefficients 2:3):
## F(df1 = 2, df2 = 119) = 0.3116, p-val = 0.7329
##
## Model Results:
##
## estimate se tval df pval ci.lb ci.ub
## intrcpt -0.0057 0.0386 -0.1489 119 0.8819 -0.0821 0.0706
## attitude_cataffective 0.0456 0.0582 0.7839 119 0.4347 -0.0696 0.1609
## attitude_catcognitive 0.0233 0.0433 0.5385 119 0.5912 -0.0624 0.1090
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model_step_2_var <- rma(yi = sig_time,
sei = sig_time_sd,
data = total_results_waves,
mods = ~ attitude_cat,
method = "ML",
test = "knha")
model_step_2_var
##
## Mixed-Effects Model (k = 122; tau^2 estimator: ML)
##
## tau^2 (estimated amount of residual heterogeneity): 0.0028 (SE = 0.0004)
## tau (square root of estimated tau^2 value): 0.0533
## I^2 (residual heterogeneity / unaccounted variability): 98.43%
## H^2 (unaccounted variability / sampling variability): 63.55
## R^2 (amount of heterogeneity accounted for): 3.12%
##
## Test for Residual Heterogeneity:
## QE(df = 119) = 1106.3330, p-val < .0001
##
## Test of Moderators (coefficients 2:3):
## F(df1 = 2, df2 = 119) = 1.3182, p-val = 0.2715
##
## Model Results:
##
## estimate se tval df pval ci.lb ci.ub
## intrcpt 0.0087 0.0133 0.6526 119 0.5153 -0.0177 0.0351
## attitude_cataffective -0.0122 0.0203 -0.5982 119 0.5509 -0.0524 0.0281
## attitude_catcognitive -0.0235 0.0149 -1.5738 119 0.1182 -0.0530 0.0061
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model_step_3_att <- rma(yi = mu_time,
sei = mu_time_sd,
data = total_results_waves,
mods = ~ attitude_cat + mean_year_centered,
method = "ML",
test = "knha")
model_step_3_att
##
## Mixed-Effects Model (k = 122; tau^2 estimator: ML)
##
## tau^2 (estimated amount of residual heterogeneity): 0.0303 (SE = 0.0040)
## tau (square root of estimated tau^2 value): 0.1742
## I^2 (residual heterogeneity / unaccounted variability): 99.70%
## H^2 (unaccounted variability / sampling variability): 333.98
## R^2 (amount of heterogeneity accounted for): 0.58%
##
## Test for Residual Heterogeneity:
## QE(df = 118) = 6606.7602, p-val < .0001
##
## Test of Moderators (coefficients 2:4):
## F(df1 = 3, df2 = 118) = 0.2070, p-val = 0.8914
##
## Model Results:
##
## estimate se tval df pval ci.lb ci.ub
## intrcpt -0.0051 0.0405 -0.1256 118 0.9002 -0.0852 0.0751
## attitude_cataffective 0.0440 0.0652 0.6749 118 0.5011 -0.0851 0.1731
## attitude_catcognitive 0.0227 0.0448 0.5068 118 0.6133 -0.0660 0.1113
## mean_year_centered 0.0001 0.0023 0.0565 118 0.9551 -0.0043 0.0046
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model_step_4_att <- rma(yi = mu_time,
sei = mu_time_sd,
data = total_results_waves,
mods = ~ attitude_cat + mean_year_centered + ambiguous + national + or_scale + pec_miss + data + nr_waves,
method = "ML",
test = "knha")
## Warning: Redundant predictors dropped from the model.
model_step_4_att
##
## Mixed-Effects Model (k = 122; tau^2 estimator: ML)
##
## tau^2 (estimated amount of residual heterogeneity): 0.0278 (SE = 0.0036)
## tau (square root of estimated tau^2 value): 0.1666
## I^2 (residual heterogeneity / unaccounted variability): 99.64%
## H^2 (unaccounted variability / sampling variability): 276.70
## R^2 (amount of heterogeneity accounted for): 8.99%
##
## Test for Residual Heterogeneity:
## QE(df = 107) = 6291.6591, p-val < .0001
##
## Test of Moderators (coefficients 2:15):
## F(df1 = 14, df2 = 107) = 0.7334, p-val = 0.7366
##
## Model Results:
##
## estimate se tval df pval ci.lb ci.ub
## intrcpt 0.1708 0.1351 1.2644 107 0.2088 -0.0970 0.4387
## attitude_cataffective 0.0211 0.0820 0.2572 107 0.7975 -0.1415 0.1837
## attitude_catcognitive 0.0116 0.0533 0.2184 107 0.8275 -0.0940 0.1173
## mean_year_centered 0.0016 0.0042 0.3693 107 0.7126 -0.0068 0.0100
## ambiguousYes -0.0198 0.0449 -0.4403 107 0.6606 -0.1088 0.0692
## national -0.0597 0.1555 -0.3837 107 0.7019 -0.3680 0.2487
## or_scale 0.0243 0.0123 1.9752 107 0.0508 -0.0001 0.0487 .
## pec_miss -0.2178 1.3344 -0.1632 107 0.8707 -2.8631 2.4276
## dataESS -0.1726 0.1552 -1.1123 107 0.2685 -0.4802 0.1350
## dataEVS -0.1015 0.1485 -0.6833 107 0.4959 -0.3958 0.1929
## dataIO -0.0530 0.1462 -0.3623 107 0.7179 -0.3429 0.2369
## dataISSP -0.0995 0.0653 -1.5237 107 0.1305 -0.2291 0.0300
## dataLISS -0.0496 0.2104 -0.2358 107 0.8141 -0.4667 0.3675
## dataMOT -0.0904 0.1479 -0.6115 107 0.5421 -0.3835 0.2027
## nr_waves -0.0609 0.0279 -2.1831 107 0.0312 -0.1163 -0.0056 *
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Step 3. Variance
model_step_3_var <- rma(yi = sig_time,
sei = sig_time_sd,
data = total_results_waves,
mods = ~ attitude_cat + mean_year_centered,
method = "ML",
test = "knha")
model_step_3_var
##
## Mixed-Effects Model (k = 122; tau^2 estimator: ML)
##
## tau^2 (estimated amount of residual heterogeneity): 0.0028 (SE = 0.0004)
## tau (square root of estimated tau^2 value): 0.0531
## I^2 (residual heterogeneity / unaccounted variability): 98.41%
## H^2 (unaccounted variability / sampling variability): 62.93
## R^2 (amount of heterogeneity accounted for): 3.76%
##
## Test for Residual Heterogeneity:
## QE(df = 118) = 1106.3252, p-val < .0001
##
## Test of Moderators (coefficients 2:4):
## F(df1 = 3, df2 = 118) = 1.0303, p-val = 0.3819
##
## Model Results:
##
## estimate se tval df pval ci.lb ci.ub
## intrcpt 0.0055 0.0141 0.3914 118 0.6962 -0.0224 0.0335
## attitude_cataffective -0.0050 0.0229 -0.2179 118 0.8279 -0.0503 0.0403
## attitude_catcognitive -0.0206 0.0155 -1.3325 118 0.1853 -0.0513 0.0100
## mean_year_centered -0.0005 0.0008 -0.6835 118 0.4956 -0.0021 0.0010
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model_step_4_var <- rma(yi = sig_time,
sei = sig_time_sd,
data = total_results_waves,
mods = ~ attitude_cat + mean_year_centered + ambiguous + national + or_scale + pec_miss + data + nr_waves,
method = "ML",
test = "knha")
## Warning: Redundant predictors dropped from the model.
model_step_4_var
##
## Mixed-Effects Model (k = 122; tau^2 estimator: ML)
##
## tau^2 (estimated amount of residual heterogeneity): 0.0026 (SE = 0.0004)
## tau (square root of estimated tau^2 value): 0.0513
## I^2 (residual heterogeneity / unaccounted variability): 98.12%
## H^2 (unaccounted variability / sampling variability): 53.22
## R^2 (amount of heterogeneity accounted for): 10.28%
##
## Test for Residual Heterogeneity:
## QE(df = 107) = 953.6440, p-val < .0001
##
## Test of Moderators (coefficients 2:15):
## F(df1 = 14, df2 = 107) = 0.6901, p-val = 0.7796
##
## Model Results:
##
## estimate se tval df pval ci.lb ci.ub
## intrcpt 0.0095 0.0459 0.2059 107 0.8373 -0.0815 0.1005
## attitude_cataffective 0.0063 0.0285 0.2197 107 0.8265 -0.0502 0.0627
## attitude_catcognitive -0.0200 0.0183 -1.0934 107 0.2767 -0.0562 0.0162
## mean_year_centered 0.0007 0.0014 0.4748 107 0.6359 -0.0022 0.0035
## ambiguousYes 0.0190 0.0154 1.2345 107 0.2197 -0.0115 0.0495
## national -0.0754 0.0566 -1.3315 107 0.1858 -0.1877 0.0369
## or_scale 0.0032 0.0042 0.7501 107 0.4548 -0.0052 0.0115
## pec_miss -0.5584 0.4583 -1.2184 107 0.2258 -1.4668 0.3501
## dataESS -0.0361 0.0524 -0.6888 107 0.4925 -0.1400 0.0678
## dataEVS -0.0104 0.0497 -0.2087 107 0.8350 -0.1089 0.0882
## dataIO 0.0313 0.0538 0.5822 107 0.5616 -0.0753 0.1380
## dataISSP 0.0076 0.0220 0.3440 107 0.7315 -0.0361 0.0512
## dataLISS 0.0671 0.0796 0.8439 107 0.4006 -0.0906 0.2249
## dataMOT 0.0636 0.0542 1.1725 107 0.2436 -0.0439 0.1710
## nr_waves -0.0003 0.0095 -0.0306 107 0.9756 -0.0191 0.0186
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
models <- list("M1" = model_step_1_att, "M2" = model_step_2_att, "M3" = model_step_3_att, "M4" = model_step_4_att, "M1" = model_step_1_var, "M2"= model_step_2_var, "M3"= model_step_3_var, "M4" = model_step_4_var)
modelsummary(models, output = "kableExtra", statistic = 'std.error', stars = TRUE, shape = term ~ model + statistic, title = "
Appendix X. Meta-regression on climate change attitudes and polarization per wave.", fmt = fmt_statistic(estimate = 3, std.error =3), coef_rename = c("overall" ="Intercept",
"intercept" = "Intercept",
"attitude_cataffective" = "Affective attitude (ref = beh)",
"attitude_catcognitive" = "Cognitive attitude",
"mean_year_centered" = "Mean year centered",
"ambiguousYes" = "Ambiguous (ref = no)",
"national" = "National (ref = no)",
"or_scale" = "Original scale",
"pec_miss" = "Perc. missings",
"dataESS"= "ESS (ref = EB)",
"dataEVS"= "EVS",
"dataISSP" = "ISSP",
"dataLISS"= "LISS",
"dataMOT" = "MOT",
"nr_waves" = "Nr. of waves"), gof_map = NA) %>%
kable_classic_2(html_font = "Times", fixed_thead = T, full_width = F) %>%
add_header_above(c(" " = 1, "Mu" = 8, "Sigma" = 8)) %>%
save_kable("./output/appendix/meta_regression_table_per_wave_JANUARY.html")