# HR attrition and satisfaction: methodology

## Research question

Do employees recorded as having left report lower satisfaction than employees recorded as having stayed?

## Data

- File: `data/hr_analytics.csv`
- Current source documentation: [HR_data in the EIX package](https://search.r-project.org/CRAN/refmans/EIX/html/HR_data.html)
- Dataset description: 14,999-row HR Analytics sample formerly distributed through Kaggle
- Original Kaggle listing: `https://www.kaggle.com/ludobenistant/hr-analytics` (no longer available)
- Original publisher: not independently verified
- Dataset license: not independently verified
- Rows: 14,999
- Columns: 10
- Outcome: `satisfaction_level`, a numeric score from 0 to 1
- Group: `left`, coded `1` for left and `0` for stayed
- Personal identifiers: none in the bundled file
- Expected SHA-256: `af8c4cede39f28b5a67c748a66aa850fe260f908cbeaa226694121e0a9a4e105`

The reproducibility kit records current source documentation, the unavailable original listing, and the exact local file hash. It does not assign an unverified publisher or dataset license. The live case uses the bundled file for deterministic recomputation. No live web collection runs when this case loads.

The analysis uses complete numeric satisfaction values in the two recorded groups. It does not infer an employee's identity, reason for leaving, or future behavior.

## Method

The analysis computes each group's sample size and mean satisfaction, then runs a two-sided Welch independent-samples t-test. Welch's test is used because it does not assume equal variances or equal group sizes. The reported mean difference is `left - stayed`.

The output includes:

- group sample sizes and means;
- Welch t statistic and Welch-Satterthwaite degrees of freedom;
- two-sided p value;
- 95% confidence interval for the mean difference;
- pooled-standard-deviation Cohen's d as a standardized descriptive effect size; and
- an APA-formatted result line.

## Assumptions and interpretation

The rows are treated as independent observations, the satisfaction score is treated as numeric, and the two groups are the values recorded in `left`. With these large groups, the mean comparison is not especially sensitive to modest non-normality, but dependence, repeated employees, selection bias, measurement error, or undocumented data generation could still invalidate the interpretation.

This is an observational association. It does not establish that lower satisfaction caused departure, that departure caused lower satisfaction, or that this sample represents a particular workforce. The very small p value is not a measure of business importance; the mean difference, interval, and effect size carry that information.

## Reproduce

1. Extract the complete reproducibility ZIP.
2. Keep its folder structure intact.
3. Run `python reproduce.py` with Python 3.12 or newer.
4. The script verifies the CSV hash, recomputes the test through the bundled standard-library engine, compares the result with `case/hr-attrition-result.json`, and exits nonzero if a checked value differs.

The machine receipt records source status, file identity, analysis parameters, expected outputs, and the reproduction command. The methodology explains the human decisions. The runnable script checks the file and recomputes the result.
