๐ง ๐ Does Being Married Change How Money Relates to Having Kids?
Just ran a moderation analysis using the NESARC dataset to see if marital status changes the relationship between personal income and number of children under 18 in the household.
Hereโs the TL;DR:
๐ก Main finding: Income is (still) barely related to number of kids. BUTโif youโre married, the pattern shifts just a little.
๐ For non-married folks: Higher income is very slightly linked to fewer kids. (Weโre talking fractions of a child per $10,000...)
๐ For married folks: That negative trend basically flattens out. So among married people, income doesnโt really predict number of children at all.
๐ซ Also: Married people, regardless of income, tend to have more kids than non-married folks. No surprise there, but itโs nice to see the data back it up.
๐ Here's the math-y part (if you're into that): We ran a regression model including:
Income (S1Q10A)
Marital status (MARITAL)
And the interaction term (Income ร Married)
๐The interaction was statistically significant (p < .001), but the effect size? Tiny. Model only explained 4.2% of the variance in number of kids. (So yeah, life is more complicated than one variable!)
๐คทโโ๏ธ In short: Marriage nudges the income-kid link around a bit, but money still isnโt a strong predictor of how many kids you haveโmarried or not.
So if youโre thinking: "Do rich people have fewer kids because theyโre rich?" or "Does marriage make income matter more for family size?"
The data kind of shrugs and says: "Not really."
In case you want to try out the code: ----------------------------
import pandas as pd import numpy as np import seaborn as sns import scipy.stats import matplotlib.pyplot as plt import statsmodels.formula.api as smf
Load the data
data = pd.read_csv('nesarc.csv', low_memory=False)
Convert to numeric properly
data['CHLD0_17'] = pd.to_numeric(data['CHLD0_17'], errors='coerce') data['S1Q10A'] = pd.to_numeric(data['S1Q10A'], errors='coerce') data['MARITAL'] = pd.to_numeric(data['MARITAL'], errors='coerce')
Drop rows with NA in either of the two columns
data_clean = data[['S1Q10A', 'CHLD0_17', 'MARITAL']].dropna()
data_clean['Married'] = data_clean['MARITAL'].apply(lambda x: 1 if x == 1 else 0)
Scatterplot
sns.lmplot(x='S1Q10A', y='CHLD0_17', hue='Married', data=data_clean, palette='Set1', height=6, aspect=1.2) plt.xlabel('Total Personal Income (USD)') plt.ylabel('Number of Children Under 18') plt.title('Income vs Number of Children by Marital Status') plt.show()
Fit linear regression with interaction term
model = smf.ols('CHLD0_17 ~ S1Q10A * Married', data=data_clean).fit()
Output regression summary
print(model.summary())
plt.figure(figsize=(8,6)) sns.regplot(data=data_clean[data_clean['Married'] == 1], x='S1Q10A', y='CHLD0_17', label='Married', scatter_kws={'alpha':0.3}) sns.regplot(data=data_clean[data_clean['Married'] == 0], x='S1Q10A', y='CHLD0_17', label='Not Married', scatter_kws={'alpha':0.3}, color='green') plt.xlabel('Total Personal Income (USD)') plt.ylabel('Number of Children Under 18') plt.title('Income vs Number of Children by Marital Status') plt.legend() plt.tight_layout() plt.show()
----------------------------












