Created
June 29, 2016 23:04
-
-
Save govert/39967f7de823d4729ae90620a0508c32 to your computer and use it in GitHub Desktop.
Linear regression sample from EFavDB/linear-regression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Interpreting the results of linear regression\n", | |
"Perform linear regression on simulated data to predict the weight of adult women using height and shoe size. The results are discussed in a [blog post](http://efavdb.com/interpret-linear-regression)." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"# import some libraries. We use statsmodels.api.OLS for the linear regression since it contains a much \n", | |
"# more detailed report on the results of the fit than sklearn.linear_model.LinearRegression\n", | |
"\n", | |
"import numpy as np\n", | |
"import statsmodels.api as sm\n", | |
"import random\n", | |
"from scipy.stats import t, f\n", | |
"import matplotlib.pyplot as plt\n", | |
"\n", | |
"%matplotlib inline" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"# set the population parameters for the simulated data\n", | |
"\n", | |
"# height in inches\n", | |
"mean_height = 65\n", | |
"std_height = 2.25\n", | |
"\n", | |
"# shoe size in inches\n", | |
"mean_shoe_size = 7.5\n", | |
"std_shoe_size = 1.25\n", | |
"\n", | |
"# correlation b/w height and shoe size\n", | |
"r_height_shoe = 0.98\n", | |
"# covariance b/w height and shoe size\n", | |
"var_height_shoe = r_height_shoe*std_height*std_shoe_size\n", | |
"\n", | |
"# matrix of means\n", | |
"mu = (mean_height, mean_shoe_size)\n", | |
"# covariance matrix for two-regressor model\n", | |
"cov = [[np.square(std_height), var_height_shoe],\n", | |
" [var_height_shoe, np.square(std_shoe_size)]]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"# Generate the simulated data\n", | |
"\n", | |
"# number of data points\n", | |
"n = 20\n", | |
"random.seed(85)\n", | |
"\n", | |
"# height and shoe size\n", | |
"X1 = np.random.multivariate_normal(mu, cov, n)\n", | |
"# height, alone\n", | |
"X0 = X1[:, 0]\n", | |
"\n", | |
"weight = -220 + np.random.normal(X0*5.5, 10, n)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA38AAAFHCAYAAAARAfVmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X2cZGV95/3PT5nRBjNGsbMmgF2SgAMrA0wAXUXTgwxG\no5hoAhlvEx86umRcw01MTDDJzpDNboiraxLvzEZjB2MW2tFEoxhWAZ02sj6k5cHBAGY2WgOLBsuI\nI8ZeGOB3/1Gnx5qmH6ur6pyq+rxfr35N1anqc34z3fWd6zrnOtcVmYkkSZIkabA9quwCJEmSJEnd\nZ+dPkiRJkoaAnT9JkiRJGgJ2/iRJkiRpCNj5kyRJkqQhYOdPkiRJkoZAVzt/ETEZEfdExN6WbZsi\n4jMR8cWI+HBEPK7ltUsjYl9E3B4R53WzNknDzXyS1G8Wya2fjYgvRcRDEbG5zPokVV+3r/xdATx/\n3rZ3A2/KzFOBDwFvAoiIk4ELgJOAFwC7IiK6XJ+k4WU+Seo3C+XWrcDPAJ/qfTmS+k1XO3+ZeQNw\n77zNJxTbAa4HXlY8Ph94X2Y+mJl1YB9wVjfrkzS8zCdJ/Wah3MrML2fmPsATUpKWVcY9f/8QEecX\njy8Aji0eHwPc1fK+u4ttktQr5pMkSRpYZXT+XgO8PiJmgKOAB0qoQZIWYj5JkqSBdUSvD5iZ/0gx\nXj0iTgB+qnjpbuC4lrceW2x7hIjIbt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3Ae2KB\nmfci4lXAcZl5Wct+ry2GW52emU/PzNfO/z6aDajHLlLbwZbHNr6kwWDbSaWy86e1WGxihVcAE8V9\nKl8Czl/gPb8EvDsibgKOpDnufbljvAu4dZGblv8W2LKC2g5tj4gfojkW/huLvFdSRUXEDwOzmXkV\n8F9pdgSX8mma2UREjAPfLGa4+zjN+1rm9nvaAsd6Cs2hpJPAu+cfKyJ+nOaQztZO4eeAZ0cxJXpx\nb+EJC9R1O/Bji/01l/j72PiS+pNtJ5UqmkN5pd6KiKPmxplHxG8AT87MS9awvycDf5GZz1/F9/y/\nwIHMvKLd40oqR0ScR7PT9zDwAHBRZt4cEV8BzsjMbxWdsv+amedExBNoTpZwPPCvwOsy80sR8Vjg\nD2nebxPAVzPz/HnH+kWaEzAcBO4DfiEz75w7FvBWmsNH5xpDX8jM1xWdzLcAj6HZePrtzPzovH2f\nDfz7uckYIuKTwK9l5k0R8Z3M3FBsfxnwU5n5muL5jcC5mXlvJ/49JVWfbSd1gp0/lSIiLgAupTmM\nqQ68KjP/ZY37/FmakzJ8d4XvfyXwl5n58FqOK0lrERF/B6x42Yji6uQlmfnK7lYmqUpsO6kT7PxJ\nklSi4h6e2cxc0TDOiHgesC8z7+xuZZKkQWPnT5IkSZKGgBO+SJIkSdIQsPMnSZIkSUPAzp8kSZIk\nDQE7f5IkSZI0BOz8SZIkSdIQ+P8B85b17FU08q8AAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<matplotlib.figure.Figure at 0x7fd056b81518>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"# Plot simulated data\n", | |
"plt.rcParams['figure.figsize'] = (15.0, 5.0)\n", | |
"plt.subplot(1,3,1)\n", | |
"# weight v. height\n", | |
"plt.scatter(X1[:,0], weight)\n", | |
"plt.xlabel('height (in)')\n", | |
"plt.ylabel('weight (lb)')\n", | |
"\n", | |
"plt.subplot(1,3,2)\n", | |
"# weight v. shoe size\n", | |
"plt.scatter(X1[:,1], weight)\n", | |
"plt.xlabel('shoe size (in)')\n", | |
"plt.ylabel('weight (lb)')\n", | |
"\n", | |
"plt.subplot(1,3,3)\n", | |
"# height v. shoe size\n", | |
"plt.scatter(X1[:,0], X1[:,1])\n", | |
"plt.xlabel('height (in)')\n", | |
"plt.ylabel('shoe size (in)')\n", | |
"\n", | |
"plt.show()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"# Fit the linear models\n", | |
"# add column of ones for intercept\n", | |
"X0 = sm.add_constant(X0)\n", | |
"X1 = sm.add_constant(X1)\n", | |
"\n", | |
"sm0 = sm.OLS(weight, X0).fit()\n", | |
"sm1 = sm.OLS(weight, X1).fit()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"linear model: weight ~ height\n", | |
"\n", | |
" OLS Regression Results \n", | |
"==============================================================================\n", | |
"Dep. Variable: y R-squared: 0.788\n", | |
"Model: OLS Adj. R-squared: 0.776\n", | |
"Method: Least Squares F-statistic: 66.87\n", | |
"Date: Wed, 29 Jun 2016 Prob (F-statistic): 1.79e-07\n", | |
"Time: 14:28:08 Log-Likelihood: -70.020\n", | |
"No. Observations: 20 AIC: 144.0\n", | |
"Df Residuals: 18 BIC: 146.0\n", | |
"Df Model: 1 \n", | |
"Covariance Type: nonrobust \n", | |
"==============================================================================\n", | |
" coef std err t P>|t| [95.0% Conf. Int.]\n", | |
"------------------------------------------------------------------------------\n", | |
"const -265.2764 49.801 -5.327 0.000 -369.905 -160.648\n", | |
"x1 6.1857 0.756 8.178 0.000 4.596 7.775\n", | |
"==============================================================================\n", | |
"Omnibus: 0.006 Durbin-Watson: 2.351\n", | |
"Prob(Omnibus): 0.997 Jarque-Bera (JB): 0.126\n", | |
"Skew: 0.002 Prob(JB): 0.939\n", | |
"Kurtosis: 2.610 Cond. No. 1.73e+03\n", | |
"==============================================================================\n", | |
"\n", | |
"Warnings:\n", | |
"[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n", | |
"[2] The condition number is large, 1.73e+03. This might indicate that there are\n", | |
"strong multicollinearity or other numerical problems. \n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"# print summaries of fit\n", | |
"print('linear model: weight ~ height\\n')\n", | |
"print(sm0.summary(), '\\n')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"linear model: weight ~ height + shoe_size\n", | |
"\n", | |
" OLS Regression Results \n", | |
"==============================================================================\n", | |
"Dep. Variable: y R-squared: 0.789\n", | |
"Model: OLS Adj. R-squared: 0.765\n", | |
"Method: Least Squares F-statistic: 31.86\n", | |
"Date: Wed, 29 Jun 2016 Prob (F-statistic): 1.78e-06\n", | |
"Time: 14:28:08 Log-Likelihood: -69.951\n", | |
"No. Observations: 20 AIC: 145.9\n", | |
"Df Residuals: 17 BIC: 148.9\n", | |
"Df Model: 2 \n", | |
"Covariance Type: nonrobust \n", | |
"==============================================================================\n", | |
" coef std err t P>|t| [95.0% Conf. Int.]\n", | |
"------------------------------------------------------------------------------\n", | |
"const -333.1599 204.601 -1.628 0.122 -764.829 98.510\n", | |
"x1 7.4944 3.898 1.923 0.071 -0.729 15.718\n", | |
"x2 -2.3090 6.739 -0.343 0.736 -16.527 11.909\n", | |
"==============================================================================\n", | |
"Omnibus: 0.015 Durbin-Watson: 2.342\n", | |
"Prob(Omnibus): 0.993 Jarque-Bera (JB): 0.147\n", | |
"Skew: 0.049 Prob(JB): 0.929\n", | |
"Kurtosis: 2.592 Cond. No. 7.00e+03\n", | |
"==============================================================================\n", | |
"\n", | |
"Warnings:\n", | |
"[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n", | |
"[2] The condition number is large, 7e+03. This might indicate that there are\n", | |
"strong multicollinearity or other numerical problems. \n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"print('linear model: weight ~ height + shoe_size\\n')\n", | |
"print(sm1.summary(), '\\n')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"beta_hat: [-333.15990097 7.49444671 -2.30898743] \n", | |
"\n", | |
"degrees of freedom of residuals: 17 \n", | |
"\n", | |
"sigma_hat: 8.66991550428 \n", | |
"\n", | |
"standard error of beta_hat: [ 204.60056111 3.89776076 6.73900599] \n", | |
"\n", | |
"confidence intervals:\n", | |
" [[ -7.64829352e+02 9.85095501e+01]\n", | |
" [ -7.29109662e-01 1.57180031e+01]\n", | |
" [ -1.65270473e+01 1.19090724e+01]] \n", | |
"\n", | |
"t-statistics: [-1.62834305 1.92275698 -0.34263027] \n", | |
"\n", | |
"p-values of t-statistics: [ 0.1218417 0.07142839 0.73607656]\n", | |
"f-statistic: 31.8556171105 \n", | |
"\n", | |
"p-value of f-statistic: 1.77777555162e-06 \n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"# Calculate values manually for the two-regressor model: weight ~ height + shoe_size\n", | |
"# OLS solution, eqn of form ax=b => (X'X)*beta_hat = X'*y\n", | |
"beta_hat = np.linalg.solve(np.dot(X1.T, X1), np.dot(X1.T, weight))\n", | |
"print('beta_hat:', beta_hat, '\\n')\n", | |
"\n", | |
"# residuals\n", | |
"epsilon = weight - np.dot(X1, beta_hat)\n", | |
"\n", | |
"# degrees of freedom of residuals\n", | |
"dof = X1.shape[0] - X1.shape[1]\n", | |
"print('degrees of freedom of residuals:', dof, '\\n')\n", | |
"\n", | |
"# best estimator of sigma\n", | |
"sigma_hat = np.sqrt(np.dot(epsilon, epsilon) / dof)\n", | |
"print('sigma_hat:', sigma_hat, '\\n')\n", | |
"\n", | |
"# standard error of beta_hat\n", | |
"s = sigma_hat * np.sqrt(np.diag(np.linalg.inv(np.dot(X1.T, X1)), 0))\n", | |
"print('standard error of beta_hat:', s, '\\n')\n", | |
"\n", | |
"# 95% confidence intervals\n", | |
"# +/-t_{1-alpha/2, n-K} = t.interval(1-alpha, dof)\n", | |
"conf_intervals = beta_hat.reshape(3,1) + s.reshape(3,1) * np.array(t.interval(0.95, dof))\n", | |
"print('confidence intervals:\\n', conf_intervals, '\\n')\n", | |
"\n", | |
"# t-statistics under null hypothesis\n", | |
"t_stat = beta_hat / s\n", | |
"print('t-statistics:', t_stat, '\\n')\n", | |
"\n", | |
"# p-values\n", | |
"# survival function sf=1-CDF\n", | |
"p_values = t.sf(abs(t_stat), dof)*2\n", | |
"print('p-values of t-statistics:', p_values)\n", | |
"\n", | |
"# SSR (regression sum of squares)\n", | |
"y_hat = np.dot(X1, beta_hat)\n", | |
"y_mu = np.mean(weight)\n", | |
"mean_SSR = np.dot((y_hat - y_mu).T, (y_hat - y_mu))/(len(beta_hat)-1)\n", | |
"\n", | |
"# f-statistic\n", | |
"f_stat = mean_SSR / np.square(sigma_hat)\n", | |
"print('f-statistic:', f_stat, '\\n')\n", | |
"\n", | |
"# p-value of f-statistic\n", | |
"p_values_f_stat = f.sf(abs(f_stat), dfn=(len(beta_hat)-1), dfd=dof)\n", | |
"print('p-value of f-statistic:', p_values_f_stat, '\\n')" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.5.1" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment