Created
August 20, 2016 21:06
-
-
Save akelleh/ed573cd2a5918bd9a0ff245138bf03e9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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": "code", | |
"execution_count": 30, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<table class=\"simpletable\">\n", | |
"<caption>OLS Regression Results</caption>\n", | |
"<tr>\n", | |
" <th>Dep. Variable:</th> <td>z</td> <th> R-squared: </th> <td> 0.491</td> \n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>Model:</th> <td>OLS</td> <th> Adj. R-squared: </th> <td> 0.490</td> \n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>Method:</th> <td>Least Squares</td> <th> F-statistic: </th> <td> 481.3</td> \n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>Date:</th> <td>Sat, 20 Aug 2016</td> <th> Prob (F-statistic):</th> <td>4.70e-147</td>\n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>Time:</th> <td>17:05:30</td> <th> Log-Likelihood: </th> <td> -1385.8</td> \n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>No. Observations:</th> <td> 1000</td> <th> AIC: </th> <td> 2776.</td> \n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>Df Residuals:</th> <td> 998</td> <th> BIC: </th> <td> 2785.</td> \n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>Df Model:</th> <td> 2</td> <th> </th> <td> </td> \n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>Covariance Type:</th> <td>nonrobust</td> <th> </th> <td> </td> \n", | |
"</tr>\n", | |
"</table>\n", | |
"<table class=\"simpletable\">\n", | |
"<tr>\n", | |
" <td></td> <th>coef</th> <th>std err</th> <th>t</th> <th>P>|t|</th> <th>[95.0% Conf. Int.]</th> \n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>x</th> <td> 0.0288</td> <td> 0.031</td> <td> 0.928</td> <td> 0.353</td> <td> -0.032 0.090</td>\n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>y</th> <td> 0.9736</td> <td> 0.044</td> <td> 21.941</td> <td> 0.000</td> <td> 0.887 1.061</td>\n", | |
"</tr>\n", | |
"</table>\n", | |
"<table class=\"simpletable\">\n", | |
"<tr>\n", | |
" <th>Omnibus:</th> <td> 0.798</td> <th> Durbin-Watson: </th> <td> 1.966</td>\n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>Prob(Omnibus):</th> <td> 0.671</td> <th> Jarque-Bera (JB): </th> <td> 0.881</td>\n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>Skew:</th> <td>-0.044</td> <th> Prob(JB): </th> <td> 0.644</td>\n", | |
"</tr>\n", | |
"<tr>\n", | |
" <th>Kurtosis:</th> <td> 2.884</td> <th> Cond. No. </th> <td> 2.53</td>\n", | |
"</tr>\n", | |
"</table>" | |
], | |
"text/plain": [ | |
"<class 'statsmodels.iolib.summary.Summary'>\n", | |
"\"\"\"\n", | |
" OLS Regression Results \n", | |
"==============================================================================\n", | |
"Dep. Variable: z R-squared: 0.491\n", | |
"Model: OLS Adj. R-squared: 0.490\n", | |
"Method: Least Squares F-statistic: 481.3\n", | |
"Date: Sat, 20 Aug 2016 Prob (F-statistic): 4.70e-147\n", | |
"Time: 17:05:30 Log-Likelihood: -1385.8\n", | |
"No. Observations: 1000 AIC: 2776.\n", | |
"Df Residuals: 998 BIC: 2785.\n", | |
"Df Model: 2 \n", | |
"Covariance Type: nonrobust \n", | |
"==============================================================================\n", | |
" coef std err t P>|t| [95.0% Conf. Int.]\n", | |
"------------------------------------------------------------------------------\n", | |
"x 0.0288 0.031 0.928 0.353 -0.032 0.090\n", | |
"y 0.9736 0.044 21.941 0.000 0.887 1.061\n", | |
"==============================================================================\n", | |
"Omnibus: 0.798 Durbin-Watson: 1.966\n", | |
"Prob(Omnibus): 0.671 Jarque-Bera (JB): 0.881\n", | |
"Skew: -0.044 Prob(JB): 0.644\n", | |
"Kurtosis: 2.884 Cond. No. 2.53\n", | |
"==============================================================================\n", | |
"\n", | |
"Warnings:\n", | |
"[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n", | |
"\"\"\"" | |
] | |
}, | |
"execution_count": 30, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"model = OLS(X['z'], X[['x','y']])\n", | |
"result = model.fit()\n", | |
"result.summary()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 2", | |
"language": "python", | |
"name": "python2" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 2 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment