# Dummy Variables in Log Models
# Module 7 - Dummy Variables in Log-Dependent Models
# Dataset: MODULE7_WAGE_GROUPS_SYNTHETIC

# Dummy Variables in Log Models
#
# Module 7 notebook lab. This notebook uses an original Ceteris Lab synthetic teaching dataset and does not report real empirical findings.

# Learning goal
# Convert log-dummy coefficients using approximate and exact percentages.
#
# Dataset: MODULE7_WAGE_GROUPS_SYNTHETIC. Variables: log_wage, female, education, experience.

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

df = pd.read_csv("/data/module-7/module7_wage_groups_synthetic.csv")
model = sm.OLS(df["log_wage"], sm.add_constant(df[["female", "education", "experience"]])).fit()
beta = model.params["female"]
print("Approximate percent:", round(100 * beta, 2))
print("Exact percent:", round(100 * (np.exp(beta) - 1), 2))

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