European Social Survey (ESS)
The barometer of political opinion and behavior across the continent.
One table per country with one row per sampled respondent.
A complex sample designed to generalize to residents aged 15 and older in participating nations.
Released biennially since 2002.
Headquartered at City, University of London and governed by a scientific team across Europe.
Recommended Reading
Four Example Strengths & Limitations:
✔️ Rotating modules allow external researchers to propose new questions
✔️ Sub-national geographies available
❌ Country-specific differences in methodology
❌ Questionnaires only translated into languages spoken by at least 5% of each country’s population
Three Example Findings:
Childless adults aged 65 to 74 in 2002 were not more socially excluded than those in 2018.
The 2022 Russian invasion of Ukraine reduced authoritarian attitudes across eight nations.
Two Methodology Documents:
One Haiku:
Download, Import, Preparation
Register at the ESS Data Portal at https://ess-search.nsd.no/.
Choose
ESS round 8 - 2016. Welfare attitudes, Attitudes to climate change
.Download the integrated file and also the sample design (SDDF) files as
SAV
(SPSS) files:
library(foreign)
ess_int_df <-
read.spss(
file.path(
path.expand( "~" ) ,
"ESS8e02_2.sav"
) ,
to.data.frame = TRUE ,
use.value.labels = FALSE
)
ess_sddf_df <-
read.spss(
file.path(
path.expand( "~" ) ,
"ESS8SDDFe01_1.sav"
) ,
to.data.frame = TRUE ,
use.value.labels = FALSE
)
ess_df <-
merge(
ess_int_df ,
ess_sddf_df ,
by = c( 'cntry' , 'idno' )
)
stopifnot( nrow( ess_df ) == nrow( ess_int_df ) )
Save Locally
Save the object at any point:
# ess_fn <- file.path( path.expand( "~" ) , "ESS" , "this_file.rds" )
# saveRDS( ess_df , file = ess_fn , compress = FALSE )
Load the same object:
Variable Recoding
Add new columns to the data set:
ess_design <-
update(
ess_design ,
one = 1 ,
gndr = factor( gndr , labels = c( 'male' , 'female' ) ) ,
netusoft =
factor(
netusoft ,
levels = 1:5 ,
labels = c( 'Never' , 'Only occasionally' ,
'A few times a week' , 'Most days' , 'Every day' )
) ,
belonging_to_particular_religion = as.numeric( rlgblg == 1 )
)
Analysis Examples with the survey
library
Unweighted Counts
Count the unweighted number of records in the survey sample, overall and by groups:
Descriptive Statistics
Calculate the mean (average) of a linear variable, overall and by groups:
svymean( ~ ppltrst , ess_design , na.rm = TRUE )
svyby( ~ ppltrst , ~ cntry , ess_design , svymean , na.rm = TRUE )
Calculate the distribution of a categorical variable, overall and by groups:
svymean( ~ gndr , ess_design , na.rm = TRUE )
svyby( ~ gndr , ~ cntry , ess_design , svymean , na.rm = TRUE )
Calculate the sum of a linear variable, overall and by groups:
svytotal( ~ ppltrst , ess_design , na.rm = TRUE )
svyby( ~ ppltrst , ~ cntry , ess_design , svytotal , na.rm = TRUE )
Calculate the weighted sum of a categorical variable, overall and by groups:
svytotal( ~ gndr , ess_design , na.rm = TRUE )
svyby( ~ gndr , ~ cntry , ess_design , svytotal , na.rm = TRUE )
Calculate the median (50th percentile) of a linear variable, overall and by groups:
svyquantile( ~ ppltrst , ess_design , 0.5 , na.rm = TRUE )
svyby(
~ ppltrst ,
~ cntry ,
ess_design ,
svyquantile ,
0.5 ,
ci = TRUE , na.rm = TRUE
)
Estimate a ratio:
Measures of Uncertainty
Extract the coefficient, standard error, confidence interval, and coefficient of variation from any descriptive statistics function result, overall and by groups:
this_result <- svymean( ~ ppltrst , ess_design , na.rm = TRUE )
coef( this_result )
SE( this_result )
confint( this_result )
cv( this_result )
grouped_result <-
svyby(
~ ppltrst ,
~ cntry ,
ess_design ,
svymean ,
na.rm = TRUE
)
coef( grouped_result )
SE( grouped_result )
confint( grouped_result )
cv( grouped_result )
Calculate the degrees of freedom of any survey design object:
Calculate the complex sample survey-adjusted variance of any statistic:
Include the complex sample design effect in the result for a specific statistic:
# SRS without replacement
svymean( ~ ppltrst , ess_design , na.rm = TRUE , deff = TRUE )
# SRS with replacement
svymean( ~ ppltrst , ess_design , na.rm = TRUE , deff = "replace" )
Compute confidence intervals for proportions using methods that may be more accurate near 0 and 1. See ?svyciprop
for alternatives:
Replication Example
This example matches statistics and confidence intervals within 0.1% from the Guide to Using Weights and Sample Design Indicators with ESS Data:
published_proportions <- c( 0.166 , 0.055 , 0.085 , 0.115 , 0.578 )
published_lb <- c( 0.146 , 0.045 , 0.072 , 0.099 , 0.550 )
published_ub <- c( 0.188 , 0.068 , 0.100 , 0.134 , 0.605 )
austrians <- subset( ess_design , cntry == 'AT' )
( results <- svymean( ~ netusoft , austrians , na.rm = TRUE ) )
stopifnot( all( round( coef( results ) , 3 ) == published_proportions ) )
( ci_results <- confint( results ) )
stopifnot( all( abs( ci_results[ , 1 ] - published_lb ) < 0.0015 ) )
stopifnot( all( abs( ci_results[ , 2 ] - published_ub ) < 0.0015 ) )
Analysis Examples with srvyr
The R srvyr
library calculates summary statistics from survey data, such as the mean, total or quantile using dplyr-like syntax. srvyr allows for the use of many verbs, such as summarize
, group_by
, and mutate
, the convenience of pipe-able functions, the tidyverse
style of non-standard evaluation and more consistent return types than the survey
package. This vignette details the available features. As a starting point for ESS users, this code replicates previously-presented examples:
Calculate the mean (average) of a linear variable, overall and by groups: