# Group Mean Comparisons
# Module 7 - Comparing Two Means with Regression
# Dataset: MODULE7_WAGE_GROUPS_SYNTHETIC

# Group Mean Comparisons
#
# Module 7 notebook lab. This notebook uses an original Ceteris Lab synthetic teaching dataset and does not report real empirical findings.

# Learning goal
# Show how a dummy-only regression reproduces a two-group mean difference.
#
# Dataset: MODULE7_WAGE_GROUPS_SYNTHETIC. Variables: hourly_wage, female, education, experience.

# %% Cell 3
import pandas as pd
import statsmodels.api as sm

df = pd.read_csv("/data/module-7/module7_wage_groups_synthetic.csv")
print(df.groupby("female")["hourly_wage"].mean().round(2))
model = sm.OLS(df["hourly_wage"], sm.add_constant(df[["female"]])).fit()
print(model.params.round(3))

# Reflection
# Write two sentences: one coefficient, group difference, or predicted-probability interpretation, and one limitation or coding choice that matters.
