# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# #Exercise 3.9

# %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import statsmodels.api as sm
import statsmodels.formula.api as smf

# ##3.9 a

auto = pd.read_csv('data/Auto.csv', na_values=['?'])
subset = auto.dropna()
sns.pairplot(subset[:-1]) # pairplot doesn't like NaN's

# ##3.9 b

auto.corr()

# ##3.9 c

formula = 'mpg ~ ' + '+'.join(auto.columns.difference(['mpg', 'name']))
model = smf.ols(formula, data=auto)
fit = model.fit()
print(fit.summary())



StarcoderdataJupyterScriptsDedupFiltered