image_output_1.png
from statsmodels.graphics.gofplots import ProbPlot

import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

import statsmodels.api as sm

df = pd.read_csv('../input/ehresp_2014.csv', usecols=['erbmi', 'euexfreq', 'euwgt', 'euhgt', 'ertpreat'])

df = df[df['erbmi'] > 0]

x = df[['euexfreq', 'euwgt', 'euhgt', 'ertpreat']]
y = df['erbmi']
x = sm.add_constant(x)
model = sm.OLS(y, x).fit()

QQ = ProbPlot(model.resid)
fig = QQ.qqplot(alpha=0.5, markersize=5, line='s')
plt.title('QQ plot')