Upload folder using huggingface_hub
Browse files- LICENSE.md +46 -0
- README.md +79 -45
- dataset-metadata.json +5 -9
- demo_notebook.ipynb +263 -0
LICENSE.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# License Information
|
| 2 |
+
|
| 3 |
+
## Source Data (All Public Domain or Public Access)
|
| 4 |
+
|
| 5 |
+
### U.S. Census Bureau
|
| 6 |
+
- American Community Survey (ACS) 2022
|
| 7 |
+
- Veteran population estimates
|
| 8 |
+
- Public domain (U.S. Government work)
|
| 9 |
+
|
| 10 |
+
### RAND Corporation
|
| 11 |
+
- State-level firearm ownership estimates (2016)
|
| 12 |
+
- Published research, publicly available
|
| 13 |
+
- URL: rand.org/research/gun-policy
|
| 14 |
+
|
| 15 |
+
### Bureau of Alcohol, Tobacco, Firearms and Explosives (ATF)
|
| 16 |
+
- Federal Firearms Licensee (FFL) counts (2023)
|
| 17 |
+
- Public domain (U.S. Government work)
|
| 18 |
+
|
| 19 |
+
### Centers for Disease Control and Prevention (CDC)
|
| 20 |
+
- WONDER database: Underlying Cause of Death
|
| 21 |
+
- Veteran and civilian suicide rates (2021)
|
| 22 |
+
- Public domain (U.S. Government work)
|
| 23 |
+
|
| 24 |
+
### U.S. Department of Veterans Affairs (VA)
|
| 25 |
+
- PTSD prevalence and VA healthcare utilization (2022)
|
| 26 |
+
- Public domain (U.S. Government work)
|
| 27 |
+
|
| 28 |
+
### U.S. Department of Defense (DoD)
|
| 29 |
+
- Defense Manpower Data Center (DMDC)
|
| 30 |
+
- Active duty personnel and economic impact (2023)
|
| 31 |
+
- Public domain (U.S. Government work)
|
| 32 |
+
|
| 33 |
+
## Combined Dataset
|
| 34 |
+
|
| 35 |
+
This compiled dataset is released under **CC-BY-4.0**.
|
| 36 |
+
|
| 37 |
+
When using this dataset, please cite:
|
| 38 |
+
|
| 39 |
+
```
|
| 40 |
+
Steuber, L. (2026). US Military & Veteran Analysis by State [Dataset].
|
| 41 |
+
Kaggle. https://www.kaggle.com/datasets/lucassteuber/us-military-veteran-analysis
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
## Ethical Considerations
|
| 45 |
+
|
| 46 |
+
This dataset includes sensitive metrics (suicide rates, mental health indicators). Use responsibly for research and policy analysis purposes.
|
README.md
CHANGED
|
@@ -6,85 +6,119 @@ task_categories:
|
|
| 6 |
language:
|
| 7 |
- en
|
| 8 |
tags:
|
| 9 |
-
-
|
| 10 |
-
-
|
| 11 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
- demographics
|
| 13 |
-
-
|
| 14 |
-
|
| 15 |
-
- us-counties
|
| 16 |
-
- geospatial
|
| 17 |
size_categories:
|
| 18 |
-
-
|
| 19 |
-
pretty_name: US Housing Affordability Crisis by County
|
| 20 |
dataset_info:
|
| 21 |
features:
|
| 22 |
-
- name:
|
| 23 |
-
dtype: string
|
| 24 |
-
- name: county_name
|
| 25 |
dtype: string
|
| 26 |
- name: state
|
| 27 |
dtype: string
|
| 28 |
-
- name:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
dtype: int64
|
| 30 |
-
- name:
|
|
|
|
|
|
|
| 31 |
dtype: int64
|
| 32 |
-
- name:
|
| 33 |
dtype: float64
|
| 34 |
-
- name:
|
| 35 |
dtype: float64
|
| 36 |
-
- name:
|
| 37 |
dtype: float64
|
| 38 |
-
- name:
|
| 39 |
-
dtype:
|
| 40 |
-
- name:
|
| 41 |
dtype: float64
|
| 42 |
splits:
|
| 43 |
- name: train
|
| 44 |
-
num_examples:
|
| 45 |
---
|
| 46 |
|
| 47 |
-
# US
|
| 48 |
|
| 49 |
-
|
| 50 |
|
| 51 |
-
##
|
| 52 |
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
-
##
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|--------|--------|-------|
|
| 59 |
-
| Rent burden | Census ACS 2022 | B25070 |
|
| 60 |
-
| Median rent | Census ACS 2022 | B25064 |
|
| 61 |
-
| Median income | Census ACS 2022 | B19013 |
|
| 62 |
-
| Housing tenure | Census ACS 2022 | B25003 |
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
|
| 67 |
-
- `affordability_category`: Affordable (<30%), Burdened (30-50%), Severely Burdened (>50%)
|
| 68 |
-
- `hours_at_min_wage_for_rent`: Hours at $7.25/hr needed for monthly rent
|
| 69 |
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
## Usage
|
| 77 |
|
| 78 |
```python
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
df =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
```
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
## License
|
| 85 |
|
| 86 |
-
CC-BY-4.0
|
| 87 |
|
| 88 |
## Author
|
| 89 |
|
| 90 |
-
Luke Steuber | luke@lukesteuber.com
|
|
|
|
| 6 |
language:
|
| 7 |
- en
|
| 8 |
tags:
|
| 9 |
+
- veterans
|
| 10 |
+
- military
|
| 11 |
+
- firearms
|
| 12 |
+
- suicide
|
| 13 |
+
- ptsd
|
| 14 |
+
- mental-health
|
| 15 |
+
- va-healthcare
|
| 16 |
+
- us-states
|
| 17 |
- demographics
|
| 18 |
+
- public-health
|
| 19 |
+
pretty_name: US Military & Veteran Analysis by State
|
|
|
|
|
|
|
| 20 |
size_categories:
|
| 21 |
+
- n<1K
|
|
|
|
| 22 |
dataset_info:
|
| 23 |
features:
|
| 24 |
+
- name: NAME
|
|
|
|
|
|
|
| 25 |
dtype: string
|
| 26 |
- name: state
|
| 27 |
dtype: string
|
| 28 |
+
- name: veteran_population
|
| 29 |
+
dtype: int64
|
| 30 |
+
- name: veteran_percentage
|
| 31 |
+
dtype: float64
|
| 32 |
+
- name: active_duty_personnel
|
| 33 |
dtype: int64
|
| 34 |
+
- name: ownership_percentage
|
| 35 |
+
dtype: float64
|
| 36 |
+
- name: ffl_count
|
| 37 |
dtype: int64
|
| 38 |
+
- name: veteran_suicide_rate
|
| 39 |
dtype: float64
|
| 40 |
+
- name: civilian_suicide_rate
|
| 41 |
dtype: float64
|
| 42 |
+
- name: veteran_risk_ratio
|
| 43 |
dtype: float64
|
| 44 |
+
- name: ptsd_prevalence_pct
|
| 45 |
+
dtype: float64
|
| 46 |
+
- name: va_utilization_pct
|
| 47 |
dtype: float64
|
| 48 |
splits:
|
| 49 |
- name: train
|
| 50 |
+
num_examples: 51
|
| 51 |
---
|
| 52 |
|
| 53 |
+
# US Military & Veteran Analysis by State
|
| 54 |
|
| 55 |
+
State-level integration of veteran demographics, firearm ownership, mental health indicators, and VA healthcare utilization from 6 authoritative sources.
|
| 56 |
|
| 57 |
+
## What's Inside
|
| 58 |
|
| 59 |
+
- 51 records (50 states + DC)
|
| 60 |
+
- Veteran population and percentage
|
| 61 |
+
- Firearm ownership rates (RAND 2016)
|
| 62 |
+
- Suicide rates: veteran vs civilian
|
| 63 |
+
- PTSD prevalence estimates
|
| 64 |
+
- VA healthcare utilization
|
| 65 |
|
| 66 |
+
## Why This Dataset Exists
|
| 67 |
|
| 68 |
+
No single source provides this combined view. This integration allows correlation analysis across:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
+
- Veteran demographics and military presence
|
| 71 |
+
- Mental health indicators (suicide, PTSD)
|
| 72 |
+
- Firearm access and ownership
|
| 73 |
+
- Healthcare system utilization
|
| 74 |
|
| 75 |
+
## Data Sources
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
| Data | Source | Year |
|
| 78 |
+
|------|--------|------|
|
| 79 |
+
| Veteran population | Census ACS | 2022 |
|
| 80 |
+
| Firearm ownership | RAND Corporation | 2016 |
|
| 81 |
+
| FFL counts | ATF | 2023 |
|
| 82 |
+
| Suicide rates | CDC WONDER | 2021 |
|
| 83 |
+
| PTSD, VA utilization | VA | 2022 |
|
| 84 |
+
| Active duty, economic impact | DoD DMDC | 2023 |
|
| 85 |
|
| 86 |
+
## Key Metrics
|
| 87 |
+
|
| 88 |
+
| Field | Description |
|
| 89 |
+
|-------|-------------|
|
| 90 |
+
| veteran_risk_ratio | Veteran suicide rate / civilian rate |
|
| 91 |
+
| ptsd_prevalence_pct | PTSD prevalence among veterans |
|
| 92 |
+
| va_utilization_pct | % of veterans using VA healthcare |
|
| 93 |
+
| ffl_per_100k | Federal Firearms Licensees per 100K population |
|
| 94 |
|
| 95 |
## Usage
|
| 96 |
|
| 97 |
```python
|
| 98 |
+
import pandas as pd
|
| 99 |
+
|
| 100 |
+
df = pd.read_csv('military_firearm_merged_analysis.csv')
|
| 101 |
+
print(f"States: {len(df)}")
|
| 102 |
+
|
| 103 |
+
# States with highest veteran risk ratio
|
| 104 |
+
high_risk = df.nlargest(10, 'veteran_risk_ratio')[['NAME', 'veteran_risk_ratio']]
|
| 105 |
+
print(high_risk)
|
| 106 |
+
|
| 107 |
+
# Correlation between firearm ownership and veteran suicide
|
| 108 |
+
correlation = df['ownership_percentage'].corr(df['veteran_suicide_rate'])
|
| 109 |
+
print(f"Firearm-suicide correlation: {correlation:.3f}")
|
| 110 |
```
|
| 111 |
|
| 112 |
+
## Limitations
|
| 113 |
+
|
| 114 |
+
- RAND firearm data is from 2016 (most recent publicly available)
|
| 115 |
+
- CDC suppresses data for states with <10 deaths
|
| 116 |
+
- VA data covers enrolled veterans only
|
| 117 |
+
|
| 118 |
## License
|
| 119 |
|
| 120 |
+
CC-BY-4.0 (All source data is public domain; integration by Luke Steuber)
|
| 121 |
|
| 122 |
## Author
|
| 123 |
|
| 124 |
+
Luke Steuber | luke@lukesteuber.com | @lukesteuber.com (Bluesky)
|
dataset-metadata.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
| 1 |
{
|
| 2 |
"title": "US Military & Veteran Analysis by State",
|
| 3 |
"id": "lucassteuber/us-military-veteran-analysis",
|
| 4 |
-
"licenses": [
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
],
|
| 9 |
-
"subtitle": "50 states: veterans, firearms, PTSD, suicide, VA healthcare integrated",
|
| 10 |
-
"description": "# US Military & Veteran Analysis by State\n\nState-level integration of veteran demographics, firearm ownership, mental health indicators, and VA healthcare utilization from **6 independent government and research sources**.\n\n## What Makes This Dataset Unique\n\nNo single source provides this combined view. This dataset integrates:\n\n1. **Census ACS** - Veteran population, total population\n2. **RAND Corporation** - State firearm ownership rates (2016)\n3. **ATF** - Federal Firearms Licensee (FFL) counts\n4. **CDC** - Veteran and civilian suicide rates, risk ratios\n5. **VA** - PTSD prevalence, healthcare utilization\n6. **DoD** - Active duty personnel, military installation economic impact\n\n## Data Sources\n\n| Source | Organization | Access |\n|--------|--------------|--------|\n| American Community Survey | U.S. Census Bureau | api.census.gov |\n| Firearm Ownership Estimates | RAND Corporation | rand.org |\n| Federal Firearms Licensees | ATF | atf.gov |\n| Underlying Cause of Death | CDC WONDER | wonder.cdc.gov |\n| Veterans Health Administration | U.S. Dept of Veterans Affairs | va.gov |\n| Defense Manpower Data | DoD DMDC | dmdc.osd.mil |\n\n## Fields\n\n- `NAME`: State name\n- `state`: State FIPS code\n- `veteran_population`: Total veteran population\n- `veteran_percentage`: Veterans as % of total population\n- `active_duty_personnel`: Active duty military personnel\n- `ownership_percentage`: Household firearm ownership rate (RAND 2016)\n- `ffl_count`: Federal Firearms Licensees in state\n- `ffl_per_100k`: FFLs per 100,000 population\n- `veteran_suicide_rate`: Veteran suicide rate per 100,000\n- `civilian_suicide_rate`: Civilian suicide rate per 100,000\n- `veteran_risk_ratio`: Veteran/civilian suicide risk ratio\n- `ptsd_prevalence_pct`: PTSD prevalence among veterans\n- `va_utilization_pct`: Percent of veterans using VA healthcare\n- `annual_economic_impact_millions`: Military installation economic impact\n\n## Records\n\n54 (50 states + DC + territories)\n\n## Limitations\n\n- RAND firearm data is from 2016 (most recent available)\n- CDC suppresses counties with <10 deaths\n- VA data covers enrolled veterans only\n\n## License\n\nCC-BY-4.0 (All source data is public domain; integration by Luke Steuber)",
|
| 11 |
"keywords": [
|
| 12 |
"veterans",
|
| 13 |
"military",
|
|
@@ -19,6 +16,5 @@
|
|
| 19 |
"us-states",
|
| 20 |
"demographics",
|
| 21 |
"public-health"
|
| 22 |
-
]
|
| 23 |
-
"isPrivate": true
|
| 24 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"title": "US Military & Veteran Analysis by State",
|
| 3 |
"id": "lucassteuber/us-military-veteran-analysis",
|
| 4 |
+
"licenses": [{"name": "CC-BY-4.0"}],
|
| 5 |
+
"subtitle": "50 states: veterans, firearms, PTSD, suicide rates, VA healthcare",
|
| 6 |
+
"description": "State-level integration of veteran demographics, firearm ownership, mental health indicators, and VA healthcare utilization from Census ACS, RAND, ATF, CDC, VA, and DoD.",
|
| 7 |
+
"isPrivate": false,
|
|
|
|
|
|
|
|
|
|
| 8 |
"keywords": [
|
| 9 |
"veterans",
|
| 10 |
"military",
|
|
|
|
| 16 |
"us-states",
|
| 17 |
"demographics",
|
| 18 |
"public-health"
|
| 19 |
+
]
|
|
|
|
| 20 |
}
|
demo_notebook.ipynb
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# US Military & Veteran Analysis - Interactive Demo\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"Explore **state-level data** on veteran demographics, firearm ownership, mental health indicators, and VA healthcare.\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"**Dataset Highlights:**\n",
|
| 12 |
+
"- 6 authoritative sources integrated\n",
|
| 13 |
+
"- Veteran vs civilian suicide rates\n",
|
| 14 |
+
"- PTSD prevalence estimates\n",
|
| 15 |
+
"- VA healthcare utilization"
|
| 16 |
+
]
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"cell_type": "code",
|
| 20 |
+
"execution_count": null,
|
| 21 |
+
"metadata": {},
|
| 22 |
+
"outputs": [],
|
| 23 |
+
"source": [
|
| 24 |
+
"import pandas as pd\n",
|
| 25 |
+
"import numpy as np\n",
|
| 26 |
+
"import matplotlib.pyplot as plt\n",
|
| 27 |
+
"import seaborn as sns\n",
|
| 28 |
+
"import warnings\n",
|
| 29 |
+
"warnings.filterwarnings('ignore')\n",
|
| 30 |
+
"\n",
|
| 31 |
+
"plt.style.use('seaborn-v0_8-darkgrid')\n",
|
| 32 |
+
"sns.set_palette('husl')\n",
|
| 33 |
+
"\n",
|
| 34 |
+
"print('Libraries loaded')"
|
| 35 |
+
]
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"cell_type": "markdown",
|
| 39 |
+
"metadata": {},
|
| 40 |
+
"source": [
|
| 41 |
+
"## 1. Load Dataset"
|
| 42 |
+
]
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"cell_type": "code",
|
| 46 |
+
"execution_count": null,
|
| 47 |
+
"metadata": {},
|
| 48 |
+
"outputs": [],
|
| 49 |
+
"source": [
|
| 50 |
+
"df = pd.read_csv('military_firearm_merged_analysis.csv')\n",
|
| 51 |
+
"print(f'Total states: {len(df)}')\n",
|
| 52 |
+
"df.head()"
|
| 53 |
+
]
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"cell_type": "markdown",
|
| 57 |
+
"metadata": {},
|
| 58 |
+
"source": [
|
| 59 |
+
"## 2. Dataset Overview"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"cell_type": "code",
|
| 64 |
+
"execution_count": null,
|
| 65 |
+
"metadata": {},
|
| 66 |
+
"outputs": [],
|
| 67 |
+
"source": [
|
| 68 |
+
"print('Dataset Statistics:')\n",
|
| 69 |
+
"print('=' * 60)\n",
|
| 70 |
+
"print(f\"States: {len(df)}\")\n",
|
| 71 |
+
"print(f\"\\nVeteran Statistics:\")\n",
|
| 72 |
+
"print(f\" Total veteran population: {df['veteran_population'].sum():,.0f}\")\n",
|
| 73 |
+
"print(f\" Avg veteran %: {df['veteran_percentage'].mean():.1f}%\")\n",
|
| 74 |
+
"print(f\"\\nMental Health:\")\n",
|
| 75 |
+
"print(f\" Avg veteran suicide rate: {df['veteran_suicide_rate'].mean():.1f} per 100K\")\n",
|
| 76 |
+
"print(f\" Avg civilian suicide rate: {df['civilian_suicide_rate'].mean():.1f} per 100K\")\n",
|
| 77 |
+
"print(f\" Avg veteran risk ratio: {df['veteran_risk_ratio'].mean():.2f}x\")"
|
| 78 |
+
]
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"cell_type": "markdown",
|
| 82 |
+
"metadata": {},
|
| 83 |
+
"source": [
|
| 84 |
+
"## 3. Veteran Risk Analysis"
|
| 85 |
+
]
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
"cell_type": "code",
|
| 89 |
+
"execution_count": null,
|
| 90 |
+
"metadata": {},
|
| 91 |
+
"outputs": [],
|
| 92 |
+
"source": [
|
| 93 |
+
"# Top 10 states by veteran risk ratio\n",
|
| 94 |
+
"high_risk = df.nlargest(10, 'veteran_risk_ratio')[['NAME', 'veteran_risk_ratio', 'veteran_suicide_rate', 'civilian_suicide_rate']]\n",
|
| 95 |
+
"print('States with Highest Veteran Risk Ratio:')\n",
|
| 96 |
+
"print(high_risk.to_string(index=False))"
|
| 97 |
+
]
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"cell_type": "code",
|
| 101 |
+
"execution_count": null,
|
| 102 |
+
"metadata": {},
|
| 103 |
+
"outputs": [],
|
| 104 |
+
"source": [
|
| 105 |
+
"# Compare veteran vs civilian suicide rates\n",
|
| 106 |
+
"fig, ax = plt.subplots(figsize=(12, 8))\n",
|
| 107 |
+
"\n",
|
| 108 |
+
"sorted_df = df.sort_values('veteran_suicide_rate', ascending=True).tail(20)\n",
|
| 109 |
+
"y_pos = range(len(sorted_df))\n",
|
| 110 |
+
"\n",
|
| 111 |
+
"ax.barh(y_pos, sorted_df['veteran_suicide_rate'], height=0.4, label='Veteran', color='steelblue', alpha=0.8)\n",
|
| 112 |
+
"ax.barh([y + 0.4 for y in y_pos], sorted_df['civilian_suicide_rate'], height=0.4, label='Civilian', color='coral', alpha=0.8)\n",
|
| 113 |
+
"\n",
|
| 114 |
+
"ax.set_yticks([y + 0.2 for y in y_pos])\n",
|
| 115 |
+
"ax.set_yticklabels(sorted_df['NAME'])\n",
|
| 116 |
+
"ax.set_xlabel('Suicide Rate per 100,000', fontsize=12)\n",
|
| 117 |
+
"ax.set_title('Veteran vs Civilian Suicide Rates by State', fontsize=14, fontweight='bold')\n",
|
| 118 |
+
"ax.legend()\n",
|
| 119 |
+
"\n",
|
| 120 |
+
"plt.tight_layout()\n",
|
| 121 |
+
"plt.show()"
|
| 122 |
+
]
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"cell_type": "markdown",
|
| 126 |
+
"metadata": {},
|
| 127 |
+
"source": [
|
| 128 |
+
"## 4. Firearm Ownership Analysis"
|
| 129 |
+
]
|
| 130 |
+
},
|
| 131 |
+
{
|
| 132 |
+
"cell_type": "code",
|
| 133 |
+
"execution_count": null,
|
| 134 |
+
"metadata": {},
|
| 135 |
+
"outputs": [],
|
| 136 |
+
"source": [
|
| 137 |
+
"print('Firearm Ownership Statistics:')\n",
|
| 138 |
+
"print('=' * 50)\n",
|
| 139 |
+
"print(f\"Mean ownership rate: {df['ownership_percentage'].mean():.1f}%\")\n",
|
| 140 |
+
"print(f\"Highest: {df.loc[df['ownership_percentage'].idxmax(), 'NAME']} ({df['ownership_percentage'].max():.1f}%)\")\n",
|
| 141 |
+
"print(f\"Lowest: {df.loc[df['ownership_percentage'].idxmin(), 'NAME']} ({df['ownership_percentage'].min():.1f}%)\")"
|
| 142 |
+
]
|
| 143 |
+
},
|
| 144 |
+
{
|
| 145 |
+
"cell_type": "code",
|
| 146 |
+
"execution_count": null,
|
| 147 |
+
"metadata": {},
|
| 148 |
+
"outputs": [],
|
| 149 |
+
"source": [
|
| 150 |
+
"# Correlation between firearm ownership and veteran suicide\n",
|
| 151 |
+
"fig, ax = plt.subplots(figsize=(10, 8))\n",
|
| 152 |
+
"\n",
|
| 153 |
+
"ax.scatter(df['ownership_percentage'], df['veteran_suicide_rate'], alpha=0.7, s=100)\n",
|
| 154 |
+
"\n",
|
| 155 |
+
"# Add correlation line\n",
|
| 156 |
+
"z = np.polyfit(df['ownership_percentage'], df['veteran_suicide_rate'], 1)\n",
|
| 157 |
+
"p = np.poly1d(z)\n",
|
| 158 |
+
"ax.plot(df['ownership_percentage'].sort_values(), p(df['ownership_percentage'].sort_values()), \n",
|
| 159 |
+
" 'r--', alpha=0.8, label=f'r = {df[\"ownership_percentage\"].corr(df[\"veteran_suicide_rate\"]):.3f}')\n",
|
| 160 |
+
"\n",
|
| 161 |
+
"ax.set_xlabel('Firearm Ownership Rate (%)', fontsize=12)\n",
|
| 162 |
+
"ax.set_ylabel('Veteran Suicide Rate (per 100K)', fontsize=12)\n",
|
| 163 |
+
"ax.set_title('Firearm Ownership vs Veteran Suicide Rate', fontsize=14, fontweight='bold')\n",
|
| 164 |
+
"ax.legend()\n",
|
| 165 |
+
"\n",
|
| 166 |
+
"plt.tight_layout()\n",
|
| 167 |
+
"plt.show()"
|
| 168 |
+
]
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"cell_type": "markdown",
|
| 172 |
+
"metadata": {},
|
| 173 |
+
"source": [
|
| 174 |
+
"## 5. VA Healthcare Utilization"
|
| 175 |
+
]
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"cell_type": "code",
|
| 179 |
+
"execution_count": null,
|
| 180 |
+
"metadata": {},
|
| 181 |
+
"outputs": [],
|
| 182 |
+
"source": [
|
| 183 |
+
"print('VA Healthcare Utilization:')\n",
|
| 184 |
+
"print('=' * 50)\n",
|
| 185 |
+
"print(f\"Mean utilization: {df['va_utilization_pct'].mean():.1f}%\")\n",
|
| 186 |
+
"print(f\"\\nTop 5 States (highest VA use):\")\n",
|
| 187 |
+
"top_va = df.nlargest(5, 'va_utilization_pct')[['NAME', 'va_utilization_pct', 'veteran_population']]\n",
|
| 188 |
+
"print(top_va.to_string(index=False))"
|
| 189 |
+
]
|
| 190 |
+
},
|
| 191 |
+
{
|
| 192 |
+
"cell_type": "code",
|
| 193 |
+
"execution_count": null,
|
| 194 |
+
"metadata": {},
|
| 195 |
+
"outputs": [],
|
| 196 |
+
"source": [
|
| 197 |
+
"# PTSD prevalence by state\n",
|
| 198 |
+
"if 'ptsd_prevalence_pct' in df.columns:\n",
|
| 199 |
+
" fig, ax = plt.subplots(figsize=(14, 6))\n",
|
| 200 |
+
" sorted_ptsd = df.sort_values('ptsd_prevalence_pct')\n",
|
| 201 |
+
" ax.barh(sorted_ptsd['NAME'], sorted_ptsd['ptsd_prevalence_pct'], color='teal')\n",
|
| 202 |
+
" ax.set_xlabel('PTSD Prevalence (%)', fontsize=12)\n",
|
| 203 |
+
" ax.set_title('PTSD Prevalence Among Veterans by State', fontsize=14, fontweight='bold')\n",
|
| 204 |
+
" plt.tight_layout()\n",
|
| 205 |
+
" plt.show()"
|
| 206 |
+
]
|
| 207 |
+
},
|
| 208 |
+
{
|
| 209 |
+
"cell_type": "markdown",
|
| 210 |
+
"metadata": {},
|
| 211 |
+
"source": [
|
| 212 |
+
"## 6. Correlation Analysis"
|
| 213 |
+
]
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"cell_type": "code",
|
| 217 |
+
"execution_count": null,
|
| 218 |
+
"metadata": {},
|
| 219 |
+
"outputs": [],
|
| 220 |
+
"source": [
|
| 221 |
+
"# Key correlations\n",
|
| 222 |
+
"metrics = ['veteran_suicide_rate', 'ownership_percentage', 'ptsd_prevalence_pct', 'va_utilization_pct', 'veteran_percentage']\n",
|
| 223 |
+
"corr_matrix = df[metrics].corr()\n",
|
| 224 |
+
"\n",
|
| 225 |
+
"fig, ax = plt.subplots(figsize=(10, 8))\n",
|
| 226 |
+
"sns.heatmap(corr_matrix, annot=True, cmap='RdBu_r', center=0, ax=ax, fmt='.2f')\n",
|
| 227 |
+
"ax.set_title('Correlation Matrix', fontsize=14, fontweight='bold')\n",
|
| 228 |
+
"plt.tight_layout()\n",
|
| 229 |
+
"plt.show()"
|
| 230 |
+
]
|
| 231 |
+
},
|
| 232 |
+
{
|
| 233 |
+
"cell_type": "markdown",
|
| 234 |
+
"metadata": {},
|
| 235 |
+
"source": [
|
| 236 |
+
"## Conclusion\n",
|
| 237 |
+
"\n",
|
| 238 |
+
"This notebook demonstrated:\n",
|
| 239 |
+
"- Loading and exploring veteran analysis data\n",
|
| 240 |
+
"- Comparing veteran vs civilian suicide rates\n",
|
| 241 |
+
"- Analyzing firearm ownership correlations\n",
|
| 242 |
+
"- VA healthcare utilization patterns\n",
|
| 243 |
+
"\n",
|
| 244 |
+
"**Important Note**: RAND firearm data is from 2016 (most recent publicly available). Use findings as exploratory, not causal.\n",
|
| 245 |
+
"\n",
|
| 246 |
+
"**Author**: Luke Steuber | luke@lukesteuber.com | @lukesteuber.com (Bluesky)"
|
| 247 |
+
]
|
| 248 |
+
}
|
| 249 |
+
],
|
| 250 |
+
"metadata": {
|
| 251 |
+
"kernelspec": {
|
| 252 |
+
"display_name": "Python 3",
|
| 253 |
+
"language": "python",
|
| 254 |
+
"name": "python3"
|
| 255 |
+
},
|
| 256 |
+
"language_info": {
|
| 257 |
+
"name": "python",
|
| 258 |
+
"version": "3.10.0"
|
| 259 |
+
}
|
| 260 |
+
},
|
| 261 |
+
"nbformat": 4,
|
| 262 |
+
"nbformat_minor": 4
|
| 263 |
+
}
|