options(scipen = 999)

library(dplyr)
library(car)
library(lmtest)
library(stargazer)
library(sandwich)
library(lmtest)

setwd("C:/Users/irina/Documents/DND/EOHI/eohi1")

df <- read.csv("ehi1.csv")

data <- df %>%
  select(eohiDGEN_mean, ehi_global_mean, demo_sex, demo_age_1) %>%
  filter(demo_sex != "Prefer not to say")

str(data)
colSums(is.na(data))
sapply(data, class)

# Create dummy variable for sex (0 = Male, 1 = Female)
data$sex_dummy <- ifelse(data$demo_sex == "Female", 1, 0)

# Verify the dummy coding
print(table(data$demo_sex, data$sex_dummy))
