Skip to content

Instantly share code, notes, and snippets.

@akelleh
Created August 20, 2016 15:40
Show Gist options
  • Save akelleh/0435ee27320ed052c48eea56b1fe822a to your computer and use it in GitHub Desktop.
Save akelleh/0435ee27320ed052c48eea56b1fe822a to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 17,
"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.365</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Model:</th> <td>OLS</td> <th> Adj. R-squared: </th> <td> 0.365</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Method:</th> <td>Least Squares</td> <th> F-statistic: </th> <td> 574.9</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Date:</th> <td>Sat, 20 Aug 2016</td> <th> Prob (F-statistic):</th> <td>1.01e-100</td>\n",
"</tr>\n",
"<tr>\n",
" <th>Time:</th> <td>11:39:36</td> <th> Log-Likelihood: </th> <td> -1735.3</td> \n",
"</tr>\n",
"<tr>\n",
" <th>No. Observations:</th> <td> 1000</td> <th> AIC: </th> <td> 3473.</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Df Residuals:</th> <td> 999</td> <th> BIC: </th> <td> 3478.</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Df Model:</th> <td> 1</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> 1.0392</td> <td> 0.043</td> <td> 23.978</td> <td> 0.000</td> <td> 0.954 1.124</td>\n",
"</tr>\n",
"</table>\n",
"<table class=\"simpletable\">\n",
"<tr>\n",
" <th>Omnibus:</th> <td> 1.320</td> <th> Durbin-Watson: </th> <td> 2.116</td>\n",
"</tr>\n",
"<tr>\n",
" <th>Prob(Omnibus):</th> <td> 0.517</td> <th> Jarque-Bera (JB): </th> <td> 1.396</td>\n",
"</tr>\n",
"<tr>\n",
" <th>Skew:</th> <td>-0.079</td> <th> Prob(JB): </th> <td> 0.498</td>\n",
"</tr>\n",
"<tr>\n",
" <th>Kurtosis:</th> <td> 2.908</td> <th> Cond. No. </th> <td> 1.00</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.365\n",
"Model: OLS Adj. R-squared: 0.365\n",
"Method: Least Squares F-statistic: 574.9\n",
"Date: Sat, 20 Aug 2016 Prob (F-statistic): 1.01e-100\n",
"Time: 11:39:36 Log-Likelihood: -1735.3\n",
"No. Observations: 1000 AIC: 3473.\n",
"Df Residuals: 999 BIC: 3478.\n",
"Df Model: 1 \n",
"Covariance Type: nonrobust \n",
"==============================================================================\n",
" coef std err t P>|t| [95.0% Conf. Int.]\n",
"------------------------------------------------------------------------------\n",
"x 1.0392 0.043 23.978 0.000 0.954 1.124\n",
"==============================================================================\n",
"Omnibus: 1.320 Durbin-Watson: 2.116\n",
"Prob(Omnibus): 0.517 Jarque-Bera (JB): 1.396\n",
"Skew: -0.079 Prob(JB): 0.498\n",
"Kurtosis: 2.908 Cond. No. 1.00\n",
"==============================================================================\n",
"\n",
"Warnings:\n",
"[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n",
"\"\"\""
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model = OLS(X['z'], X[['x']])\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