text_html_output_1.png
import pandas as pd

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()

model2 = sm.GLM(y, x, family=sm.families.Gaussian()).fit()
print('Null deviance: {:.1f}'.format(model2.null_deviance))
print('Residual deviance: {:.1f}'.format(model2.deviance))