This page presents an analysis of the relationship between educational attainment and median household income across counties in Alabama. Using recent data, it explores how the percentage of adults with a bachelor’s degree or higher correlates with income levels, supported by visualizations and regression analysis. The findings highlight the economic impact of education at the county level.
Dataset Overview
The dataset consists of information from 66 counties in Alabama and includes:
County: Name of each county
Bachelors_or_Higher: Proportion of population with a bachelor’s degree or higher
Median_Household_Income: Median household income in USD
To understand the relationship between educational attainment and income levels, the Pearson correlation coefficient was calculated:
Correlation coefficient (r): 0.708
P-value: 0.00000
Interpretation:
There is a strong positive linear relationship between the percentage of individuals with a bachelor’s degree and the median household income. The p-value < 0.05 indicates that this relationship is statistically significant.
A scatterplot was created using seaborn.regplot() showing:
X-axis: Percentage with Bachelor’s Degree or Higher
Y-axis: Median Household Income
A regression line with a 95% confidence interval was plotted.
Observation:
The upward-sloping red line confirms a positive relationship: counties with higher education rates tend to have higher incomes.
Using OLS linear regression, we modeled Median_Household_Income based on Bachelors_or_Higher:
Regression Equation
Predicted Income = 27,794 + (90,133 × Bachelor's %)
This means:
A 0% bachelor's degree rate predicts an income of approximately $27,794
For each additional one percentage point increase in bachelor's degree attainment, income increases by about $901.33
Interpretation:
The model explains about 50% of the variation in median household income.
The p-values for both the intercept and slope are < 0.001, indicating high significance.
Count of Counties with Higher Education
There are only eight counties in Alabama where more than 30% of adults have a bachelor’s degree or higher. This suggests that counties with exceptionally high educational levels remain relatively rare.
Average Income by Education Level
I grouped counties by their education level and calculated the average median household income for each group:
Low Education (< 20%): Average income ≈ $41,111
Medium Education (20%–30%): Average income ≈ $49,658
Higher Education (> 30%): Average income ≈ $60,770
This clearly shows that counties with higher education levels tend to have higher incomes.
Top Counties by Income and Education
The top 5 counties with the highest median income and education are Shelby, Madison, Mobile, Limestone, and Baldwin. All of these counties have relatively high percentages of adults with bachelor’s degrees.
Correlation Between Education and Income
The Pearson correlation coefficient between bachelor’s degree percentage and median household income is 0.708, which indicates a strong positive relationship between education and income at the county level.
Distribution of Counties by Education and Income Quartiles
Counties were divided into quartiles based on their education and income levels. This breakdown helps us understand how counties are spread across different levels of education and income.
Counties with Higher Education but Lower Income
Some counties, such as Pike, Macon, Randolph, and Marengo, have higher-than-average education levels but still have median incomes below the state average. This suggests that factors other than education may also affect income in these counties.
This project explores the relationship between educational attainment and median household income across counties in Alabama. Using a combination of Python and PostgreSQL, I analyzed county-level data on the percentage of adults with a bachelor's degree or higher and their corresponding median household incomes.
The goal was to understand how education impacts economic outcomes at a regional level, supported by statistical methods including correlation, regression, and advanced SQL queries.
The dataset includes data for 66 Alabama counties, with the following key variables:
County: Name of the county.
Bachelors_or_Higher: Proportion of the adult population (age 25+) with a bachelor’s degree or higher (expressed as a decimal).
Median_Household_Income: Median household income in US dollars.
Using Python’s scipy.Stats, I calculated the Pearson correlation coefficient to measure the strength of the linear relationship between education and income.
Correlation coefficient (r): 0.708
P-value: 0.00000
Interpretation: This strong positive correlation indicates that counties with a higher percentage of adults holding a bachelor’s degree tend to have higher median household incomes. The p-value below 0.05 confirms this relationship is statistically significant.
A scatterplot visualized the data points for each county, with the percentage of bachelor’s degree holders on the X-axis and median household income on the Y-axis. A red regression line with a 95% confidence interval shows the general upward trend.
This plot illustrates a positive association: counties with higher educational attainment tend to have higher incomes.
Using the statsmodels package, I fitted an Ordinary Least Squares (OLS) regression model:
Regression Equation:
Predicted Median Household Income = 27,794 + 90,133 × (Bachelor’s Degree %)
The intercept indicates the baseline median income for counties with 0% bachelor’s degree holders.
The slope coefficient suggests that a 1% increase in bachelor’s degree attainment predicts approximately a $901 increase in median income.
The model’s R-squared value is 0.501, meaning education explains about 50% of the variation in income across counties.
Both coefficients are statistically significant with p-values less than 0.001.
To deepen the analysis, I imported the dataset into PostgreSQL and ran several SQL queries:
There are eight counties with over 30% of adults holding a bachelor’s degree, showing a limited but significant regional concentration of higher education.
Counties were categorized into three education groups:
Low Education (<20%): Average median income ≈ $41,111
Medium Education (20%-30%): Average median income ≈ $49,658
Higher Education (>30%): Average median income ≈ $60,770
This confirms that higher education levels align with higher incomes.
Shelby, Madison, Mobile, Limestone, and Baldwin counties top the list for both median income and education level.
Using PostgreSQL’s built-in corr() function, the correlation coefficient of about 0.708 matched the Python analysis, reinforcing the strong association.
By dividing counties into quartiles based on education and income, I examined their distribution to understand regional disparities better.
Some counties (e.g., Pike, Macon, Randolph, Marengo) have above-average education rates but below-average incomes, suggesting other factors influence economic outcomes in these areas.
This project reveals a significant and positive relationship between educational attainment and household income across Alabama counties. Both Python and PostgreSQL analyses confirm that counties with higher percentages of college-educated adults tend to have higher median incomes. However, some countries deviate from this pattern, indicating the need for further exploration into other socioeconomic variables.
This analysis provides a data-driven foundation for policymakers and educators to understand the economic value of education and target interventions for counties lagging in income despite educational progress.
United States Department of Agriculture, Economic Research Service. (2025, January 31). County-level data sets: Education. Retrieved from https://data.ers.usda.gov/reports.aspx?ID=4026#P9f20c2868897459bad0ade8eed63d0aa_4_47iT1
Wikipedia contributors. (2025). List of Alabama locations by per capita income. Wikipedia. Retrieved from https://en.wikipedia.org/wiki/List_of_Alabama_locations_by_per_capita_income?utm_source=chatgpt.com