Skip to content

Instantly share code, notes, and snippets.

@yoavram
Created December 12, 2016 08:12
Show Gist options
  • Save yoavram/00638efdb17976f23263b232d5485051 to your computer and use it in GitHub Desktop.
Save yoavram/00638efdb17976f23263b232d5485051 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"numpy 1.11.2\n",
"statsmodels: 0.8.0rc1\n"
]
}
],
"source": [
"import numpy as np\n",
"print(\"numpy\", np.__version__)\n",
"import statsmodels.api as sm\n",
"print(\"statsmodels:\", sm.version.version)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"data2 = sm.datasets.scotland.load()\n",
"data2.exog = sm.add_constant(data2.exog, prepend=False)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/yoavram/miniconda3/envs/simarba/lib/python3.5/site-packages/statsmodels/genmod/generalized_linear_model.py:244: DomainWarning: The inverse_power link function does not respect the domain of the Gamma family.\n",
" DomainWarning)\n"
]
}
],
"source": [
"glm_gamma = sm.GLM(data2.endog, data2.exog, family=sm.families.Gamma())\n",
"glm_results = glm_gamma.fit()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:simarba]",
"language": "python",
"name": "conda-env-simarba-py"
},
"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.2"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment