To run the reconstruction file and create the Political Extremism data for the World Value Survey (WVS) please perform the following steps:

  1. Obtain the reconstruction ZIP file from the author
  2. Unpack the zip file to a direcotry on your PC
  3. Open the file extremism_measures_gauge.Rmd in RStudio
  4. Select the knit Document command from the File menu
    • All data files are located in the data/ sub-directory
    • All graphs and tables are located in the out/ sub-directory

The analysis was developed using R version 4.4.0 (2024-04-24) and RStudio 2024.04.2 release for Windows.

To view the code - click on the ‘Code’ buttons on the right side of the page.

Load required libraries and support R files

# load external packages and source helper functions

library(dplyr) 
library(extrafont)
library(ggplot2)
library(plotly)
library(viridis)
library(gridExtra)
library(gt)
library(lavaan)
library(psych)
library(patchwork)
library(shiny)

source("extremism_gauge.R")

options(dplyr.summarise.inform = FALSE)

Set the default theme & font for plots and tables

extrafont::loadfonts(device = "win", quiet=TRUE)
ggplot2::theme_set(theme_bw() +
            theme(text = element_text(family = "LM Roman 10", size = 12)))

1 Political Extremism Gauge

Read the WVS + Political Extremism data from ‘WVS/data/wvs_pe.RDS’.

df <- as.data.frame(readRDS("WVS/data/wvs_pe.RDS"))

Calculate the political extremism gauge.

indices <- extremism_indices(df, 
                             col_p = "country", 
                             col_I = "right_wing", 
                             col_B = "violence_scores", 
                             col_S = "political_tolerance") 

Country distribution plots (Sample countries)

United States

population_distributions(df, 
                         indices = indices,
                         selected_group = "United States",
                         col_p = "country",
                         col_I = "right_wing", 
                         col_B = "violence_scores", 
                         col_S = "political_tolerance")

New Zealand

population_distributions(df, 
                         indices = indices,
                         selected_group = "New Zealand",
                         col_p = "country",
                         col_I = "right_wing", 
                         col_B = "violence_scores", 
                         col_S = "political_tolerance")

Extremism Levels Bar Chart plots

extremism_levels(indices = indices, group_names = unique(df$country),
                 chart_type = "Ideological", col_p = "country")


extremism_levels(indices = indices, group_names = unique(df$country),
                 chart_type = "Behavioral", col_p = "country")


extremism_levels(indices = indices, group_names = unique(df$country),
                 chart_type = "Social", col_p = "country")


extremism_levels(indices = indices, group_names = unique(df$country),
                 chart_type = "ER2", col_p = "country")


extremism_levels(indices = indices, group_names = unique(df$country),
                 chart_type = "ER3", col_p = "country")

Extremism Levels 3D Charts

Using Extremism Rank-2 (ER2)

extremism_levels_3d(indices = indices, group_names = unique(df$country), 
                    er_name = "ER2", col_p = "country")

Using Extremism Rank-3 (ER3)

extremism_levels_3d(indices = indices, group_names = unique(df$country), 
                    er_name = "ER3", col_p = "country")