library(foreign)
library(ltm)
## Loading required package: MASS
## Loading required package: msm
## Loading required package: polycor
library(likert)     # create basic Likert tables and plots
## Loading required package: ggplot2
## Loading required package: xtable
library(kableExtra) # create formatted tables 

setwd("/Users/oliviaopitz/Documents/2. Semester MCI/Advanced Statistics")
df = read.spss("ESS11.sav", to.data.frame = T)
#names(df)
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)

Assignment 5:

1. Core Message
The graphic shows the distribution of clinical depression across genders in Italy, based on responses from the ESS Round 11. It displays how many male and female participants screened positive (TRUE) or negative (FALSE) for clinical depression, using a threshold score of 9 or higher on a depression scale.

2. Description of Final Graphic
The plot is a stacked bar chart with:
- x-axis: Gender (gndr)
- y-axis: Count of participants
- fill color: Clinical depression status (TRUE = depressed, FALSE = not depressed)
Each bar represents the number of participants by gender, subdivided into depressed and non-depressed groups. Missing values (NA) were excluded, so the chart focuses only on participants with valid depression data, enabling a clear comparison of depression prevalence by gender.

ggplot(df_clean, aes(x = gender_label, fill = clin_depression)) +
  geom_bar() +
  labs(
    title = "Histogram of Clinical Depression across Italy",
    subtitle = "ESS Round 11",
    x = "Gender",
    y = "Count",
    caption = "Olivia Opitz",
    fill = "Clinically Depressed"
  ) +
  theme_minimal()