# Chapter 19: Multiple Regression and the Ceteris Paribus Interpretation
# Fundamentals of Python for Financial Econometrics - Multiple Regression and the Ceteris Paribus Interpretation
# Dataset: Ceteris Lab teaching sample

# Chapter 19: Multiple Regression and the Ceteris Paribus Interpretation
# **Economic question:** How can we compare two people while holding other observed characteristics constant?
#
# Multiple regression estimates partial associations conditional on the controls included in the model.

# %% Cell 2
import numpy as np, statsmodels.api as sm
rng=np.random.default_rng(19)
ability=rng.normal(size=300)
educ=.7*ability+rng.normal(size=300)
wage=2+1.2*educ+1.5*ability+rng.normal(size=300)
naive=sm.OLS(wage,sm.add_constant(educ)).fit()
controlled=sm.OLS(wage,sm.add_constant(np.c_[educ,ability])).fit()
print('naive',naive.params[1],'controlled',controlled.params[1])

# Interpretation checklist
# - State the unit of observation and units of every variable.
# - Separate association, prediction, and causation.
# - Report magnitude and uncertainty.
# - Identify the most important threat to validity.
