Modeling public opinion over time and space: Trust in state institutions in Europe, 1989-2019

Replication materials

20 February 2023

Note: The analysis in this paper is based on survey data from projects 
whose user agreements prohibit the republication of data. Thus, the survey 
are not included in the replication package. They can be downloaded from the 
respective survey project websites or data archives using the information 
provided in the article's supplement, as well as in the file 
1_harmonization/harmonization.R, which includes original file names of the 
raw survey data.


1. Harmonization: Creating a single dataset with selected variables from 13 cross-national survey projects

script: harmonization.R
auxiliary files for harmonization: harmonization/
cross-walks: ctw/
output: all_cat_27_edu3_subset_2_20211212.rds

auxiliary (sample types for supplement): samples.xlsx

2. Estimation of by-country IRT models of political trust

# Main analysis
scripts: trust_models_des/ - models with design weights

input: all_cat_27_edu3_subset_2_20211212.rds
output: 27 models (at_des.rds - sk_des.rds)
model summaries: summary_models.html

# Supplementary analyses
scripts: trust_models_despst/ - models with design and poststratification weights
scripts: trust_models_noweights/ - models with no weights
scripts: trust_models_disc/ - models with discrimination for selected countries


3. Estimation of education proportions by sex and age groups, to fill in the gaps in the Eurostat data

script: cleaning-demographic-data.R
input: data from Eurostat age x gender (downloaded by the script) and IPUMS age x gender x education (needs downloading separately from https://international.ipums.org/international/)
output: eurostat_ipums_20200603.rds

script: imputation-model.R
input: eurostat_ipums_20200603.rds
output: models_cntry_spline_20201020.rds


4. Post-stratification using models from (2) and post-stratification data from (3)

# Main analysis

script: mrp.R
input: models_cntry_spline_20201020.rds
input: Eurostat data age x gender
input: all_cat_27_edu3_subset_2_20211212.rds
input: 27 models (at_des.rds - sk_des.rds)
output: post_strat_all_des_20220410.rds

script: mrp_diffs.R
input: models_cntry_spline_20201020.rds
input: Eurostat data age x gender
input: all_cat_27_edu3_subset_2_20211212.rds
input: 27 models (at_des.rds - sk_des.rds)
output: post_strat_diffs_des_20220410.rds

# Supplementary analyses
script: mrp_disc.R
output: mrp_all_disc_df_20210129.rds


5. DCPO (Dynamic Comparative Public Opinion)

Validation of cross-country levels using the model designed 
by Prederick Solt (2020, https://doi.org/10.31235/osf.io/d5n9p).




System information

Steps 2, 3, 4:

R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS: /share/apps/spack/software/r/3.5.0/6onxq2a/rlib/R/lib/libRblas.so
LAPACK: /share/apps/spack/software/r/3.5.0/6onxq2a/rlib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.5.0


Step 1:

R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.6.3  bookdown_0.18   plyr_1.8.6      htmltools_0.5.0 tools_3.6.3     yaml_2.2.1      Rcpp_1.0.5      rmarkdown_2.1  
 [9] knitr_1.29      xfun_0.15       digest_0.6.25   packrat_0.5.0   rlang_0.4.7     evaluate_0.14  