---
title: "Session 3 — Center and spread"
subtitle: "Probability and Statistics (MIR)"
author: "Prof. Dae-Jin Lee (daelee@faculty.ie.edu)"
date: "Fall 2026"
output:
  html_document:
    toc: true
    theme: flatly
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
library(tidyverse)
```

```{r}
ci <- read_csv("data/country_indicators.csv")
```

# Life expectancy (roughly symmetric)

```{r}
ci |> summarise(
  n = n(),
  mean = mean(life_expectancy),
  median = median(life_expectancy),
  sd = sd(life_expectancy),
  IQR = IQR(life_expectancy),
  .groups = "drop"
)
```

# GDP per capita (right-skewed)

```{r}
ci |> summarise(
  mean = mean(gdp_per_capita),
  median = median(gdp_per_capita),
  sd = sd(gdp_per_capita),
  IQR = IQR(gdp_per_capita)
)
```

**Interpret:** Mean ≫ median for GDP → skew / high outliers. Prefer median for “typical” country income in briefs.

# By conflict status (descriptive only)

```{r}
ci |>
  group_by(recent_internal_conflict) |>
  summarise(
    n = n(),
    mean_le = mean(life_expectancy),
    median_le = median(life_expectancy),
    .groups = "drop"
  )
```
