Code
#loading the necessary R packages:
library(readxl)
library(tidyverse)
library(here)
library(ggridges)
library(ggthemes)
library(gt)Water security means ensuring that all people have access to safe, sufficient, and affordable water where they need it, yet in rural Iran, residents’ lived experiences reveal ongoing difficulties despite extensive water infrastructure. Efforts to improve and sustain water security have only been partially successful, demonstrating that water insecurity cannot be viewed solely as a technical problem or a matter of resource scarcity. Instead, it is a complex and multifaceted lived experience that affects physical and mental health, economic livelihoods, and the social and cultural cohesion of communities (Stoler et al. 2023). This study explores these realities by documenting the experiences of rural households in Chaharmahal and Bakhtiari Province using the Household Water Insecurity Experiences (HWISE) Scale.
The main objective of this project is to assess the experiences of water insecurity among rural households in Chaharmahal and Bakhtiari Province, Iran.
This dataset contains primary survey data from 243 rural women in villages across Chaharmahal and Bakhtiari Province, Iran, gathered to evaluate household water insecurity alongside socioeconomic and infrastructural factors. Each entry corresponds to one household and includes detailed demographic information—such as household size, the respondent’s education level, and primary livelihood—as well as data on household expenditures and sources of drinking and hygienic water. The dataset also documents the presence of water-related infrastructure, including pumps, storage tanks, and filtration systems, in addition to information on water billing and payment practices. Central to the dataset are 12 standardized items (hwise1–hwise12) adapted from the HWISE scale (Young et al. 2019), which measure households’ frequency and intensity of water scarcity, reliability challenges, and psychosocial stress related to water access. Together, these variables provide a strong empirical basis for analyzing how infrastructure, socioeconomic conditions, and gendered experiences collectively shape water security and wellbeing at the household level.
#loading the necessary R packages:
library(readxl)
library(tidyverse)
library(here)
library(ggridges)
library(ggthemes)
library(gt)# import raw data
raw_data<- read_csv(here::here("data/raw/raw_data.csv"))#bringing data into a state where it’s ready for analysis
glimpse(raw_data)
str(raw_data)#selecting the required variables and renaming
processed_data<-raw_data |>
select(
c(
questionnaireID:householdMember,
respondant_education,
livelihood1,
starts_with("drinkSource"),
starts_with("hygienSource"),
waterPump,
waterTank,
waterBill,
starts_with("hwise")
)
) |>
rename(
livelihood=livelihood1,
id=questionnaireID)#checking the processed_data
glimpse(processed_data)
head(processed_data)#saving processed_data file in the data/processed folder
write_csv(processed_data,here::here("data/processed/hwise_chb_processed.csv"))#HWISEScale scores are calculated by assigning numeric values to each response—0 for “never,” 1 for “rarely,” 2 for “sometimes,” and 3 for both “often” and “always”—and then summing all items. This total score represents the overall level of household water insecurity.
processed_data <- processed_data |>
mutate(across(starts_with("hwise"),
~ case_when(
is.na(.) ~ .,
. == 0 ~ 0,
. >= 1 & . < 3 ~ 1,
. >= 3 & . <= 10 ~ 2,
. > 10 ~ 3,
TRUE ~ NA_real_
),
.names = "new_{.col}"))
processed_data |> select(starts_with("new_hwise")) |> names()
processed_data <- processed_data |>
mutate(hwiseScale = rowSums(across(starts_with("new_hwise")), na.rm = TRUE))
#Create the hwiseSensitivity variable
processed_data <- processed_data |>
mutate(
hwiseSensitivity = case_when(
hwiseScale < 3 ~ "No-to-marginal",
hwiseScale < 12 ~ "Low",
hwiseScale < 24 ~ "Moderate",
TRUE ~ "High"
),
hwiseSensitivity = factor(hwiseSensitivity, levels = c("No-to-marginal", "Low", "Moderate", "High")) # Ensure order for stacking
)The findings in Figure 1 indicate that moderate water-related challenges—such as limited access to sufficient drinking water and recurring anger linked to water issues (hwise9)—are relatively widespread, with responses clustering around mid-range values. In contrast, severe experiences like going to bed thirsty (hwise10) and having no drinking water at home (hwise11) are rare for most households but exhibit extreme positive skewness, indicating that a small yet highly vulnerable minority faces these conditions repeatedly. Feelings of shame or humiliation associated with water insecurity (hwise12), although less common, point to a socially and identity-driven dimension of hardship that affects a meaningful subset of households.
hwise_long <- processed_data |>
pivot_longer(cols = hwise1:hwise12,
names_to = "variable",
values_to = "value")
hwise_long <- hwise_long |>
mutate(variable = factor(variable,
levels = paste0("hwise", 1:12)))
ggplot(hwise_long, aes(x = variable, y = value)) +
geom_boxplot(fill = "skyblue") +
labs(title = "",
x = "HWISE items",
y = "Frequency of Household Water Insecurity Experiences") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
The village-level analysis of the HWISE index in Figure 2 shows that water insecurity varies substantially both within and across communities, revealing meaningful spatial patterns rather than purely household-level differences. Three broad types of villages emerge: those that are largely secure, those facing widespread structural insecurity, and those marked by sharp internal divides in access to water. The concentration of high insecurity levels in specific locations highlights clear spatial clustering of highly vulnerable households . Overall, the findings emphasize the need for disaggregated, locally tailored policy responses, as village-level differences play a critical role in shaping the severity and nature of water insecurity.
ggplot(processed_data,aes(x=hwiseScale,y=villageName,fill=villageName))+ geom_density_ridges(show.legend = FALSE,alpha = 0.5,,jittered_points = TRUE,point_alpha=1,point_shape=21,point_size = 0.5)+ scale_colour_colorblind()+ theme(axis.text.y = element_text(size = 8))+
labs(title = "",
x = "HWISE score",
y = "Villages") +
scale_y_discrete(labels=c(
"dehSoukhtehLordegan" = "Deh-Soukhte",
"doraLordegan"= "Doral",
"emamzadeHasssanLordegan"= "Emamzade-Hasssan",
"ghalleeMadreseLordegan"= "Ghallee-Madrese",
"kalamoueLordegan"="Kalamoue",
"konrakBrojen"="konrak",
"oujeBegazShareKord"="Ouje-Begaz",
"terekiChelgerd"="Tereki",
"teyakChelgerd"="Teyak"
))
#Create the householdSizeCategory variable
processed_data <- processed_data |>
mutate(
householdSizeCategory = case_when(
householdMember < 4 ~ "<4",
householdMember >= 4 & householdMember <= 6 ~ "4-6",
householdMember >= 7 & householdMember <= 10 ~ "7-10",
TRUE ~ "11+"
),
householdSizeCategory = factor(householdSizeCategory, levels = c("<4", "4-6", "7-10", "11+")) # Ensure order for x-axis
)
#Calculate percentage frequencies by householdSizeCategory and hwiseSensitivity
sensitivity_percentages <- processed_data |>
group_by(householdSizeCategory, hwiseSensitivity) |>
summarise(n = n()) |>
group_by(householdSizeCategory) |>
mutate(percentage = n / sum(n) * 100)Table 1 demonstrates a clear escalation of water insecurity as household size increases. In small households (fewer than four members), nearly 72.5% fall into the “no-to-marginal” or “low” insecurity categories, and only 10% experience high insecurity. This distribution shifts sharply in medium households (4–6 members), where low-insecurity cases drop to about 30%, and 59.4% fall into the moderate category. Among large households (7–10 members), high-insecurity cases rise to roughly 30%, and low-insecurity cases disappear. In very large households (11 or more members), water insecurity reaches its extreme, with 100% of households classified as highly insecure. Overall, the evidence shows a strong, consistent pattern: larger households face significantly greater and more severe water insecurity.
sensitivity_percentages |>
group_by(householdSizeCategory) |>
select(-n) |>
gt(rowname_col = "hwiseSensitivity") |>
tab_stubhead(label = "Household Size") |>
fmt_number(columns = percentage, decimals = 1) |>
tab_stub_indent(rows = everything(),
indent = 3
)| Household Size | percentage |
|---|---|
| <4 | |
| No-to-marginal | 30.0 |
| Low | 42.5 |
| Moderate | 17.5 |
| High | 10.0 |
| 4-6 | |
| No-to-marginal | 11.5 |
| Low | 18.8 |
| Moderate | 59.4 |
| High | 10.4 |
| 7-10 | |
| No-to-marginal | 2.4 |
| Low | 20.5 |
| Moderate | 47.0 |
| High | 30.1 |
| 11+ | |
| High | 100.0 |