diff --git a/src/py/crankshaft/crankshaft/regression/gwr.py b/src/py/crankshaft/crankshaft/regression/gwr.py index be25e27..44a5091 100644 --- a/src/py/crankshaft/crankshaft/regression/gwr.py +++ b/src/py/crankshaft/crankshaft/regression/gwr.py @@ -59,9 +59,8 @@ def gwr(subquery, dep_var, ind_vars, stand_errs = model.bse.reshape((-1)) predicted = np.repeat(model.predy.reshape((-1,)), k+1) residuals = np.repeat(model.resid_response.reshape((-1,)), k+1) - r_squared = np.tile(model.localR2.reshape((-1,)), k+1) + r_squared = np.repeat(model.localR2.reshape((-1,)), k+1) rowid = np.tile(rowid, k+1).reshape((-1,)) - var_name = np.tile(ind_vars, k+1).reshape((-1,)) - - return zip(coefficients, stand_errs, t_vals, predicted, - residuals, r_squared, rowid) + ind_vars.insert(0, 'intercept') + var_name = np.tile(ind_vars, n).reshape((-1,)) + return zip(coefficients, stand_errs, t_vals, predicted, residuals, r_squared, rowid, var_name) diff --git a/src/py/crankshaft/crankshaft/regression/gwr/base/diagnostics.py b/src/py/crankshaft/crankshaft/regression/gwr/base/diagnostics.py index 44a75d5..7fbcdc4 100644 --- a/src/py/crankshaft/crankshaft/regression/gwr/base/diagnostics.py +++ b/src/py/crankshaft/crankshaft/regression/gwr/base/diagnostics.py @@ -4,7 +4,7 @@ Diagnostics for estimated gwr modesl __author__ = "Taylor Oshan tayoshan@gmail.com" import numpy as np -from pysal.contrib.glm.family import Gaussian, Poisson, Binomial +from crankshaft.regression.glm.family import Gaussian, Poisson, Binomial def get_AICc(gwr): """ diff --git a/src/py/crankshaft/crankshaft/regression/gwr/base/gwr.py b/src/py/crankshaft/crankshaft/regression/gwr/base/gwr.py index 0711c29..0438f5b 100644 --- a/src/py/crankshaft/crankshaft/regression/gwr/base/gwr.py +++ b/src/py/crankshaft/crankshaft/regression/gwr/base/gwr.py @@ -10,10 +10,10 @@ from scipy.stats import t from kernels import * from diagnostics import get_AIC, get_AICc, get_BIC import pysal.spreg.user_output as USER -from pysal.contrib.glm.family import Gaussian, Binomial, Poisson -from pysal.contrib.glm.glm import GLM, GLMResults -from pysal.contrib.glm.iwls import iwls -from pysal.contrib.glm.utils import cache_readonly +from crankshaft.regression.glm.family import Gaussian, Binomial, Poisson +from crankshaft.regression.glm.glm import GLM, GLMResults +from crankshaft.regression.glm.iwls import iwls +from crankshaft.regression.glm.utils import cache_readonly fk = {'gaussian': fix_gauss, 'bisquare': fix_bisquare, 'exponential': fix_exp} ak = {'gaussian': adapt_gauss, 'bisquare': adapt_bisquare, 'exponential': adapt_exp} diff --git a/src/py/crankshaft/crankshaft/regression/gwr/base/sel_bw.py b/src/py/crankshaft/crankshaft/regression/gwr/base/sel_bw.py index 2c26d03..9ab1263 100644 --- a/src/py/crankshaft/crankshaft/regression/gwr/base/sel_bw.py +++ b/src/py/crankshaft/crankshaft/regression/gwr/base/sel_bw.py @@ -11,7 +11,7 @@ __author__ = "Taylor Oshan Tayoshan@gmail.com" from kernels import * from search import golden_section, equal_interval, flexible_bw from gwr import GWR -from pysal.contrib.glm.family import Gaussian, Poisson, Binomial +from crankshaft.regression.glm.family import Gaussian, Poisson, Binomial import pysal.spreg.user_output as USER from diagnostics import get_AICc, get_AIC, get_BIC, get_CV from scipy.spatial.distance import pdist, squareform