In [1]:
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

In [2]:
plt.style.use('ggplot')

In [3]:
import shablona as sb
data_path = op.join(sb.__path__[0], 'data')

In [4]:
ortho_x, ortho_y, ortho_n = sb.transform_data(op.join(data_path, 'ortho.csv'))
para_x, para_y, para_n = sb.transform_data(op.join(data_path, 'para.csv'))

In [5]:
model = sb.Model()

In [6]:
ortho_fit = model.fit(ortho_x, ortho_y)
para_fit = model.fit(para_x, para_y)

In [7]:
ortho_fit.params


Out[7]:
array([ 0.46438638,  0.13845926])

In [8]:
para_fit.params


Out[8]:
array([ 0.57456788,  0.13684096])

In [9]:
fig, ax = plt.subplots(1)
x_predict = np.linspace(0, 1, 100)
for x, y, n in zip(ortho_x, ortho_y, ortho_n):
    ax.plot(x, y, 'bo', markersize=n)
    ax.plot(x_predict, ortho_fit.predict(x_predict), 'b')

for x,y,n in zip(para_x, para_y, para_n):
    ax.plot(x, y, 'go', markersize=n)
    ax.plot(x_predict, para_fit.predict(x_predict), 'g')

ax.set_xlabel('Contrast in interval 1')
ax.set_ylabel("Proportion answers '1'")
ax.set_ylim([-0.1, 1.1])
ax.set_xlim([-0.1, 1.1])
fig.set_size_inches([8,8])



In [ ]: