Commit 3e7d9524 authored by NUNEZ Arturo's avatar NUNEZ Arturo
Browse files

Automatic commit vendredi 8 juin 2018, 16:30:02 (UTC+0200)

parent f1aeadf3
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 1
}
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 1
}
This diff is collapsed.
%% Cell type:code id: tags:
``` python
import statsmodels.api as sm
import numpy as np
X = np.random.normal(0, 1, (100, 3))
y = np.random.choice([0, 1], 100)
res = sm.Logit(y, X).fit()
```
%% Output
Optimization terminated successfully.
Current function value: 0.647784
Iterations 5
%% Cell type:code id: tags:
``` python
np.exp(res.params)
```
%% Output
array([1.97272725, 0.98291187, 1.19830527])
%% Cell type:code id: tags:
``` python
params = res.params
conf = res.conf_int()
conf['1'] = params
conf.columns = ['2.5%', '97.5%', 'OR']
print(np.exp(conf))
```
%% Output
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-5-ab0a17837c0a> in <module>()
1 params = res.params
2 conf = res.conf_int()
----> 3 conf['or'] = params
4 conf.columns = ['2.5%', '97.5%', 'OR']
5 print(np.exp(conf))
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
%% Cell type:code id: tags:
``` python
from scipy.stats import moment
>>> moment([1, 2, 3, 4, 5], moment=1)
0.0
>>> moment([1, 2, 3, 4, 5], moment=2)
```
%% Output
File "<ipython-input-1-6eebf274266c>", line 3
>>> moment([1, 2, 3, 4, 5], moment=1)
^
SyntaxError: invalid syntax
%% Cell type:code id: tags:
``` python
```
......
This diff is collapsed.
This diff is collapsed.
%% Cell type:code id: tags:
``` python
from scipy.stats import moment
import numpy as np
a= np.array([1, 2, 3, 4, 5])
moment(a, moment=1)
```
%% Output
0.0
%% Cell type:code id: tags:
``` python
np.std(a)**2
```
%% Output
2.0000000000000004
%% Cell type:code id: tags:
``` python
moment(a,moment=2)
```
%% Output
2.0
%% Cell type:code id: tags:
``` python
```
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment