# Linear Probability Model
# Module 7 - Linear Probability Model
# Dataset: MODULE7_STUDENT_COMPLETION_SYNTHETIC

# Linear Probability Model
#
# Module 7 notebook lab. This notebook uses an original Ceteris Lab synthetic teaching dataset and does not report real empirical findings.

# Learning goal
# Estimate an LPM and interpret coefficients as probability-point changes.
#
# Dataset: MODULE7_STUDENT_COMPLETION_SYNTHETIC. Variables: completed_module, study_hours, prior_statistics_experience, educator_support.

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

df = pd.read_csv("/data/module-7/module7_student_completion_synthetic.csv")
X = sm.add_constant(df[["study_hours", "prior_statistics_experience", "educator_support", "mobile_user"]])
model = sm.OLS(df["completed_module"], X).fit(cov_type="HC1")
print(model.params.round(3))
print(model.bse.round(3))

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