############################
# GLOBALS
#
#
# Part of replication files for:
# Dill, Janina, Howlett, Marnie, & Müller-Crepon, Carl (2025).
# Do Ukrainians Still Prefer Self-Defense Against Russia At Any Cost? 
# Journal of Peace Research, forthcoming.
#
#############################

## Directory
data.dir <- "data"

## Results
fig.path <- "results/figures"
tab.path <- "results/tables"
num.path <- "results/numbers"


# Libraries
library(car)
library(msm)
library(fixest)
library(ggplot2)
library(plyr)
library(sp)
library(rgdal)
library(rgeos)
library(ggtext)
library(stargazer)
library(haven)
library(gtools)
library(lubridate)
library(labelled)

# Functions
source("code/functions.R")

# VARIABLES ##############

# Samples
samples <- c("Sample A" = "in_2022",
             "Sample B" = "in_2024")

# Labels

## Treatments
attr.labs <- list("Territorial\nintegrity" = c("Full integrity", "minus Crimea", "minus Luhansk,\nDonetsk & Crimea"),
                  "Civilian\nfatalities" = c("Low", "Intermediate", "High"), #c("6'000", "12'000", "24'000"),
                  "Military\nfatalities" = c("Low", "Intermediate", "High"),# c("6'000", "12'000", "24'000"),
                  "Nuclear\nrisk" = c("Low", "Intermediate", "High"), #c("None (0%)", "Low (5%)", "Moderate (10%)"),
                  "Political\nautonomy" = c("Full autonomy",
                                            "Negotiated\nneutrality", 
                                            "Russian-controlled\ngovernment"))

### Name values
for(a in seq_along(attr.labs)){
  names(attr.labs[[a]]) <- 
    paste0("attr", a, "_d", seq_along(attr.labs[[a]]))
}


# Outcomes
outvars <- c("Score (0-1)" = "score", "Forced choice (0/1)" = "choice")

# Clustering
clustvar <- "id"

# Variables along which to compute heterogeneous effects
hetvars <- list(`Demographics` = c("Gender" =  "sex",  
                                   "Internal migrant" =  "moved",  
                                   "Age (5 groups)" = "age_5gr", 
                                   "Children: yes/no" = "children",  
                                   "Level of education" = "educ",  
                                   "Economic deprivation" = "econdepr",  
                                   # "IDPs in HH" = "hh_idp",
                                   "Rural / Urban" = "urbrur", 
                                   "Interview language" = "lang",  
                                   "Native language" = "natlang",
                                   "Ethnic identity" = "ethnic"), 
                
                `Affectedness` =  c(
                                    "Affectedness score" = "aff_score",
                                    "East vs. West" = "region",  
                                    "Oblast first attacked" = "diraffected",
                                    "Self war-affected" = "selfaffected",
                                    "Family war-affected" = "famaffected",
                                    "Any one-sided violence" = "onesided_all_d",
                                    "Any battles" = "battle_all_d" ,
                                    "Any shelling" = "shelling_all_d",
                                    NULL
                                    ),  
                
                `Attitudes` = c("Importance of victory" = "victimp" ,
                                "Survival of nation at stake" = "survnat",  
                                "Trust in president" = "trustpres"))

# COLORS ##############
custom.col <-c("#000000", "#E69F00", "#56B4E9", "#009E73",
               "#F0E442", "#0072B2", "#D55E00", "#CC79A7",
               "blue", "red", "orange", "yellow")

