#researchvibes
Explore tagged Tumblr posts
Text
🧠 Chi-Square Realness: Alcohol vs. Marital Status 🍷💔💍
Using data from the NESARC survey, we dug into how your relationship status might influence how much you drink. The stats? Unfiltered and telling.
📊 Key Insight:
There’s a significant association between marital status and alcohol consumption (Chi² = 392.18, p < .001).
Married individuals top the charts across all drinking levels.
Divorced/Separated drink moderately — but steadily.
Never Married lean toward lighter drinking, but mid-range isn't rare.
Widowed appear quietly in higher consumption brackets. (Coping, perhaps?)
⚖️ Pairwise Comparisons:
We broke it down further with post-hoc testing:
Married vs Never Married → Big difference (p < .001)
Married vs Divorced/Cohabiting → Still distinct (p < .01)
Never Married vs Separated → Subtle, yet significant (p ≈ .015)
Your marital status might be quietly shaping your drinking habits — whether you're toasting to love, numbing the breakup, or just navigating life solo. In case you want to try the code yourself ````````````````````````
import pandas as pd import numpy as np import scipy.stats as stats import seaborn as sns import matplotlib.pyplot as plt
Load the dataset
data = pd.read_csv('nesarc.csv', low_memory=False)
Convert variables to numeric
data['S2AQ8A'] = pd.to_numeric(data['S2AQ8A'], errors='coerce') # Alcohol frequency data['MARITAL'] = pd.to_numeric(data['MARITAL'], errors='coerce') # Marital status
Subset data (assuming sub1 already exists — else, create one)
sub1 = data.copy() sub2 = sub1.copy()
Replace invalid or missing codes with NaN
sub2['S2AQ8A'].replace([99, np.nan], np.nan, inplace=True) sub2['MARITAL'].replace(9, np.nan, inplace=True)
Filter only valid values
sub2 = sub2[(sub2['S2AQ8A'].between(1, 10)) & (sub2['MARITAL'].between(1, 6))]
Create a label-friendly MARITALSTATUS column (you can use actual labels instead of scores)
marital_map = { 1: 'Married', 2: 'Cohabiting', 3: 'Widowed', 4: 'Divorced', 5: 'Separated', 6: 'Never Married' } sub2['MARITALSTATUS'] = sub2['MARITAL'].map(marital_map)
-------------------------
🔍 Main Chi-Square Test
-------------------------
ct_main = pd.crosstab(sub2['S2AQ8A'], sub2['MARITALSTATUS']) print("Main Contingency Table:\n", ct_main)
print("\nColumn Percentages:\n", ct_main / ct_main.sum(axis=0))
chi2, p, dof, expected = stats.chi2_contingency(ct_main) print("\nChi-square test results:") print(f"Chi2 Value: {chi2:.2f}") print(f"p-value: {p:.4f}") print(f"Degrees of Freedom: {dof}") print("Expected Counts:\n", pd.DataFrame(expected, index=ct_main.index, columns=ct_main.columns))
-------------------------
📊 Visualization
-------------------------
plt.figure(figsize=(12, 6)) sns.countplot(data=sub2, x='MARITALSTATUS', hue='S2AQ8A', palette='Set2') plt.title("Drinking Frequency by Marital Status") plt.xlabel("Marital Status") plt.ylabel("Count of Respondents") plt.legend(title="Drinking Frequency Code", bbox_to_anchor=(1.05, 1), loc='upper left') plt.tight_layout() plt.show()
-------------------------
🔁 Optional: Pairwise Comparisons
-------------------------
def chi_square_pairwise(df, group_col, compare_col, groups): sub_df = df[df[group_col].isin(groups)] ct = pd.crosstab(sub_df[compare_col], sub_df[group_col]) chi2, p, dof, expected = stats.chi2_contingency(ct) print(f"\nChi-square for {groups[0]} vs {groups[1]}") print(f"Chi2: {chi2:.2f}, p-value: {p:.4f}, DOF: {dof}") print("Contingency Table:\n", ct)
Run pairwise tests
pairwise_groups = ('Married', 'Never Married'), ('Married', 'Divorced'), ('Married', 'Cohabiting'), ('Never Married', 'Separated')
for g1, g2 in pairwise_groups: chi_square_pairwise(sub2, 'MARITALSTATUS', 'S2AQ8A', [g1, g2])
````````````````````````
#DataScience #MentalHealth #NESARC #Sociology #ChiSquare #AlcoholUse #Relationships #ResearchVibes
0 notes
Photo

I glanced down at my research this morning and knew that #MaryLyon was watching over me. 💙 💙 💙 #mtholyoke #mtholyokecollege #mountholyoke #mountholyokecollege #mountholyokealumnae #mtholyokeforevershallbe #research #researchvibes #hudson #madewithover #mhc #mhc1997 #1837 https://www.instagram.com/p/BtkBB88lAQX/?utm_source=ig_tumblr_share&igshid=1dqlmvqxmyp7j
#marylyon#mtholyoke#mtholyokecollege#mountholyoke#mountholyokecollege#mountholyokealumnae#mtholyokeforevershallbe#research#researchvibes#hudson#madewithover#mhc#mhc1997#1837
0 notes
Photo

Doing some research... #ResearchVibing✊🏾✊🏾✊🏾
0 notes