local_SI
import numpy as np
import pandas as pd
import os
os.chdir('../')
from gravity import Gravity, Production, Attraction, Doubly, BaseGravity
import statsmodels.formula.api as smf
from statsmodels.api import families
import matplotlib.pyplot as plt
%pylab inline
austria = pd.read_csv('http://dl.dropbox.com/u/8649795/AT_Austria.csv')
austria = austria[austria['Origin'] != austria['Destination']]
f = austria['Data'].values
o = austria['Origin'].values
d = austria['Destination'].values
dij = austria['Dij'].values
o_vars = austria['Oi2007'].values
d_vars = austria['Dj2007'].values
model = Gravity(f, o_vars, d_vars, dij, 'exp')
print model.params[-1]
local = model.local(loc_index=o, locs=np.unique(o))
local['param2']
model = Production(f, o, d_vars, dij, 'exp')
print model.params[-1]
local = model.local()
local['param2']
model = Attraction(f, d, o_vars, dij, 'exp')
print model.params[-1]
local = model.local()
local['param2']