[pysal] 06/17: Imported Upstream version 1.11.2

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Sat Jun 11 20:44:27 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository pysal.

commit 776b952fc7e16ef10a4d411536adff8f2b30be21
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sat Jun 11 17:12:15 2016 +0200

    Imported Upstream version 1.11.2
---
 .travis.yml                                        |   9 +
 CHANGELOG.txt                                      |  33 ++
 doc/source/conf.py                                 |  57 ++--
 doc/source/developers/projects.rst                 |   5 +-
 doc/source/developers/release.rst                  |   6 +-
 doc/source/index.rst                               |   2 +-
 doc/source/users/installation.rst                  |   2 +-
 pysal/cg/kdtree.py                                 |  74 ++++-
 pysal/common.py                                    |  12 +
 pysal/contrib/README.rst                           |   5 +
 pysal/contrib/handler/Explaining the Handler.ipynb | 370 ++++++++++-----------
 pysal/contrib/handler/handler.py                   | 103 ++++--
 pysal/contrib/handler/registry.py                  |  41 +--
 pysal/contrib/handler/tests/test_error_sp.py       | 149 ---------
 .../contrib/handler/tests/test_error_sp_regimes.py |   7 +-
 .../contrib/handler/tests/test_error_sp_sparse.py  | 154 ---------
 pysal/contrib/handler/tests/test_error_spet.py     | 192 -----------
 .../handler/tests/test_error_spet_sparse.py        | 196 -----------
 pysal/contrib/handler/tests/test_error_spom.py     | 149 +--------
 .../handler/tests/test_error_spom_regimes.py       |  11 +-
 .../handler/tests/test_error_spom_sparse.py        | 150 +--------
 pysal/contrib/handler/tests/test_ols.py            |  36 +-
 pysal/contrib/handler/tests/test_ols_sparse.py     |  16 +-
 pysal/contrib/handler/tests/test_probit.py         |  52 ---
 pysal/contrib/handler/tests/test_twosls.py         |  99 ------
 pysal/contrib/handler/tests/test_twosls_sp.py      | 163 +--------
 .../contrib/handler/tests/test_twosls_sp_sparse.py | 163 +--------
 pysal/contrib/handler/tests/test_twosls_sparse.py  | 100 ------
 pysal/esda/moran.py                                |  53 +--
 pysal/esda/tests/test_moran.py                     |  17 +-
 pysal/meta/wmd.py                                  |  12 +-
 pysal/version.py                                   |   4 +-
 pysal/weights/Distance.py                          |  35 +-
 pysal/weights/spatial_lag.py                       |  35 +-
 pysal/weights/user.py                              |  17 +-
 pysal/weights/util.py                              |  17 +-
 setup.py                                           |   2 +-
 37 files changed, 538 insertions(+), 2010 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index c584b4a..39c323d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,6 +7,7 @@ python:
   - 2.7
   #- "2.6"
   - 3.4
+  - 3.5
 
 before_install:
   - wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
@@ -41,6 +42,14 @@ notifications:
         recipients:
             - sjsrey at gmail.com
             - levi.john.wolf at gmail.com
+            - dfolch at gmail.com
+            - daniel.arribas.bel at gmail.com
+            - weikang9009 at gmail.com
+            - carsonfarmer at gmail.com
+            - tayoshan at gmail.com
+            - marynia.kolak at gmail.com
+            - jgaboardi at gmail.com
+            - phil.stphns at gmail.com
         on_success: always
         on_failure: always
 
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 8151921..eba2568 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,36 @@
+v<1.11.2>, 2016-05-18
+
+We closed a total of 20 issues, 6 pull requests and 14 regular issues;
+this is the full list (generated with the script 
+:file:`tools/github_stats.py`):
+
+Pull Requests (6):
+
+* :ghpull:`805`: pre Rel1.11.2 and #840
+* :ghpull:`802`: fixed issues with model handler failing to correctly discover models
+* :ghpull:`798`: fix for css problem on rtd #790
+* :ghpull:`793`: Getting weights doctests to pass
+* :ghpull:`791`: Doc/rolling
+* :ghpull:`792`: Local Moran was using the incorrect moments in z_sim and p_z_sim
+
+Issues (14):
+
+* :ghissue:`805`: pre Rel1.11.2 and #840
+* :ghissue:`803`: check_contiguity error.. 
+* :ghissue:`802`: fixed issues with model handler failing to correctly discover models
+* :ghissue:`800`: `ps.threshold_continuousW_from_shapefile` returning inf along diagonal
+* :ghissue:`771`: KDtree type mismatch in knnW
+* :ghissue:`798`: fix for css problem on rtd #790
+* :ghissue:`796`: working moran plot func
+* :ghissue:`787`: Update docs to reflect Python-3 compatibility
+* :ghissue:`587`: ML Lag indexing error on optimization result
+* :ghissue:`793`: Getting weights doctests to pass
+* :ghissue:`791`: Doc/rolling
+* :ghissue:`792`: Local Moran was using the incorrect moments in z_sim and p_z_sim
+* :ghissue:`674`: Have PySAL included on OSGeo Live 9 
+* :ghissue:`779`: DistanceBand include the point itself as neighbor
+
+
 v<1.11.1>, 2016-04-01
 
 We closed a total of 62 issues, 20 pull requests and 42 regular issues;
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 35aa1e7..c9ac269 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -1,25 +1,13 @@
 # -*- coding: utf-8 -*-
 #
-# pysal documentation build configuration file, created by
-# sphinx-quickstart on Wed Aug 26 19:58:20 2009.
-#
-# This file is execfile()d with the current directory set to its containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
 # serve to show the default.
 
 import sys
 import os
 
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
 #sys.path.append(os.path.abspath('sphinxext'))
 #sys.path.append(os.path.abspath('../../'))
-sys.path.append(os.path.abspath('~/anaconda/lib/python2.7/site-packages/'))
+#sys.path.append(os.path.abspath('~/anaconda/lib/python2.7/site-packages/'))
 
 # -- General configuration -----------------------------------------------------
 
@@ -31,12 +19,12 @@ extensions = ['sphinx.ext.autodoc',
 'sphinx.ext.pngmath','sphinx.ext.viewcode', 'sphinxcontrib.napoleon']
 
 #doctest extension config values
-doctest_path = '/Users/stephens/code/pysal/doc/source/users/tutorials/'
+#doctest_path = '/Users/stephens/code/pysal/doc/source/users/tutorials/'
 doctest_test_doctest_blocks = ''
 #doctest_global_setup =
 
 # Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
+#templates_path = ['_templates']
 
 # The suffix of source filenames.
 source_suffix = '.rst'
@@ -57,9 +45,9 @@ copyright = u'2014-, PySAL Developers; 2009-13 Sergio Rey'
 # built documents.
 #
 # The short X.Y version.
-version = '1.11.1'
+version = '1.11.2'
 # The full version, including alpha/beta/rc tags.
-release = '1.11.1'
+release = '1.11.2'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
@@ -106,24 +94,33 @@ pygments_style = 'sphinx'
 
 # The theme to use for HTML and HTML Help pages.  Major themes that come with
 # Sphinx are currently 'default' and 'sphinxdoc'.
-html_theme = 'default'
+#html_theme = 'default'
 #html_theme = 'sphinxdoc'
 
+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+
+if not on_rtd:
+    import sphinx_rtd_theme
+    html_theme = "sphinx_rtd_theme"
+    #html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+
+
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
 # documentation.
-html_theme_options = {
-        "rightsidebar": "true",
-        "relbarbgcolor": "CornflowerBlue",
-        "sidebartextcolor": "black",
-        "sidebarlinkcolor": "#355f7c",
-        "sidebarbgcolor": "#F2F2F2",
-        "codebgcolor": "AliceBlue",
-        "footerbgcolor": "Black",
-        "externalrefs": "false",
-        "bodyfont": "Optima",
-        "headfont": "Optima "
-        }
+#html_theme_options = {
+#        "rightsidebar": "true",
+#        "relbarbgcolor": "CornflowerBlue",
+#        "sidebartextcolor": "black",
+#        "sidebarlinkcolor": "#355f7c",
+#        "sidebarbgcolor": "#F2F2F2",
+#        "codebgcolor": "AliceBlue",
+#        "footerbgcolor": "Black",
+#        "externalrefs": "false",
+#        "bodyfont": "Optima",
+#        "headfont": "Optima "
+#        }
 
 # Add any paths that contain custom themes here, relative to this directory.
 #html_theme_path = []
diff --git a/doc/source/developers/projects.rst b/doc/source/developers/projects.rst
index 742885f..6f49407 100644
--- a/doc/source/developers/projects.rst
+++ b/doc/source/developers/projects.rst
@@ -1,11 +1,11 @@
 .. _projectsusingpysal:
 
 =========================
-Projects Using PySAL 
+Projects Using PySAL
 =========================
 
 This page lists other software projects making use of PySAL.  If your project is
-not listed here, contact one of the `team members <http://code.google.com/p/pysal/people/list>`_ and we'll add it. 
+not listed here, contact one of the `team members <http://code.google.com/p/pysal/people/list>`_ and we'll add it.
 
 ----------------------
 GeoDa Center Projects
@@ -23,3 +23,4 @@ Related Projects
   * `Anaconda <http://continuum.io/downloads>`_
   * `StatsModels <http://statsmodels.sourceforge.net/related.html#related>`_
   * `PythonAnywhere <http://pythonanywhere.com>`_ includes latest PySAL release
+  * `CartoDB <http://cartodb.com>`_ includes PySAL through a `custom PostgreSQL extension <https://github.com/CartoDB/crankshaft>`_
diff --git a/doc/source/developers/release.rst b/doc/source/developers/release.rst
index 6322e45..4fbcccf 100644
--- a/doc/source/developers/release.rst
+++ b/doc/source/developers/release.rst
@@ -25,7 +25,7 @@ Prepare the release
 
 - Commit all changes.
 - Push_ your branch up to your GitHub repos
-- On github issue a pull request, with a target of **upstream dev**. 
+- On github issue a pull request, with a target of **upstream master**. 
   Add a comment that this is for release.
 
 
@@ -60,10 +60,10 @@ is `v1.10` in what follows)::
 
 - Test that your package can install correctly::
 
-  $ pip install -i https://testpy.python.org/pypi
+  $ pip install -i https://testpypi.python.org/pypi pysal
 
 
-If all is good, proceed, otherwise fix.
+If all is good, proceed, otherwise fix, and repeat.
 
 
 - Make and upload_ to the Python Package Index in one shot!::
diff --git a/doc/source/index.rst b/doc/source/index.rst
index b07700a..db61b7e 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -20,7 +20,7 @@ PySAL
 
 .. sidebar:: Releases
 
-    - `Stable 1.11.1 (Released 2016-4-1) <users/installation.html>`_
+    - `Stable 1.11.2 (Released 2016-5-18) <users/installation.html>`_
     - `Development  <http://github.com/pysal/pysal/tree/dev>`_
 
 PySAL is an open source library of spatial analysis functions written in
diff --git a/doc/source/users/installation.rst b/doc/source/users/installation.rst
index 5b56056..67c394c 100644
--- a/doc/source/users/installation.rst
+++ b/doc/source/users/installation.rst
@@ -32,7 +32,7 @@ stable version of PySAL with either of these distributions as follows:
 
 If you do not wish to use either Anaconda or Enthought, ensure the following software packages are available on your machine:
 
-* `Python <http://www.python.org/download>`_ 2.6, or 2.7 
+* `Python <http://www.python.org/download>`_ 2.6, 2.7 or 3.4
 * `numpy <http://new.scipy.org/download.html>`_ 1.3 or later
 * `scipy <http://new.scipy.org/download.html>`_ 0.11 or later
 
diff --git a/pysal/cg/kdtree.py b/pysal/cg/kdtree.py
index e9656e4..f9655e1 100644
--- a/pysal/cg/kdtree.py
+++ b/pysal/cg/kdtree.py
@@ -9,19 +9,67 @@ import scipy.spatial
 import numpy
 from scipy import inf
 import sphere
+from sphere import RADIUS_EARTH_KM
 
 __author__ = "Charles R Schmidt <schmidtc at gmail.com>"
+
+__all__ = ["DISTANCE_METRICS", "FLOAT_EPS", "KDTree"]
+
 DISTANCE_METRICS = ['Euclidean', 'Arc']
 FLOAT_EPS = numpy.finfo(float).eps
 
 
-class Arc_KDTree(scipy.spatial.KDTree):
+def KDTree(data, leafsize=10, distance_metric='Euclidean', 
+           radius=RADIUS_EARTH_KM):
+    """
+    kd-tree built on top of kd-tree functionality in scipy. If using scipy 0.12
+    or greater uses the scipy.spatial.cKDTree, otherwise uses
+    scipy.spatial.KDTree. Offers both Arc distance and Euclidean distance.
+    Note that Arc distance is only appropriate when points in latitude and
+    longitude, and the radius set to meaningful value (see docs below). 
+
+    Parameters
+    ----------
+    data            : array
+                      The data points to be indexed. This array is not copied, 
+                      and so modifying this data will result in bogus results.
+                      Typically nx2.
+    leafsize        : int
+                      The number of points at which the algorithm switches over 
+                      to brute-force. Has to be positive. Optional, default is 10.
+    distance_metric : string
+                      Options: "Euclidean" (default) and "Arc".
+    radius          : float
+                      Radius of the sphere on which to compute distances.
+                      Assumes data in latitude and longitude. Ignored if
+                      distance_metric="Euclidean". Typical values:
+                      pysal.cg.RADIUS_EARTH_KM  (default)
+                      pysal.cg.RADIUS_EARTH_MILES
+    """
+
+    if distance_metric.lower() == 'euclidean':
+        if int(scipy.version.version.split(".")[1]) < 12:
+            return scipy.spatial.KDTree(data, leafsize)
+        else:
+            return scipy.spatial.cKDTree(data, leafsize)
+    elif distance_metric == 'Arc':
+        return Arc_KDTree(data, leafsize, radius)
+
+
+# internal hack for the Arc_KDTree class inheritance 
+if int(scipy.version.version.split(".")[1]) < 12:
+    temp_KDTree = scipy.spatial.KDTree
+else:
+    temp_KDTree = scipy.spatial.cKDTree
+
+
+class Arc_KDTree(temp_KDTree):
     def __init__(self, data, leafsize=10, radius=1.0):
         """
         KDTree using Arc Distance instead of Euclidean Distance.
 
         Returned distances are based on radius.
-        For Example, pass in the the radius of earth in miles to get back miles.
+        For Example, pass in the radius of earth in miles to get back miles.
         Assumes data are Lng/Lat, does not account for geoids.
 
         For more information see docs for scipy.spatial.KDTree
@@ -39,7 +87,7 @@ class Arc_KDTree(scipy.spatial.KDTree):
         """
         self.radius = radius
         self.circumference = 2 * math.pi * radius
-        scipy.spatial.KDTree.__init__(self, map(sphere.toXYZ, data), leafsize)
+        temp_KDTree.__init__(self, map(sphere.toXYZ, data), leafsize)
 
     def _toXYZ(self, x):
         if not issubclass(type(x), numpy.ndarray):
@@ -75,7 +123,7 @@ class Arc_KDTree(scipy.spatial.KDTree):
         if r > 0.5 * self.circumference:
             raise ValueError("r, must not exceed 1/2 circumference of the sphere (%f)." % self.circumference * 0.5)
         r = sphere.arcdist2linear(r, self.radius)
-        return scipy.spatial.KDTree.count_neighbors(self, other, r)
+        return temp_KDTree.count_neighbors(self, other, r)
 
     def query(self, x, k=1, eps=0, p=2, distance_upper_bound=inf):
         """
@@ -108,7 +156,7 @@ class Arc_KDTree(scipy.spatial.KDTree):
         if distance_upper_bound != inf:
             distance_upper_bound = sphere.arcdist2linear(
                 distance_upper_bound, self.radius)
-        d, i = scipy.spatial.KDTree.query(self, self._toXYZ(x), k,
+        d, i = temp_KDTree.query(self, self._toXYZ(x), k,
                                           eps=eps, distance_upper_bound=distance_upper_bound)
         dims = len(d.shape)
         r = self.radius
@@ -146,7 +194,7 @@ class Arc_KDTree(scipy.spatial.KDTree):
         if r > 0.5 * self.circumference:
             raise ValueError("r, must not exceed 1/2 circumference of the sphere (%f)." % self.circumference * 0.5)
         r = sphere.arcdist2linear(r, self.radius) + FLOAT_EPS * 3
-        return scipy.spatial.KDTree.query_ball_point(self, self._toXYZ(x), r, eps=eps)
+        return temp_KDTree.query_ball_point(self, self._toXYZ(x), r, eps=eps)
 
     def query_ball_tree(self, other, r, p=2, eps=0):
         """
@@ -174,7 +222,7 @@ class Arc_KDTree(scipy.spatial.KDTree):
         if r > 0.5 * self.circumference:
             raise ValueError("r, must not exceed 1/2 circumference of the sphere (%f)." % self.circumference * 0.5)
         r = sphere.arcdist2linear(r, self.radius) + FLOAT_EPS * 3
-        return scipy.spatial.KDTree.query_ball_tree(self, other, r, eps=eps)
+        return temp_KDTree.query_ball_tree(self, other, r, eps=eps)
 
     def query_pairs(self, r, p=2, eps=0):
         """
@@ -196,7 +244,7 @@ class Arc_KDTree(scipy.spatial.KDTree):
         if r > 0.5 * self.circumference:
             raise ValueError("r, must not exceed 1/2 circumference of the sphere (%f)." % self.circumference * 0.5)
         r = sphere.arcdist2linear(r, self.radius) + FLOAT_EPS * 3
-        return scipy.spatial.KDTree.query_pairs(self, r, eps=eps)
+        return temp_KDTree.query_pairs(self, r, eps=eps)
 
     def sparse_distance_matrix(self, other, max_distance, p=2):
         """
@@ -227,7 +275,7 @@ class Arc_KDTree(scipy.spatial.KDTree):
             raise ValueError("max_distance, must not exceed 1/2 circumference of the sphere (%f)." % self.circumference * 0.5)
         max_distance = sphere.arcdist2linear(
             max_distance, self.radius) + FLOAT_EPS * 3
-        D = scipy.spatial.KDTree.sparse_distance_matrix(
+        D = temp_KDTree.sparse_distance_matrix(
             self, other, max_distance)
         D = D.tocoo()
         #print D.data
@@ -236,11 +284,3 @@ class Arc_KDTree(scipy.spatial.KDTree):
         return scipy.sparse.coo_matrix((map(a2l, D.data), (D.row, D.col))).todok()
 
 
-def KDTree(data, leafsize=10, distance_metric='Euclidean', radius=1.0):
-    if distance_metric.lower() == 'euclidean':
-        if int(scipy.version.version.split(".")[1]) < 12:
-            return scipy.spatial.KDTree(data, leafsize)
-        else:
-            return scipy.spatial.cKDTree(data, leafsize)
-    elif distance_metric == 'Arc':
-        return Arc_KDTree(data, leafsize, radius)
diff --git a/pysal/common.py b/pysal/common.py
index d111997..44f8f55 100644
--- a/pysal/common.py
+++ b/pysal/common.py
@@ -24,3 +24,15 @@ import random
 import sys
 import time
 import unittest
+
+def iteritems(d, **kwargs):
+    """
+    Implements six compatibility library's iteritems function
+
+    appropriately calls either d.iteritems() or d.items() depending on the
+    version of python being used. 
+    """
+    if sys.version_info.major < 3:
+        return d.iteritems(**kwargs)
+    else:
+        return iter(d.items(**kwargs))
diff --git a/pysal/contrib/README.rst b/pysal/contrib/README.rst
index 1902edb..a14c365 100644
--- a/pysal/contrib/README.rst
+++ b/pysal/contrib/README.rst
@@ -66,6 +66,11 @@ Currently the following contribs are available:
     - Path: pysal.contrib.pdutilities
     - Requires: `pandas`_
 
+ 8. Spatial Interaction -- Tools for spatial interaction (SpInt) modeling. 
+
+    - .. versionadded:: 1.10
+    - Path: pysal.contrib.spint
+    - Requires: `pandas`_
 
 
 
diff --git a/pysal/contrib/handler/Explaining the Handler.ipynb b/pysal/contrib/handler/Explaining the Handler.ipynb
index 1b182d8..872bb06 100644
--- a/pysal/contrib/handler/Explaining the Handler.ipynb	
+++ b/pysal/contrib/handler/Explaining the Handler.ipynb	
@@ -11,16 +11,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "The `spreg-handler` provides a unified interface to apply any specifed regression function in pysal to data, like a call to `lm` in `R`. \n",
-    "\n",
-    "This has 2 components. \n",
-    "\n",
-    "1. `registry.py`, which finds all of the valid model classes in `pysal.spreg`\n",
-    "2. `handler.py`, which proves *one* function to estimate all of those classes.\n",
-    "\n",
-    "Thanks to the `registry`, `handler.Model` can serve as the single point of access for a `patsy`/`pandas` interface logic, as well as anything else that we might want to add to regression classes without forcing it through inheritance.\n",
-    "\n",
-    "First, let's set up and estimate some models. "
+    "The `spreg-handler` provides a unified interface to apply any specifed regression function in pysal to data, like a call to `lm` in `R`:"
    ]
   },
   {
@@ -32,8 +23,7 @@
    "outputs": [],
    "source": [
     "import handler as h\n",
-    "import pysal as ps\n",
-    "import geopandas as gpd"
+    "import pysal as ps"
    ]
   },
   {
@@ -44,10 +34,9 @@
    },
    "outputs": [],
    "source": [
-    "df = gpd.read_file(ps.examples.get_path('columbus.json'))\n",
-    "dbf = ps.open(ps.examples.get_path('columbus.dbf'))\n",
-    "y = dbf.by_col_array(['HOVAL'])\n",
-    "X = dbf.by_col_array(['INC', 'CRIME'])\n",
+    "dbf = ps.pdio.read_files(ps.examples.get_path('columbus.dbf'))\n",
+    "y = dbf[['HOVAL']].values\n",
+    "X = dbf[['INC', 'CRIME']].values\n",
     "W = ps.open(ps.examples.get_path('columbus.gal')).read()"
    ]
   },
@@ -77,6 +66,17 @@
    },
    "outputs": [],
    "source": [
+    "formulaic = h.Model('HOVAL ~ INC + CRIME', w=W, data=dbf)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 5,
+   "metadata": {
+    "collapsed": false
+   },
+   "outputs": [],
+   "source": [
     "handled = h.Model(y,\n",
     "                  X,\n",
     "                  W,\n",
@@ -87,9 +87,10 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 6,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "scrolled": true
    },
    "outputs": [
     {
@@ -117,8 +118,8 @@
       "            Variable     Coefficient       Std.Error     t-Statistic     Probability\n",
       "------------------------------------------------------------------------------------\n",
       "            CONSTANT      46.4281827      13.1917570       3.5194844       0.0009867\n",
-      "               CRIME      -0.4848885       0.1826729      -2.6544086       0.0108745\n",
       "                 INC       0.6289840       0.5359104       1.1736736       0.2465669\n",
+      "               CRIME      -0.4848885       0.1826729      -2.6544086       0.0108745\n",
       "------------------------------------------------------------------------------------\n",
       "\n",
       "REGRESSION DIAGNOSTICS\n",
@@ -143,9 +144,10 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 6,
+   "execution_count": 7,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "scrolled": true
    },
    "outputs": [
     {
@@ -157,7 +159,7 @@
       "SUMMARY OF OUTPUT: ORDINARY LEAST SQUARES\n",
       "-----------------------------------------\n",
       "Data set            :     unknown\n",
-      "Weights matrix      :     unknown\n",
+      "Weights matrix      :        None\n",
       "Dependent Variable  :       HOVAL                Number of Observations:          49\n",
       "Mean dependent var  :     38.4362                Number of Variables   :           3\n",
       "S.D. dependent var  :     18.4661                Degrees of Freedom    :          46\n",
@@ -173,8 +175,8 @@
       "            Variable     Coefficient       Std.Error     t-Statistic     Probability\n",
       "------------------------------------------------------------------------------------\n",
       "            CONSTANT      46.4281827      13.1917570       3.5194844       0.0009867\n",
-      "               CRIME      -0.4848885       0.1826729      -2.6544086       0.0108745\n",
       "                 INC       0.6289840       0.5359104       1.1736736       0.2465669\n",
+      "               CRIME      -0.4848885       0.1826729      -2.6544086       0.0108745\n",
       "------------------------------------------------------------------------------------\n",
       "\n",
       "REGRESSION DIAGNOSTICS\n",
@@ -198,9 +200,68 @@
    ]
   },
   {
+   "cell_type": "code",
+   "execution_count": 8,
+   "metadata": {
+    "collapsed": false,
+    "scrolled": true
+   },
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "REGRESSION\n",
+      "----------\n",
+      "SUMMARY OF OUTPUT: ORDINARY LEAST SQUARES\n",
+      "-----------------------------------------\n",
+      "Data set            :     unknown\n",
+      "Weights matrix      :     unknown\n",
+      "Dependent Variable  :      HOVAL                 Number of Observations:          49\n",
+      "Mean dependent var  :     38.4362                Number of Variables   :           3\n",
+      "S.D. dependent var  :     18.4661                Degrees of Freedom    :          46\n",
+      "R-squared           :      0.3495\n",
+      "Adjusted R-squared  :      0.3212\n",
+      "Sum squared residual:   10647.015                F-statistic           :     12.3582\n",
+      "Sigma-square        :     231.457                Prob(F-statistic)     :   5.064e-05\n",
+      "S.E. of regression  :      15.214                Log likelihood        :    -201.368\n",
+      "Sigma-square ML     :     217.286                Akaike info criterion :     408.735\n",
+      "S.E of regression ML:     14.7406                Schwarz criterion     :     414.411\n",
+      "\n",
+      "------------------------------------------------------------------------------------\n",
+      "            Variable     Coefficient       Std.Error     t-Statistic     Probability\n",
+      "------------------------------------------------------------------------------------\n",
+      "            CONSTANT      46.4281827      13.1917570       3.5194844       0.0009867\n",
+      "                INC        0.6289840       0.5359104       1.1736736       0.2465669\n",
+      "               CRIME      -0.4848885       0.1826729      -2.6544086       0.0108745\n",
+      "------------------------------------------------------------------------------------\n",
+      "\n",
+      "REGRESSION DIAGNOSTICS\n",
+      "MULTICOLLINEARITY CONDITION NUMBER           12.538\n",
+      "\n",
+      "TEST ON NORMALITY OF ERRORS\n",
+      "TEST                             DF        VALUE           PROB\n",
+      "Jarque-Bera                       2          39.706           0.0000\n",
+      "\n",
+      "DIAGNOSTICS FOR HETEROSKEDASTICITY\n",
+      "RANDOM COEFFICIENTS\n",
+      "TEST                             DF        VALUE           PROB\n",
+      "Breusch-Pagan test                2           5.767           0.0559\n",
+      "Koenker-Bassett test              2           2.270           0.3214\n",
+      "================================ END OF REPORT =====================================\n"
+     ]
+    }
+   ],
+   "source": [
+    "print(formulaic.summary)"
+   ]
+  },
+  {
    "cell_type": "markdown",
    "metadata": {},
    "source": [
+    "## How does it work?\n",
+    "\n",
     "The long and short of it is that `Model` classes pass estimation to the function specified in `mtype`, and then contain the results in a reasonable way. \n",
     "\n",
     "In fact, the \"real\" `PySAL` model class sits under `handled._called`, so, at worst, we can just reference aspects of `handled` down to `_called`. I currently do this by iterating through `dir(handled._called)` and using `eval` to flatten all of `_called`'s attributes into `handled` at initialization. \n",
@@ -230,7 +291,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 7,
+   "execution_count": 9,
    "metadata": {
     "collapsed": false
    },
@@ -239,9 +300,54 @@
      "name": "stdout",
      "output_type": "stream",
      "text": [
+      "__class__is in two different addresses.\n",
+      "\t Outer is at 0x55ab4b929540\n",
+      "\t Inner is at 0x55ab4b34d330\n",
+      "__delattr__is in two different addresses.\n",
+      "\t Outer is at 0x7ff078f94310\n",
+      "\t Inner is at 0x7ff078f94410\n",
+      "__dict__is in two different addresses.\n",
+      "\t Outer is at 0x7ff078f8f5c8\n",
+      "\t Inner is at 0x7ff078f7fd70\n",
+      "__doc__is in two different addresses.\n",
+      "\t Outer is at 0x7ff09c0c31d0\n",
+      "\t Inner is at 0x55ab4b3492b0\n",
+      "__format__is in two different addresses.\n",
+      "\t Outer is at 0x7ff07906cb00\n",
+      "\t Inner is at 0x7ff0790253b0\n",
+      "__getattribute__is in two different addresses.\n",
+      "\t Outer is at 0x7ff078f94450\n",
+      "\t Inner is at 0x7ff078f94310\n",
+      "__hash__is in two different addresses.\n",
+      "\t Outer is at 0x7ff078f94310\n",
+      "\t Inner is at 0x7ff078f94490\n",
       "__init__is in two different addresses.\n",
-      "\t Outer is at 0x7f11fbb2dcd0\n",
-      "\t Inner is at 0x7f11fbb92820\n"
+      "\t Outer is at 0x7ff09c195370\n",
+      "\t Inner is at 0x7ff07a54d820\n",
+      "__module__is in two different addresses.\n",
+      "\t Outer is at 0x7ff09c04ea80\n",
+      "\t Inner is at 0x7ff07c76ec70\n",
+      "__reduce__is in two different addresses.\n",
+      "\t Outer is at 0x7ff0790253b0\n",
+      "\t Inner is at 0x7ff07906cb00\n",
+      "__reduce_ex__is in two different addresses.\n",
+      "\t Outer is at 0x7ff07906cb00\n",
+      "\t Inner is at 0x7ff07901dbd8\n",
+      "__repr__is in two different addresses.\n",
+      "\t Outer is at 0x7ff078f94310\n",
+      "\t Inner is at 0x7ff078f94490\n",
+      "__setattr__is in two different addresses.\n",
+      "\t Outer is at 0x7ff078f94490\n",
+      "\t Inner is at 0x7ff078f94410\n",
+      "__sizeof__is in two different addresses.\n",
+      "\t Outer is at 0x7ff07901dbd8\n",
+      "\t Inner is at 0x7ff07906cb00\n",
+      "__str__is in two different addresses.\n",
+      "\t Outer is at 0x7ff078f94490\n",
+      "\t Inner is at 0x7ff078f94410\n",
+      "__subclasshook__is in two different addresses.\n",
+      "\t Outer is at 0x7ff07906cb00\n",
+      "\t Inner is at 0x7ff07901dbd8\n"
      ]
     }
    ],
@@ -260,7 +366,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "Only the `__init__` function exposed by `Model` is different from `Model._called`, which makes sense, since an `__init__` function can't write over itself. \n",
+    "Only the double underscore functions exposed by `Model` are different from `Model._called`.\n",
     "\n",
     "If we wanted to access `Model._called.__init__`, it's still there. This means we could implement some \"refit\" method, `Model.refit(y=Model.y, X=Model.X, ...)` which could use `Model._called.__init__` to revise estimates in `Model` in place or returning a new model.\n",
     "\n",
@@ -287,7 +393,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 8,
+   "execution_count": 10,
    "metadata": {
     "collapsed": false
    },
@@ -307,7 +413,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 9,
+   "execution_count": 11,
    "metadata": {
     "collapsed": false
    },
@@ -318,7 +424,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 10,
+   "execution_count": 12,
    "metadata": {
     "collapsed": false
    },
@@ -346,9 +452,9 @@
       "            Variable     Coefficient       Std.Error     z-Statistic     Probability\n",
       "------------------------------------------------------------------------------------\n",
       "            CONSTANT      44.1882822      12.9020363       3.4249076       0.0006150\n",
-      "           W_dep_var       0.0259466       0.0262601       0.9880621       0.3231223\n",
       "               var_1       0.5453705       0.5209327       1.0469117       0.2951403\n",
       "               var_2      -0.5186558       0.1768050      -2.9334902       0.0033517\n",
+      "           W_dep_var       0.0259466       0.0262601       0.9880621       0.3231223\n",
       "------------------------------------------------------------------------------------\n",
       "================================ END OF REPORT =====================================\n"
      ]
@@ -360,7 +466,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 11,
+   "execution_count": 13,
    "metadata": {
     "collapsed": false
    },
@@ -388,9 +494,9 @@
       "            Variable     Coefficient       Std.Error     z-Statistic     Probability\n",
       "------------------------------------------------------------------------------------\n",
       "            CONSTANT      44.1882822      12.9020363       3.4249076       0.0006150\n",
-      "           W_dep_var       0.0259466       0.0262601       0.9880621       0.3231223\n",
       "               var_1       0.5453705       0.5209327       1.0469117       0.2951403\n",
       "               var_2      -0.5186558       0.1768050      -2.9334902       0.0033517\n",
+      "           W_dep_var       0.0259466       0.0262601       0.9880621       0.3231223\n",
       "------------------------------------------------------------------------------------\n",
       "================================ END OF REPORT =====================================\n"
      ]
@@ -416,18 +522,19 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 12,
+   "execution_count": 14,
    "metadata": {
-    "collapsed": true
+    "collapsed": false
    },
    "outputs": [],
    "source": [
+    "df = ps.pdio.read_files(ps.examples.get_path('columbus.dbf'))\n",
     "handled_eq = h.Model(\"HOVAL ~ INC + CRIME\", data=df)"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 13,
+   "execution_count": 15,
    "metadata": {
     "collapsed": false,
     "scrolled": false
@@ -442,7 +549,8 @@
       "SUMMARY OF OUTPUT: ORDINARY LEAST SQUARES\n",
       "-----------------------------------------\n",
       "Data set            :     unknown\n",
-      "Dependent Variable  :     dep_var                Number of Observations:          49\n",
+      "Weights matrix      :        None\n",
+      "Dependent Variable  :      HOVAL                 Number of Observations:          49\n",
       "Mean dependent var  :     38.4362                Number of Variables   :           3\n",
       "S.D. dependent var  :     18.4661                Degrees of Freedom    :          46\n",
       "R-squared           :      0.3495\n",
@@ -457,8 +565,8 @@
       "            Variable     Coefficient       Std.Error     t-Statistic     Probability\n",
       "------------------------------------------------------------------------------------\n",
       "            CONSTANT      46.4281827      13.1917570       3.5194844       0.0009867\n",
-      "               var_1       0.6289840       0.5359104       1.1736736       0.2465669\n",
-      "               var_2      -0.4848885       0.1826729      -2.6544086       0.0108745\n",
+      "                INC        0.6289840       0.5359104       1.1736736       0.2465669\n",
+      "               CRIME      -0.4848885       0.1826729      -2.6544086       0.0108745\n",
       "------------------------------------------------------------------------------------\n",
       "\n",
       "REGRESSION DIAGNOSTICS\n",
@@ -498,54 +606,54 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 14,
+   "execution_count": 16,
    "metadata": {
-    "collapsed": true
+    "collapsed": false
    },
    "outputs": [],
    "source": [
-    "y = dbf.by_col_array(['CRIME'])\n",
-    "X = dbf.by_col_array(['INC'])\n",
-    "yend = dbf.by_col_array(['HOVAL'])\n",
-    "q = dbf.by_col_array(['DISCBD'])"
+    "y = dbf[['CRIME']].values\n",
+    "X = dbf[['INC']].values\n",
+    "yend = dbf[['HOVAL']].values\n",
+    "q = dbf[['DISCBD']].values"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 15,
+   "execution_count": 17,
    "metadata": {
     "collapsed": false
    },
    "outputs": [],
    "source": [
-    "tsls = ps.spreg.TSLS(y,X,yend,q,W)"
+    "tsls = ps.spreg.TSLS(y,X,yend=yend,q=q,w=W)"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 16,
+   "execution_count": 18,
    "metadata": {
     "collapsed": true
    },
    "outputs": [],
    "source": [
-    "handledtsls = h.Model(y,X,yend,q,W,mtype='TSLS')"
+    "handledtsls = h.Model(y,X,yend=yend,q=q,w=W,mtype='TSLS')"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 17,
+   "execution_count": 19,
    "metadata": {
     "collapsed": false
    },
    "outputs": [],
    "source": [
-    "handledtsls_eq = h.Model(\"CRIME ~ INC || HOVAL ~ DISCBD\", W, data=df, mtype='TSLS')"
+    "handledtsls_eq = h.Model(\"CRIME ~ INC || HOVAL ~ DISCBD\", w=W, data=df, mtype='TSLS')"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 18,
+   "execution_count": 22,
    "metadata": {
     "collapsed": false
    },
@@ -569,8 +677,8 @@
       "            Variable     Coefficient       Std.Error     z-Statistic     Probability\n",
       "------------------------------------------------------------------------------------\n",
       "            CONSTANT      88.4657958      15.1346096       5.8452645       0.0000000\n",
-      "        endogenous_1      -1.5821659       0.7931892      -1.9946891       0.0460768\n",
       "               var_1       0.5200379       1.4146781       0.3676016       0.7131703\n",
+      "        endogenous_1      -1.5821659       0.7931892      -1.9946891       0.0460768\n",
       "------------------------------------------------------------------------------------\n",
       "Instrumented: endogenous_1\n",
       "Instruments: instrument_1\n",
@@ -584,7 +692,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 19,
+   "execution_count": 23,
    "metadata": {
     "collapsed": false
    },
@@ -608,8 +716,8 @@
       "            Variable     Coefficient       Std.Error     z-Statistic     Probability\n",
       "------------------------------------------------------------------------------------\n",
       "            CONSTANT      88.4657958      15.1346096       5.8452645       0.0000000\n",
-      "        endogenous_1      -1.5821659       0.7931892      -1.9946891       0.0460768\n",
       "               var_1       0.5200379       1.4146781       0.3676016       0.7131703\n",
+      "        endogenous_1      -1.5821659       0.7931892      -1.9946891       0.0460768\n",
       "------------------------------------------------------------------------------------\n",
       "Instrumented: endogenous_1\n",
       "Instruments: instrument_1\n",
@@ -623,7 +731,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 20,
+   "execution_count": 24,
    "metadata": {
     "collapsed": false
    },
@@ -638,7 +746,7 @@
       "------------------------------------------\n",
       "Data set            :     unknown\n",
       "Weights matrix      :     unknown\n",
-      "Dependent Variable  :     dep_var                Number of Observations:          49\n",
+      "Dependent Variable  :      CRIME                 Number of Observations:          49\n",
       "Mean dependent var  :     35.1288                Number of Variables   :           3\n",
       "S.D. dependent var  :     16.7321                Degrees of Freedom    :          46\n",
       "Pseudo R-squared    :      0.2794\n",
@@ -647,11 +755,11 @@
       "            Variable     Coefficient       Std.Error     z-Statistic     Probability\n",
       "------------------------------------------------------------------------------------\n",
       "            CONSTANT      88.4657958      15.1346096       5.8452645       0.0000000\n",
-      "        endogenous_1      -1.5821659       0.7931892      -1.9946891       0.0460768\n",
-      "               var_1       0.5200379       1.4146781       0.3676016       0.7131703\n",
+      "                 INC       0.5200379       1.4146781       0.3676016       0.7131703\n",
+      "              HOVAL       -1.5821659       0.7931892      -1.9946891       0.0460768\n",
       "------------------------------------------------------------------------------------\n",
-      "Instrumented: endogenous_1\n",
-      "Instruments: instrument_1\n",
+      "Instrumented: HOVAL\n",
+      "Instruments:  DISCBD\n",
       "================================ END OF REPORT =====================================\n"
      ]
     }
@@ -666,144 +774,6 @@
    "source": [
     "This would also enable adding plotting capabilities to spatial regression models, like the standard four-plot output from plotting an `lm` in `R`, but wouldn't have to be hacked into each and every model class. "
    ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "# Pitfalls"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "This wrapper is neat, but could lead us down a weird road.\n",
-    "\n",
-    "Right now, I clean up the mandatory arguments tuple `*args` such that only the arguments that match the type signature needed by PySAL get passed. This is to prevent runtime errors.\n",
-    "\n",
-    "To explain, let some function be defined using the default Python argument expansion (a.k.a. splatting) operator, `*`:\n",
-    "\n",
-    "        def foo(*args, message='Hello'):\n",
-    "            for arg in args:\n",
-    "                print(message + args)\n",
-    "        \n",
-    "        >>> foo(\"world!\", \"users!\")\n",
-    "        Hello world!\n",
-    "        Hello users!\n",
-    "        \n",
-    "Cool. Now, let's say we want to print our message right before we execute some function, `bar`. `bar` is a model class with a well-defined API. It requires two positional arguments of type `ndarray`, `y` and `X`, can accept an arbitrary number of keyword arguments, and returns `True` if a model is fit correctly. \n",
-    "\n",
-    "For the sake of argument (no pun intended), let's say that `foo` only needs the strings passed as positional arguments. Depending on your python version, we can wrap `bar` with `foo` this way:\n",
-    "\n",
-    "        def foo(*args, message='Hello', **kwargs):\n",
-    "            strargs = [arg for arg in args if isinstance(args, str)]\n",
-    "            barargs = [arg for arg in args if arg not in strargs]\n",
-    "            for arg in args:\n",
-    "                print(message + arg)\n",
-    "            return bar(*args, **kwargs)\n",
-    "            \n",
-    "If we do this, arbitrary arguments could get passed to `foo` that, if `bar` isn't expecting them, will cause a `TypeError`. \n",
-    "\n",
-    "        >>> foo(\"world!\", \"users!\", 12313, y, X)\n",
-    "        Hello world!\n",
-    "        Hello users!\n",
-    "        -------------------------------------------\n",
-    "        TypeError\n",
-    "        return bar(*args, **kwargs)\n",
-    "        \n",
-    "        TypeError: bar() takes exactly 2 arguments (3 given)\n",
-    " \n",
-    "Some libraries (*ahem* Matplotlib) get around this by making almost every function take arbitrary arguments, and each function just peels off of `args` and `kwargs` what it needs. \n",
-    "\n",
-    "This isn't us, though. I would suggest that the standard be that we use input types or ordering of arguments to define how to wrap the underlying functions. This means that, if we know `bar` accepts a `y` and an `X` of type `ndarray` in that order, we pop off of a stack of arguments with the current scope's arguments at the top of the stack.\n",
-    "\n",
-    "Here, since we know that we're wrapping one function with two arguments, its arguments are at the bottom of the stack. \n",
-    "\n",
-    "        def foo(*args, message=\"Hello\", **kwargs):\n",
-    "            args.pop() = X\n",
-    "            args.pop() = y\n",
-    "            for arg in args:\n",
-    "                print(message + arg)\n",
-    "            return bar(y, X, **kwargs)\n",
-    "       \n",
-    "        >>> foo(\"world!\", \"users!\", y, X)\n",
-    "        Hello world!\n",
-    "        Hello users!\n",
-    "        True #model fit successfully\n",
-    "        \n",
-    "Of course, we could also get even more abstract. We could construct a list of arguments for the wrapped function based on the *types* expected by that function. If we can identify or construct subsequences of *args* that match the function we're wrapping, we're good to go. \n",
-    "\n",
-    "However, these strategies have the strange side effect that, if extra arguments are passed, no error is raised. This could be desirable, but may not be if the user expects the arguments to **do** something. \n",
-    "\n",
-    "The call with ignored arguments looks like this:"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 21,
-   "metadata": {
-    "collapsed": true
-   },
-   "outputs": [],
-   "source": [
-    "handledtsls_ignored = h.Model(\"CRIME ~ INC || HOVAL ~ DISCBD\",\n",
-    "                              True, #gets ignored\n",
-    "                              W, \n",
-    "                              42, #gets ignored too\n",
-    "                              data=df, \n",
-    "                              mtype='GM_Lag')"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 22,
-   "metadata": {
-    "collapsed": false
-   },
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "REGRESSION\n",
-      "----------\n",
-      "SUMMARY OF OUTPUT: SPATIAL TWO STAGE LEAST SQUARES\n",
-      "--------------------------------------------------\n",
-      "Data set            :     unknown\n",
-      "Weights matrix      :     unknown\n",
-      "Dependent Variable  :     dep_var                Number of Observations:          49\n",
-      "Mean dependent var  :     35.1288                Number of Variables   :           4\n",
-      "S.D. dependent var  :     16.7321                Degrees of Freedom    :          45\n",
-      "Pseudo R-squared    :      0.2377\n",
-      "Spatial Pseudo R-squared:  0.2477\n",
-      "\n",
-      "------------------------------------------------------------------------------------\n",
-      "            Variable     Coefficient       Std.Error     z-Statistic     Probability\n",
-      "------------------------------------------------------------------------------------\n",
-      "            CONSTANT      96.5182979      52.5305917       1.8373731       0.0661548\n",
-      "           W_dep_var      -0.0148182       0.0857203      -0.1728667       0.8627562\n",
-      "        endogenous_1      -1.8097627       1.7652028      -1.0252436       0.3052483\n",
-      "               var_1       0.7561942       2.3367036       0.3236158       0.7462289\n",
-      "------------------------------------------------------------------------------------\n",
-      "Instrumented: W_dep_var, endogenous_1\n",
-      "Instruments: W_instrument_1, W_var_1, instrument_1\n",
-      "================================ END OF REPORT =====================================\n"
-     ]
-    }
-   ],
-   "source": [
-    "print(handledtsls_ignored.summary) #woah! no error or notice!"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Those other positional arguments get ignored in the equation framework. \n",
-    "\n",
-    "Practically, this means you couldn't provide some variables in equations and some in vectors... you'd have to either have equations or vectors."
-   ]
   }
  ],
  "metadata": {
@@ -822,7 +792,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython2",
-   "version": "2.7.10"
+   "version": "2.7.11"
   }
  },
  "nbformat": 4,
diff --git a/pysal/contrib/handler/handler.py b/pysal/contrib/handler/handler.py
index bb1f08c..896ca7e 100644
--- a/pysal/contrib/handler/handler.py
+++ b/pysal/contrib/handler/handler.py
@@ -1,12 +1,13 @@
 import copy
-import registry as sr
+from registry import user as mr, clstypes 
 from pysal.weights import W
 try:
     import patsy as p
 except:
     p = None
 from numpy import array, ndarray, asarray
-from six import iteritems as diter
+from pysal.common import iteritems as diter
+import inspect
 
 #would like to just wrap this in the opt decorator...
 def pandashandler(formula_like, data):
@@ -20,11 +21,24 @@ def pandashandler(formula_like, data):
         yend, q  = p.dmatrices(inst + '-1', data=data)
         rargs = [y,X,yend,q]
         rargs = [asarray(i) for i in rargs]
+        name_y, name_x = mu.strip(' ').split('~')
+        name_x = name_x.split('+')
+        name_yend, name_q = inst.strip(' ').split('~')
+        name_yend = [name_yend]
+        name_q = name_q.split('+')
+        names = {"name_y":name_y,
+                 "name_x":name_x, 
+                 "name_yend":name_yend,
+                 "name_q":name_q}
     else:
         y, X = p.dmatrices(formula_like + '-1', data=data)
         rargs = [asarray(y), asarray(X)]
+        name_y, name_x = formula_like.strip(' ').split('~')
+        name_x = name_x.split('+')
+        names = {"name_y":name_y,
+                 "name_x":name_x}
 
-    return rargs
+    return rargs, names
 
 #def model(eqn, *args, data=df, **kwargs)
 class Model(object):
@@ -43,36 +57,67 @@ class Model(object):
         >>> Model(y,X,W, mytpe='OLS_Regimes')
     """
     def __init__(self, *args, **kwargs):
-        self._cache = {}
+        self._outers = {}
         mtype = kwargs.pop('mtype', 'OLS')
-        self._mtype = mtype
-        self._mfunc = sr._everything[mtype] 
-        self._fit = kwargs.pop('fit', True)
+        if mtype.startswith('Base'):
+            raise Exception('Only Userclasses can be fit using the handler')
+        mtype = mtype
+        mfunc = mr.__dict__[mtype]
+        fit = kwargs.pop('fit', True)
+        ins = inspect.getargspec(mfunc.__init__)
+        req = len(ins.args) - (len(ins.defaults)+1 )
 
         if isinstance(args[0], str):
+            if len(args) > 1:
+                raise TypeError('When a formula is used as the first argument,'
+                                ' all other arguments must be named. Consult {}'
+                                ' for argument names'.format(self._mfunc.__name__))
             formula = args[0]
             data = kwargs.pop('data')
-            matrices = pandashandler(formula, data)
+            matrices, names = pandashandler(formula, data)
+            kwargs.update(names)
         elif 'formula' in kwargs.keys() and 'data' in kwargs.keys():
             formula = kwargs.pop('formula')
             data = kwargs.pop('data')
-            matrices = pandashandler(formula, data)
+            matrices, names = pandashandler(formula, data)
+            kwargs.update(names)
         else:
-            matrices = [arg for arg in args if not isinstance(arg, W)]
-        
-        args = matrices + [arg for arg in args if isinstance(arg, W)]
-
-        if self._fit:
-            self._called = self._mfunc(*args, **kwargs)
-            for name in dir(self._called):
-                try:
-                    exec('self.{n} = self._called.{n}'.format(n=name))
-                except:
-                    print("Assigning {a} from {s} to {d} failed!".format(a=name,
-                                                                             s=self._called,
-                                                                         d=self))
+            matrices = list(args[0:req])
+
+        if fit:
+            self._called = mfunc(*matrices, **kwargs)
+            self._fit = True
+        else:
+            self._outers['mtype'] = mtype
+            self._outers['mfunc'] = mfunc
+            self._fit = False
+    
+    @property
+    def __dict__(self):
+        inners = self._called.__dict__
+        obligations = [x for x in dir(self._mfunc) if not x.startswith('_')]
+        obligations = {k:self._called.__getattribute__(k) for k in obligations}
+        outers = self._outers
+        alldict = dict()
+        alldict.update(inners)
+        alldict.update(obligations)
+        alldict.update(outers)
+        return alldict
     
-#need to still pass names down from formula into relevant pysal arguments
+    @__dict__.setter
+    def __dict__(self, key, val):
+        self._outers[key] = val
+
+    @property
+    def _mfunc(self):
+        return type(self._called)
+    
+    @property
+    def _mtype(self):
+        return type(self._called).__name__
+
+    def __getattr__(self, val):
+        return self._called.__getattribute__(val)
 
 if __name__ == '__main__':
     import pysal as ps
@@ -80,17 +125,17 @@ if __name__ == '__main__':
     dbf = ps.open(ps.examples.get_path('columbus.dbf'))
     y, X = dbf.by_col_array(['HOVAL']), dbf.by_col_array(['INC', 'CRIME'])
     Wcol = ps.open(ps.examples.get_path('columbus.gal')).read()
-    mod1 = sr.OLS(y,X)
+    mod1 = mr.OLS(y,X)
     hmod1 = Model(y,X)
 
-    mod2 = sr.OLS(y,X,Wcol)
-    hmod2 = Model(y,X,Wcol)
+    mod2 = mr.OLS(y,X,w=Wcol, spat_diag=True, moran=True)
+    hmod2 = Model(y,X,w=Wcol, spat_diag=True, moran=True)
 
-    mod3 = sr.ML_Lag(y,X,Wcol)
+    mod3 = mr.ML_Lag(y,X,Wcol)
     hmod3 = Model(y,X,Wcol, mtype='ML_Lag')
 
-    mod4 = sr.ML_Error(y,X,Wcol)
-    hmod4 = Model(y,X,Wcol,mtype='ML_Error')
+    mod4 = mr.ML_Error(y,X,Wcol)
+    hmod4 = Model(y,X,w=Wcol,mtype='ML_Error')
 
     #real power comes from this, though
 #    import geopandas as gpd
diff --git a/pysal/contrib/handler/registry.py b/pysal/contrib/handler/registry.py
index 8f25f89..5243652 100644
--- a/pysal/contrib/handler/registry.py
+++ b/pysal/contrib/handler/registry.py
@@ -1,18 +1,25 @@
 import pysal
-from types import ModuleType, ClassType
-from six import iteritems as diter
+import types as ty
+import sys
+
+PY3 = sys.version_info.major > 2
+from pysal.common import iteritems as diter
+
+if not PY3:
+    clstypes = (type, ty.ClassType)
+else:
+    clstypes = type
 
 def _find_bcs():
     classes = dict()
     bcs = dict()
     ucs = dict()
     submods = dict()
-    for obname in dir(pysal.spreg):
-        ob = pysal.spreg.__dict__[obname]
-        if isinstance(ob, ModuleType):
+    for obname, ob in diter(pysal.spreg.__dict__):
+        if isinstance(ob, ty.ModuleType):
             if ob.__package__.startswith("pysal"):
                 submods.update({obname:ob})
-        elif isinstance(ob, ClassType):
+        elif isinstance(ob, clstypes):
             classes.update({obname:ob})
             if ob.__name__.startswith('Base'):
                 bcs.update({obname:ob})
@@ -20,7 +27,7 @@ def _find_bcs():
         basecands = dict()
         for clname in dir(mod):
             cl = mod.__dict__[clname]
-            if isinstance(cl, ClassType):
+            if isinstance(cl, clstypes):
                 try:
                     if cl.__name__.startswith('Base'):
                         if cl not in bcs:
@@ -35,19 +42,15 @@ def _find_bcs():
                 or k.endswith('Regimes')})
     return bcs, ucs
 
-base, user = _find_bcs()
-_everything = base.copy()
-_everything.update(user)
+class Namespace:
+    def __init__(self, **kwargs):
+        self.__dict__.update(kwargs)
 
-for k,v in diter(base):
-    exec('{k} = {v}'.format(k=k,v=v))
-for k,v in diter(user):
-    exec('{k} = {v}'.format(k=k,v=v))
-
-__all__ = list()
-__all__.extend(base.keys())
-__all__.extend(user.keys())
-#regimes = {cls for cls in user if 'regimes' in cls.__module__}
+base, user = _find_bcs()
+base = Namespace(**base)
+user = Namespace(**user)
+everything = Namespace(**base.__dict__)
+everything.__dict__.update(user.__dict__)
 
 #if we go with something like a "base" and "user" submodule setup,
 #it'd be as simple as flattening the subclasses out into those submodules. 
diff --git a/pysal/contrib/handler/tests/test_error_sp.py b/pysal/contrib/handler/tests/test_error_sp.py
index 9486e1f..baf77f2 100644
--- a/pysal/contrib/handler/tests/test_error_sp.py
+++ b/pysal/contrib/handler/tests/test_error_sp.py
@@ -5,57 +5,12 @@ import numpy as np
 from pysal.spreg import error_sp as SP
 from pysal.contrib.handler import Model
 from functools import partial
-BaseGM_Error = partial(Model, mtype='BaseGM_Error')
 GM_Error = partial(Model, mtype='GM_Error')
 
-BaseGM_Endog_Error = partial(Model, mtype='BaseGM_Endog_Error')
 GM_Endog_Error = partial(Model, mtype='GM_Endog_Error')
 
-BaseGM_Combo = partial(Model, mtype='BaseGM_Combo')
 GM_Combo = partial(Model, mtype='GM_Combo')
 
-class TestBaseGMError(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        X.append(db.by_col("CRIME"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        reg = BaseGM_Error(self.y, self.X, self.w.sparse)
-        betas = np.array([[ 47.94371455], [  0.70598088], [ -0.55571746], [  0.37230161]])
-        np.testing.assert_allclose(reg.betas,betas,4)
-        u = np.array([ 27.4739775])
-        np.testing.assert_allclose(reg.u[0],u,4)
-        predy = np.array([ 52.9930255])
-        np.testing.assert_allclose(reg.predy[0],predy,4)
-        n = 49
-        np.testing.assert_allclose(reg.n,n,4)
-        k = 3
-        np.testing.assert_allclose(reg.k,k,4)
-        y = np.array([ 80.467003])
-        np.testing.assert_allclose(reg.y[0],y,4)
-        x = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_allclose(reg.x[0],x,4)
-        e = np.array([ 31.89620319])
-        np.testing.assert_allclose(reg.e_filtered[0],e,4)
-        predy = np.array([ 52.9930255])
-        np.testing.assert_allclose(reg.predy[0],predy,4)
-        my = 38.43622446938776
-        np.testing.assert_allclose(reg.mean_y,my)
-        sy = 18.466069465206047
-        np.testing.assert_allclose(reg.std_y,sy)
-        vm = np.array([[  1.51884943e+02,  -5.37622793e+00,  -1.86970286e+00], [ -5.37622793e+00,   2.48972661e-01,   5.26564244e-02], [ -1.86970286e+00,   5.26564244e-02, 3.18930650e-02]])
-        np.testing.assert_allclose(reg.vm,vm,4)
-        sig2 = 191.73716465732355
-        np.testing.assert_allclose(reg.sig2,sig2,4)
-
 class TestGMError(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -105,61 +60,6 @@ class TestGMError(unittest.TestCase):
 
 @unittest.skipIf(int(scipy.__version__.split(".")[1]) < 11,
 "Maximum Likelihood requires SciPy version 11 or newer.")
-class TestBaseGMEndogError(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        yd = []
-        yd.append(db.by_col("CRIME"))
-        self.yd = np.array(yd).T
-        q = []
-        q.append(db.by_col("DISCBD"))
-        self.q = np.array(q).T
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        reg = BaseGM_Endog_Error(self.y, self.X, self.yd, self.q, self.w.sparse)
-        betas = np.array([[ 55.36095292], [  0.46411479], [ -0.66883535], [  0.38989939]])
-        np.testing.assert_allclose(reg.betas,betas,4)
-        u = np.array([ 26.55951566])
-        np.testing.assert_allclose(reg.u[0],u,4)
-        e = np.array([ 31.23925425])
-        np.testing.assert_allclose(reg.e_filtered[0],e,4)
-        predy = np.array([ 53.9074875])
-        np.testing.assert_allclose(reg.predy[0],predy,4)
-        n = 49
-        np.testing.assert_allclose(reg.n,n)
-        k = 3
-        np.testing.assert_allclose(reg.k,k)
-        y = np.array([ 80.467003])
-        np.testing.assert_allclose(reg.y[0],y,4)
-        x = np.array([  1.   ,  19.531])
-        np.testing.assert_allclose(reg.x[0],x,4)
-        yend = np.array([  15.72598])
-        np.testing.assert_allclose(reg.yend[0],yend,4)
-        z = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_allclose(reg.z[0],z,4)
-        my = 38.43622446938776
-        np.testing.assert_allclose(reg.mean_y,my)
-        #std_y
-        sy = 18.466069465206047
-        np.testing.assert_allclose(reg.std_y,sy)
-        #vm
-        vm = np.array([[  5.29158422e+02,  -1.57833675e+01,  -8.38021080e+00],
-       [ -1.57833675e+01,   5.40235041e-01,   2.31120327e-01],
-       [ -8.38021080e+00,   2.31120327e-01,   1.44977385e-01]])
-        np.testing.assert_allclose(reg.vm,vm,4)
-        sig2 = 192.50022721929574
-        np.testing.assert_allclose(reg.sig2,sig2,4)
-
- at unittest.skipIf(int(scipy.__version__.split(".")[1]) < 11,
-"Maximum Likelihood requires SciPy version 11 or newer.")
 class TestGMEndogError(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -218,55 +118,6 @@ class TestGMEndogError(unittest.TestCase):
 
 @unittest.skipIf(int(scipy.__version__.split(".")[1]) < 11,
 "Maximum Likelihood requires SciPy version 11 or newer.")
-class TestBaseGMCombo(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        X.append(db.by_col("CRIME"))
-        self.X = np.array(X).T
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        # Only spatial lag
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, 1, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        reg = BaseGM_Combo(self.y, self.X, yend=yd2, q=q2, w=self.w.sparse)
-        betas = np.array([[ 57.61123461],[  0.73441314], [ -0.59459416], [ -0.21762921], [  0.54732051]])
-        np.testing.assert_allclose(reg.betas,betas,4)
-        u = np.array([ 25.57932637])
-        np.testing.assert_allclose(reg.u[0],u,4)
-        e_filtered = np.array([ 31.65374945])
-        np.testing.assert_allclose(reg.e_filtered[0],e_filtered,4)
-        predy = np.array([ 54.88767663])
-        np.testing.assert_allclose(reg.predy[0],predy,4)
-        n = 49
-        np.testing.assert_allclose(reg.n,n)
-        k = 4
-        np.testing.assert_allclose(reg.k,k)
-        y = np.array([ 80.467003])
-        np.testing.assert_allclose(reg.y[0],y,4)
-        x = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_allclose(reg.x[0],x,4)
-        yend = np.array([  35.4585005])
-        np.testing.assert_allclose(reg.yend[0],yend,4)
-        z = np.array([  1.       ,  19.531    ,  15.72598  ,  35.4585005])
-        np.testing.assert_allclose(reg.z[0],z,4)
-        my = 38.43622446938776
-        np.testing.assert_allclose(reg.mean_y,my)
-        sy = 18.466069465206047
-        np.testing.assert_allclose(reg.std_y,sy)
-        vm = np.array([  5.22438365e+02,   2.38012873e-01,   3.20924172e-02,
-         2.15753599e-01])
-        np.testing.assert_allclose(np.diag(reg.vm),vm,4)
-        sig2 = 181.78650186468832
-        np.testing.assert_allclose(reg.sig2,sig2,4)
-
- at unittest.skipIf(int(scipy.__version__.split(".")[1]) < 11,
-"Maximum Likelihood requires SciPy version 11 or newer.")
 class TestGMCombo(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
diff --git a/pysal/contrib/handler/tests/test_error_sp_regimes.py b/pysal/contrib/handler/tests/test_error_sp_regimes.py
index 5affcaf..b3cc279 100644
--- a/pysal/contrib/handler/tests/test_error_sp_regimes.py
+++ b/pysal/contrib/handler/tests/test_error_sp_regimes.py
@@ -225,7 +225,8 @@ class TestGM_Error_Regimes(unittest.TestCase):
         np.testing.assert_array_almost_equal(model.vm.diagonal(), vm, 4)
 
     def test_model_combo(self):
-        reg = GM_Combo_Regimes(self.y, self.X1, self.regimes, self.yd, self.q, w=self.w)
+        reg = GM_Combo_Regimes(self.y, self.X1, self.regimes, 
+                               yend=self.yd, q=self.q, w=self.w)
         predy_e = np.array([ 18.82774339])
         np.testing.assert_array_almost_equal(reg.predy_e[0],predy_e,4)
         betas = np.array([[ 36.44798052],
@@ -281,7 +282,9 @@ class TestGM_Error_Regimes(unittest.TestCase):
 
     def test_model_combo_regi_error(self):
         #Columbus:
-        reg = GM_Combo_Regimes(self.y, self.X1, self.regimes, self.yd, self.q, w=self.w, regime_lag_sep=True, regime_err_sep=True)
+        reg = GM_Combo_Regimes(self.y, self.X1, self.regimes, 
+                               yend=self.yd, q=self.q, w=self.w, 
+                               regime_lag_sep=True, regime_err_sep=True)
         betas = np.array([[ 42.01035248],
        [ -0.13938772],
        [ -0.6528306 ],
diff --git a/pysal/contrib/handler/tests/test_error_sp_sparse.py b/pysal/contrib/handler/tests/test_error_sp_sparse.py
index fb59ab6..c4800f1 100644
--- a/pysal/contrib/handler/tests/test_error_sp_sparse.py
+++ b/pysal/contrib/handler/tests/test_error_sp_sparse.py
@@ -11,52 +11,6 @@ from pysal.contrib.handler import Model
 GM_Error = partial(Model, mtype='GM_Error')
 GM_Endog_Error = partial(Model, mtype='GM_Endog_Error')
 GM_Combo = partial(Model, mtype='GM_Combo')
-BaseGM_Error = partial(Model, mtype='BaseGM_Error')
-BaseGM_Endog_Error = partial(Model, mtype='BaseGM_Endog_Error')
-BaseGM_Combo = partial(Model, mtype='BaseGM_Combo')
-
-class TestBaseGMError(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        X.append(db.by_col("CRIME"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = sparse.csr_matrix(self.X)
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        reg = BaseGM_Error(self.y, self.X, self.w.sparse)
-        betas = np.array([[ 47.94371455], [  0.70598088], [ -0.55571746], [  0.37230161]])
-        np.allclose(reg.betas,betas,4)
-        u = np.array([ 27.4739775])
-        np.allclose(reg.u[0],u,4)
-        predy = np.array([ 52.9930255])
-        np.allclose(reg.predy[0],predy,4)
-        n = 49
-        np.allclose(reg.n,n,4)
-        k = 3
-        np.allclose(reg.k,k,4)
-        y = np.array([ 80.467003])
-        np.allclose(reg.y[0],y,4)
-        x = np.array([  1.     ,  19.531  ,  15.72598])
-        np.allclose(reg.x.toarray()[0],x,4)
-        e = np.array([ 31.89620319])
-        np.allclose(reg.e_filtered[0],e,4)
-        predy = np.array([ 52.9930255])
-        np.allclose(reg.predy[0],predy,4)
-        my = 38.43622446938776
-        np.allclose(reg.mean_y,my)
-        sy = 18.466069465206047
-        np.allclose(reg.std_y,sy)
-        vm = np.array([[  1.51884943e+02,  -5.37622793e+00,  -1.86970286e+00], [ -5.37622793e+00,   2.48972661e-01,   5.26564244e-02], [ -1.86970286e+00,   5.26564244e-02, 3.18930650e-02]])
-        np.allclose(reg.vm,vm,4)
-        sig2 = 191.73716465732355
-        np.allclose(reg.sig2,sig2,4)
 
 class TestGMError(unittest.TestCase):
     def setUp(self):
@@ -108,62 +62,6 @@ class TestGMError(unittest.TestCase):
 
 @unittest.skipIf(int(scipy.__version__.split(".")[1]) < 11,
 "Maximum Likelihood requires SciPy version 11 or newer.")
-class TestBaseGMEndogError(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = sparse.csr_matrix(self.X)
-        yd = []
-        yd.append(db.by_col("CRIME"))
-        self.yd = np.array(yd).T
-        q = []
-        q.append(db.by_col("DISCBD"))
-        self.q = np.array(q).T
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        reg = BaseGM_Endog_Error(self.y, self.X, self.yd, self.q, self.w.sparse)
-        betas = np.array([[ 55.36095292], [  0.46411479], [ -0.66883535], [  0.38989939]])
-        np.allclose(reg.betas,betas,4)
-        u = np.array([ 26.55951566])
-        np.allclose(reg.u[0],u,4)
-        e = np.array([ 31.23925425])
-        np.allclose(reg.e_filtered[0],e,4)
-        predy = np.array([ 53.9074875])
-        np.allclose(reg.predy[0],predy,4)
-        n = 49
-        np.allclose(reg.n,n)
-        k = 3
-        np.allclose(reg.k,k)
-        y = np.array([ 80.467003])
-        np.allclose(reg.y[0],y,4)
-        x = np.array([  1.   ,  19.531])
-        np.allclose(reg.x.toarray()[0],x,4)
-        yend = np.array([  15.72598])
-        np.allclose(reg.yend[0],yend,4)
-        z = np.array([  1.     ,  19.531  ,  15.72598])
-        np.allclose(reg.z.toarray()[0],z,4)
-        my = 38.43622446938776
-        np.allclose(reg.mean_y,my)
-        #std_y
-        sy = 18.466069465206047
-        np.allclose(reg.std_y,sy)
-        #vm
-        vm = np.array([[ 529.15840986,  -15.78336736,   -8.38021053],
-       [ -15.78336736,    0.54023504,    0.23112032],
-       [  -8.38021053,    0.23112032,    0.14497738]])
-        np.allclose(reg.vm,vm,4)
-        sig2 = 192.5002
-        np.allclose(round(reg.sig2,4),round(sig2,4),4)
-
- at unittest.skipIf(int(scipy.__version__.split(".")[1]) < 11,
-"Maximum Likelihood requires SciPy version 11 or newer.")
 class TestGMEndogError(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -223,58 +121,6 @@ class TestGMEndogError(unittest.TestCase):
 
 @unittest.skipIf(int(scipy.__version__.split(".")[1]) < 11,
 "Maximum Likelihood requires SciPy version 11 or newer.")
-class TestBaseGMCombo(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        X.append(db.by_col("CRIME"))
-        self.X = np.array(X).T
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        # Only spatial lag
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, 1, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = sparse.csr_matrix(self.X)
-        reg = BaseGM_Combo(self.y, self.X, yend=yd2, q=q2, w=self.w.sparse)
-        betas = np.array([[ 57.61123461],[  0.73441314], [ -0.59459416], [ -0.21762921], [  0.54732051]])
-        np.allclose(reg.betas,betas,4)
-        u = np.array([ 25.57932637])
-        np.allclose(reg.u[0],u,4)
-        e_filtered = np.array([ 31.65374945])
-        np.allclose(reg.e_filtered[0],e_filtered,4)
-        predy = np.array([ 54.88767663])
-        np.allclose(reg.predy[0],predy,4)
-        n = 49
-        np.allclose(reg.n,n)
-        k = 4
-        np.allclose(reg.k,k)
-        y = np.array([ 80.467003])
-        np.allclose(reg.y[0],y,4)
-        x = np.array([  1.     ,  19.531  ,  15.72598])
-        np.allclose(reg.x.toarray()[0],x,4)
-        yend = np.array([  35.4585005])
-        np.allclose(reg.yend[0],yend,4)
-        z = np.array([  1.       ,  19.531    ,  15.72598  ,  35.4585005])
-        np.allclose(reg.z.toarray()[0],z,4)
-        my = 38.43622446938776
-        np.allclose(reg.mean_y,my)
-        sy = 18.466069465206047
-        np.allclose(reg.std_y,sy)
-        vm = np.array([[ 522.43841148,   -6.07256915,   -1.91429117,   -8.97133162],
-       [  -6.07256915,    0.23801287,    0.0470161 ,    0.02809628],
-       [  -1.91429117,    0.0470161 ,    0.03209242,    0.00314973],
-       [  -8.97133162,    0.02809628,    0.00314973,    0.21575363]])
-        np.allclose(reg.vm,vm,4)
-        sig2 = 181.78650186468832
-        np.allclose(reg.sig2,sig2,4)
-
- at unittest.skipIf(int(scipy.__version__.split(".")[1]) < 11,
-"Maximum Likelihood requires SciPy version 11 or newer.")
 class TestGMCombo(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
diff --git a/pysal/contrib/handler/tests/test_error_spet.py b/pysal/contrib/handler/tests/test_error_spet.py
index 4b677ff..3ab4e22 100644
--- a/pysal/contrib/handler/tests/test_error_spet.py
+++ b/pysal/contrib/handler/tests/test_error_spet.py
@@ -5,65 +5,9 @@ from pysal.contrib.handler import Model
 from functools import partial
 
 GM_Combo_Het = partial(Model, mtype='GM_Combo_Het')
-BaseGM_Combo_Het = partial(Model, mtype='BaseGM_Combo_Het')
 GM_Error_Het = partial(Model, mtype='GM_Error_Het')
-BaseGM_Error_Het = partial(Model, mtype='BaseGM_Error_Het')
 GM_Endog_Error_Het = partial(Model, mtype='GM_Endog_Error_Het')
-BaseGM_Endog_Error_Het = partial(Model, mtype='BaseGM_Endog_Error_Het')
 
-class TestBaseGMErrorHet(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        X.append(db.by_col("CRIME"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        reg = BaseGM_Error_Het(self.y, self.X, self.w.sparse, step1c=True)
-        betas = np.array([[ 47.99626638], [  0.71048989], [ -0.55876126], [  0.41178776]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,7)
-        u = np.array([ 27.38122697])
-        np.testing.assert_array_almost_equal(reg.u[0],u,7)
-        ef = np.array([ 32.29765975])
-        np.testing.assert_array_almost_equal(reg.e_filtered[0],ef,7)
-        predy = np.array([ 53.08577603])
-        np.testing.assert_array_almost_equal(reg.predy[0],predy,7)
-        n = 49
-        self.assertAlmostEqual(reg.n,n)
-        k = 3
-        self.assertAlmostEqual(reg.k,k)
-        y = np.array([ 80.467003])
-        np.testing.assert_array_almost_equal(reg.y[0],y,7)
-        x = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_array_almost_equal(reg.x[0],x,7)
-        i_s = 'Maximum number of iterations reached.'
-        np.testing.assert_string_equal(reg.iter_stop,i_s)
-        its = 1
-        self.assertAlmostEqual(reg.iteration,its,7)
-        my = 38.436224469387746
-        self.assertAlmostEqual(reg.mean_y,my)
-        stdy = 18.466069465206047
-        self.assertAlmostEqual(reg.std_y,stdy)
-        vm = np.array([[  1.31767529e+02,  -3.58368748e+00,  -1.65090647e+00,
-              0.00000000e+00],
-           [ -3.58368748e+00,   1.35513711e-01,   3.77539055e-02,
-              0.00000000e+00],
-           [ -1.65090647e+00,   3.77539055e-02,   2.61042702e-02,
-              0.00000000e+00],
-           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-              2.82398517e-02]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        xtx = np.array([[  4.90000000e+01,   7.04371999e+02,   1.72131237e+03],
-           [  7.04371999e+02,   1.16866734e+04,   2.15575320e+04],
-           [  1.72131237e+03,   2.15575320e+04,   7.39058986e+04]])
-        np.testing.assert_array_almost_equal(reg.xtx,xtx,4)
-             
 class TestGMErrorHet(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -125,72 +69,6 @@ class TestGMErrorHet(unittest.TestCase):
            [  1.72131237e+03,   2.15575320e+04,   7.39058986e+04]])
         np.testing.assert_array_almost_equal(reg.xtx,xtx,4)
 
-class TestBaseGMEndogErrorHet(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        yd = []
-        yd.append(db.by_col("CRIME"))
-        self.yd = np.array(yd).T
-        q = []
-        q.append(db.by_col("DISCBD"))
-        self.q = np.array(q).T
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        reg = BaseGM_Endog_Error_Het(self.y, self.X, self.yd, self.q, self.w.sparse, step1c=True)
-        betas = np.array([[ 55.39707924], [  0.46563046], [ -0.67038326], [  0.41135023]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,7)
-        u = np.array([ 26.51812895])
-        np.testing.assert_array_almost_equal(reg.u[0],u,7)
-        ef = np.array([ 31.46604707])
-        np.testing.assert_array_almost_equal(reg.e_filtered[0],ef,7)
-        predy = np.array([ 53.94887405])
-        np.testing.assert_array_almost_equal(reg.predy[0],predy,7)
-        n = 49
-        self.assertAlmostEqual(reg.n,n)
-        k = 3
-        self.assertAlmostEqual(reg.k,k)
-        y = np.array([ 80.467003])
-        np.testing.assert_array_almost_equal(reg.y[0],y,7)
-        x = np.array([  1.   ,  19.531])
-        np.testing.assert_array_almost_equal(reg.x[0],x,7)
-        yend = np.array([ 15.72598])
-        np.testing.assert_array_almost_equal(reg.yend[0],yend,7)
-        q = np.array([ 5.03])
-        np.testing.assert_array_almost_equal(reg.q[0],q,7)
-        z = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_array_almost_equal(reg.z[0],z,7)
-        h = np.array([  1.   ,  19.531,   5.03 ])
-        np.testing.assert_array_almost_equal(reg.h[0],h,7)
-        i_s = 'Maximum number of iterations reached.'
-        np.testing.assert_string_equal(reg.iter_stop,i_s)
-        its = 1
-        self.assertAlmostEqual(reg.iteration,its,7)
-        my = 38.436224469387746
-        self.assertAlmostEqual(reg.mean_y,my)
-        stdy = 18.466069465206047
-        self.assertAlmostEqual(reg.std_y,stdy)
-        vm = np.array([[  8.34637805e+02,  -2.16932259e+01,  -1.33327894e+01,
-                  1.65840848e+00],
-               [ -2.16932259e+01,   5.97683070e-01,   3.39503523e-01,
-                 -3.90111107e-02],
-               [ -1.33327894e+01,   3.39503523e-01,   2.19008080e-01,
-                 -2.81929695e-02],
-               [  1.65840848e+00,  -3.90111107e-02,  -2.81929695e-02,
-                  3.15686105e-02]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        hth = np.array([[    49.        ,    704.371999  ,    139.75      ],
-               [   704.371999  ,  11686.67338121,   2246.12800625],
-               [   139.75      ,   2246.12800625,    498.5851    ]])
-        np.testing.assert_array_almost_equal(reg.hth,hth,6)
-        
 class TestGMEndogErrorHet(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -261,76 +139,6 @@ class TestGMEndogErrorHet(unittest.TestCase):
                [   139.75      ,   2246.12800625,    498.5851    ]])
         np.testing.assert_array_almost_equal(reg.hth,hth,6)
  
-class TestBaseGMComboHet(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        X.append(db.by_col("CRIME"))
-        self.X = np.array(X).T
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        # Only spatial lag
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, 1, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        reg = BaseGM_Combo_Het(self.y, self.X, yend=yd2, q=q2, w=self.w.sparse, step1c=True)
-        betas = np.array([[ 57.7778574 ], [  0.73034922], [ -0.59257362], [ -0.2230231 ], [  0.56636724]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,7)
-        u = np.array([ 25.65156033])
-        np.testing.assert_array_almost_equal(reg.u[0],u,7)
-        ef = np.array([ 31.87664403])
-        np.testing.assert_array_almost_equal(reg.e_filtered[0],ef,7)
-        predy = np.array([ 54.81544267])
-        np.testing.assert_array_almost_equal(reg.predy[0],predy,7)
-        n = 49
-        self.assertAlmostEqual(reg.n,n)
-        k = 4
-        self.assertAlmostEqual(reg.k,k)
-        y = np.array([ 80.467003])
-        np.testing.assert_array_almost_equal(reg.y[0],y,7)
-        x = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_array_almost_equal(reg.x[0],x,7)
-        yend = np.array([ 35.4585005])
-        np.testing.assert_array_almost_equal(reg.yend[0],yend,7)
-        q = np.array([ 18.594    ,  24.7142675])
-        np.testing.assert_array_almost_equal(reg.q[0],q,7)
-        z = np.array([  1.       ,  19.531    ,  15.72598  ,  35.4585005])
-        np.testing.assert_array_almost_equal(reg.z[0],z,7)
-        i_s = 'Maximum number of iterations reached.'
-        np.testing.assert_string_equal(reg.iter_stop,i_s)
-        its = 1
-        self.assertAlmostEqual(reg.iteration,its,7)
-        my = 38.436224469387746
-        self.assertAlmostEqual(reg.mean_y,my)
-        stdy = 18.466069465206047
-        self.assertAlmostEqual(reg.std_y,stdy,7)
-        vm = np.array([[  4.86218274e+02,  -2.77268729e+00,  -1.59987770e+00,
-             -1.01969471e+01,   2.74302006e+00],
-           [ -2.77268729e+00,   1.04680972e-01,   2.51172238e-02,
-              1.95136385e-03,   3.70052723e-03],
-           [ -1.59987770e+00,   2.51172238e-02,   2.15655720e-02,
-              7.65868344e-03,  -7.30173070e-03],
-           [ -1.01969471e+01,   1.95136385e-03,   7.65868344e-03,
-              2.78273684e-01,  -6.89402590e-02],
-           [  2.74302006e+00,   3.70052723e-03,  -7.30173070e-03,
-             -6.89402590e-02,   7.12034037e-02]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        hth = np.array([[  4.90000000e+01,   7.04371999e+02,   1.72131237e+03,
-              7.24743592e+02,   1.70735413e+03],
-           [  7.04371999e+02,   1.16866734e+04,   2.15575320e+04,
-              1.10925200e+04,   2.23848036e+04],
-           [  1.72131237e+03,   2.15575320e+04,   7.39058986e+04,
-              2.34796298e+04,   6.70145378e+04],
-           [  7.24743592e+02,   1.10925200e+04,   2.34796298e+04,
-              1.16146226e+04,   2.30304624e+04],
-           [  1.70735413e+03,   2.23848036e+04,   6.70145378e+04,
-              2.30304624e+04,   6.69879858e+04]])
-        np.testing.assert_array_almost_equal(reg.hth,hth,4)
-
 class TestGMComboHet(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
diff --git a/pysal/contrib/handler/tests/test_error_spet_sparse.py b/pysal/contrib/handler/tests/test_error_spet_sparse.py
index 657f9c5..54c59de 100644
--- a/pysal/contrib/handler/tests/test_error_spet_sparse.py
+++ b/pysal/contrib/handler/tests/test_error_spet_sparse.py
@@ -10,64 +10,6 @@ GM_Error_Het = partial(Model, mtype='GM_Error_Het')
 GM_Endog_Error_Het = partial(Model, mtype='GM_Endog_Error_Het')
 GM_Combo_Het = partial(Model, mtype='GM_Combo_Het')
 
-BaseGM_Error_Het = partial(Model, mtype='BaseGM_Error_Het')
-BaseGM_Endog_Error_Het = partial(Model, mtype='BaseGM_Endog_Error_Het')
-BaseGM_Combo_Het = partial(Model, mtype='BaseGM_Combo_Het')
-
-class TestBaseGMErrorHet(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        X.append(db.by_col("CRIME"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = sparse.csr_matrix(self.X)
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        reg = BaseGM_Error_Het(self.y, self.X, self.w.sparse, step1c=True)
-        betas = np.array([[ 47.99626638], [  0.71048989], [ -0.55876126], [  0.41178776]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,7)
-        u = np.array([ 27.38122697])
-        np.testing.assert_array_almost_equal(reg.u[0],u,7)
-        ef = np.array([ 32.29765975])
-        np.testing.assert_array_almost_equal(reg.e_filtered[0],ef,7)
-        predy = np.array([ 53.08577603])
-        np.testing.assert_array_almost_equal(reg.predy[0],predy,7)
-        n = 49
-        self.assertAlmostEqual(reg.n,n)
-        k = 3
-        self.assertAlmostEqual(reg.k,k)
-        y = np.array([ 80.467003])
-        np.testing.assert_array_almost_equal(reg.y[0],y,7)
-        x = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_array_almost_equal(reg.x[0].toarray()[0],x,7)
-        i_s = 'Maximum number of iterations reached.'
-        np.testing.assert_string_equal(reg.iter_stop,i_s)
-        its = 1
-        self.assertAlmostEqual(reg.iteration,its,7)
-        my = 38.436224469387746
-        self.assertAlmostEqual(reg.mean_y,my)
-        stdy = 18.466069465206047
-        self.assertAlmostEqual(reg.std_y,stdy)
-        vm = np.array([[  1.31767529e+02,  -3.58368748e+00,  -1.65090647e+00,
-              0.00000000e+00],
-           [ -3.58368748e+00,   1.35513711e-01,   3.77539055e-02,
-              0.00000000e+00],
-           [ -1.65090647e+00,   3.77539055e-02,   2.61042702e-02,
-              0.00000000e+00],
-           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-              2.82398517e-02]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        xtx = np.array([[  4.90000000e+01,   7.04371999e+02,   1.72131237e+03],
-           [  7.04371999e+02,   1.16866734e+04,   2.15575320e+04],
-           [  1.72131237e+03,   2.15575320e+04,   7.39058986e+04]])
-        np.testing.assert_array_almost_equal(reg.xtx,xtx,4)
-             
 class TestGMErrorHet(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -130,73 +72,6 @@ class TestGMErrorHet(unittest.TestCase):
            [  1.72131237e+03,   2.15575320e+04,   7.39058986e+04]])
         np.testing.assert_array_almost_equal(reg.xtx,xtx,4)
 
-class TestBaseGMEndogErrorHet(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = sparse.csr_matrix(self.X)
-        yd = []
-        yd.append(db.by_col("CRIME"))
-        self.yd = np.array(yd).T
-        q = []
-        q.append(db.by_col("DISCBD"))
-        self.q = np.array(q).T
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        reg = BaseGM_Endog_Error_Het(self.y, self.X, self.yd, self.q, self.w.sparse, step1c=True)
-        betas = np.array([[ 55.39707924], [  0.46563046], [ -0.67038326], [  0.41135023]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,7)
-        u = np.array([ 26.51812895])
-        np.testing.assert_array_almost_equal(reg.u[0],u,7)
-        ef = np.array([ 31.46604707])
-        np.testing.assert_array_almost_equal(reg.e_filtered[0],ef,7)
-        predy = np.array([ 53.94887405])
-        np.testing.assert_array_almost_equal(reg.predy[0],predy,7)
-        n = 49
-        self.assertAlmostEqual(reg.n,n)
-        k = 3
-        self.assertAlmostEqual(reg.k,k)
-        y = np.array([ 80.467003])
-        np.testing.assert_array_almost_equal(reg.y[0],y,7)
-        x = np.array([  1.   ,  19.531])
-        np.testing.assert_array_almost_equal(reg.x[0].toarray()[0],x,7)
-        yend = np.array([ 15.72598])
-        np.testing.assert_array_almost_equal(reg.yend[0],yend,7)
-        q = np.array([ 5.03])
-        np.testing.assert_array_almost_equal(reg.q[0],q,7)
-        z = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_array_almost_equal(reg.z[0].toarray()[0],z,7)
-        h = np.array([  1.   ,  19.531,   5.03 ])
-        np.testing.assert_array_almost_equal(reg.h[0].toarray()[0],h,7)
-        i_s = 'Maximum number of iterations reached.'
-        np.testing.assert_string_equal(reg.iter_stop,i_s)
-        its = 1
-        self.assertAlmostEqual(reg.iteration,its,7)
-        my = 38.436224469387746
-        self.assertAlmostEqual(reg.mean_y,my)
-        stdy = 18.466069465206047
-        self.assertAlmostEqual(reg.std_y,stdy)
-        vm = np.array([[  8.34637805e+02,  -2.16932259e+01,  -1.33327894e+01,
-                  1.65840848e+00],
-               [ -2.16932259e+01,   5.97683070e-01,   3.39503523e-01,
-                 -3.90111107e-02],
-               [ -1.33327894e+01,   3.39503523e-01,   2.19008080e-01,
-                 -2.81929695e-02],
-               [  1.65840848e+00,  -3.90111107e-02,  -2.81929695e-02,
-                  3.15686105e-02]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        hth = np.array([[    49.        ,    704.371999  ,    139.75      ],
-               [   704.371999  ,  11686.67338121,   2246.12800625],
-               [   139.75      ,   2246.12800625,    498.5851    ]])
-        np.testing.assert_array_almost_equal(reg.hth,hth,6)
-        
 class TestGMEndogErrorHet(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -268,77 +143,6 @@ class TestGMEndogErrorHet(unittest.TestCase):
                [   139.75      ,   2246.12800625,    498.5851    ]])
         np.testing.assert_array_almost_equal(reg.hth,hth,6)
  
-class TestBaseGMComboHet(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        X.append(db.by_col("CRIME"))
-        self.X = np.array(X).T
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        # Only spatial lag
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, 1, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = sparse.csr_matrix(self.X)
-        reg = BaseGM_Combo_Het(self.y, self.X, yend=yd2, q=q2, w=self.w.sparse, step1c=True)
-        betas = np.array([[ 57.7778574 ], [  0.73034922], [ -0.59257362], [ -0.2230231 ], [  0.56636724]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,7)
-        u = np.array([ 25.65156033])
-        np.testing.assert_array_almost_equal(reg.u[0],u,7)
-        ef = np.array([ 31.87664403])
-        np.testing.assert_array_almost_equal(reg.e_filtered[0],ef,7)
-        predy = np.array([ 54.81544267])
-        np.testing.assert_array_almost_equal(reg.predy[0],predy,7)
-        n = 49
-        self.assertAlmostEqual(reg.n,n)
-        k = 4
-        self.assertAlmostEqual(reg.k,k)
-        y = np.array([ 80.467003])
-        np.testing.assert_array_almost_equal(reg.y[0],y,7)
-        x = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_array_almost_equal(reg.x[0].toarray()[0],x,7)
-        yend = np.array([ 35.4585005])
-        np.testing.assert_array_almost_equal(reg.yend[0],yend,7)
-        q = np.array([ 18.594    ,  24.7142675])
-        np.testing.assert_array_almost_equal(reg.q[0],q,7)
-        z = np.array([  1.       ,  19.531    ,  15.72598  ,  35.4585005])
-        np.testing.assert_array_almost_equal(reg.z[0].toarray()[0],z,7)
-        i_s = 'Maximum number of iterations reached.'
-        np.testing.assert_string_equal(reg.iter_stop,i_s)
-        its = 1
-        self.assertAlmostEqual(reg.iteration,its,7)
-        my = 38.436224469387746
-        self.assertAlmostEqual(reg.mean_y,my)
-        stdy = 18.466069465206047
-        self.assertAlmostEqual(reg.std_y,stdy,7)
-        vm = np.array([[  4.86218274e+02,  -2.77268729e+00,  -1.59987770e+00,
-             -1.01969471e+01,   2.74302006e+00],
-           [ -2.77268729e+00,   1.04680972e-01,   2.51172238e-02,
-              1.95136385e-03,   3.70052723e-03],
-           [ -1.59987770e+00,   2.51172238e-02,   2.15655720e-02,
-              7.65868344e-03,  -7.30173070e-03],
-           [ -1.01969471e+01,   1.95136385e-03,   7.65868344e-03,
-              2.78273684e-01,  -6.89402590e-02],
-           [  2.74302006e+00,   3.70052723e-03,  -7.30173070e-03,
-             -6.89402590e-02,   7.12034037e-02]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        hth = np.array([[  4.90000000e+01,   7.04371999e+02,   1.72131237e+03,
-              7.24743592e+02,   1.70735413e+03],
-           [  7.04371999e+02,   1.16866734e+04,   2.15575320e+04,
-              1.10925200e+04,   2.23848036e+04],
-           [  1.72131237e+03,   2.15575320e+04,   7.39058986e+04,
-              2.34796298e+04,   6.70145378e+04],
-           [  7.24743592e+02,   1.10925200e+04,   2.34796298e+04,
-              1.16146226e+04,   2.30304624e+04],
-           [  1.70735413e+03,   2.23848036e+04,   6.70145378e+04,
-              2.30304624e+04,   6.69879858e+04]])
-        np.testing.assert_array_almost_equal(reg.hth,hth,4)
-
 class TestGMComboHet(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
diff --git a/pysal/contrib/handler/tests/test_error_spom.py b/pysal/contrib/handler/tests/test_error_spom.py
index 320f3c2..7f8d27e 100644
--- a/pysal/contrib/handler/tests/test_error_spom.py
+++ b/pysal/contrib/handler/tests/test_error_spom.py
@@ -13,43 +13,6 @@ GM_Combo_Hom = partial(Model, mtype='GM_Combo_Hom')
 GM_Error_Hom = partial(Model, mtype='GM_Error_Hom')
 GM_Endog_Error_Hom = partial(Model, mtype='GM_Endog_Error_Hom')
 
-BaseGM_Combo_Hom = partial(Model, mtype='BaseGM_Combo_Hom')
-BaseGM_Error_Hom = partial(Model, mtype='BaseGM_Error_Hom')
-BaseGM_Endog_Error_Hom = partial(Model, mtype='BaseGM_Endog_Error_Hom')
-
-class BaseGM_Error_Hom_Tester(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        X.append(db.by_col("CRIME"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-    def test_model(self):
-        reg = BaseGM_Error_Hom(self.y, self.X, self.w.sparse, A1='hom_sc')
-        np.testing.assert_array_almost_equal(reg.y[0],np.array([80.467003]),7)
-        x = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_array_almost_equal(reg.x[0],x,7)
-        betas = np.array([[ 47.9478524 ], [  0.70633223], [ -0.55595633], [  0.41288558]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,7)
-        np.testing.assert_array_almost_equal(reg.u[0],np.array([27.466734]),6)
-        np.testing.assert_array_almost_equal(reg.e_filtered[0],np.array([ 32.37298547]),7)
-        i_s = 'Maximum number of iterations reached.'
-        self.assertAlmostEqual(reg.iter_stop,i_s,7)
-        np.testing.assert_array_almost_equal(reg.predy[0],np.array([ 53.000269]),6)
-        self.assertAlmostEquals(reg.n,49,7)
-        self.assertAlmostEquals(reg.k,3,7)
-        sig2 = 189.94459439729718
-        self.assertAlmostEqual(reg.sig2,sig2)
-        vm = np.array([[  1.51340717e+02,  -5.29057506e+00,  -1.85654540e+00, -2.39139054e-03], [ -5.29057506e+00,   2.46669610e-01, 5.14259101e-02, 3.19241302e-04], [ -1.85654540e+00,   5.14259101e-02, 3.20510550e-02,  -5.95640240e-05], [ -2.39139054e-03,   3.19241302e-04, -5.95640240e-05,  3.36690159e-02]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        xtx = np.array([[  4.90000000e+01,   7.04371999e+02, 1.72131237e+03], [  7.04371999e+02,   1.16866734e+04,   2.15575320e+04], [  1.72131237e+03,   2.15575320e+04, 7.39058986e+04]])
-        np.testing.assert_array_almost_equal(reg.xtx,xtx,4)
-
 class GM_Error_Hom_Tester(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -93,63 +56,6 @@ class GM_Error_Hom_Tester(unittest.TestCase):
         xtx = np.array([[  4.90000000e+01,   7.04371999e+02, 1.72131237e+03], [  7.04371999e+02,   1.16866734e+04,   2.15575320e+04], [  1.72131237e+03,   2.15575320e+04, 7.39058986e+04]])
         np.testing.assert_array_almost_equal(reg.xtx,xtx,4)
 
-
-class BaseGM_Endog_Error_Hom_Tester(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        yd = []
-        yd.append(db.by_col("CRIME"))
-        self.yd = np.array(yd).T
-        q = []
-        q.append(db.by_col("DISCBD"))
-        self.q = np.array(q).T
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-    def test_model(self):
-        reg = BaseGM_Endog_Error_Hom(self.y, self.X, self.yd, self.q, self.w.sparse, A1='hom_sc')
-        np.testing.assert_array_almost_equal(reg.y[0],np.array([ 80.467003]),7)
-        x = np.array([  1.     ,  19.531])
-        np.testing.assert_array_almost_equal(reg.x[0],x,7)
-        z = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_array_almost_equal(reg.z[0],z,7)
-        h = np.array([  1.   ,  19.531,   5.03 ])
-        np.testing.assert_array_almost_equal(reg.h[0],h,7)
-        yend = np.array([ 15.72598])
-        np.testing.assert_array_almost_equal(reg.yend[0],yend,7)
-        q = np.array([ 5.03])
-        np.testing.assert_array_almost_equal(reg.q[0],q,7)
-        betas = np.array([[ 55.36575166], [  0.46432416], [ -0.66904404], [  0.43205526]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,6)
-        u = np.array([ 26.55390939])
-        np.testing.assert_array_almost_equal(reg.u[0],u,6)
-        np.testing.assert_array_almost_equal(reg.e_filtered[0],np.array([ 31.74114306]),7)
-        predy = np.array([ 53.91309361])
-        np.testing.assert_array_almost_equal(reg.predy[0],predy,6)
-        self.assertAlmostEquals(reg.n,49,7)
-        self.assertAlmostEquals(reg.k,3,7)
-        sig2 = 190.59435238060928
-        self.assertAlmostEqual(reg.sig2,sig2)
-        vm = np.array([[  5.52064057e+02,  -1.61264555e+01,  -8.86360735e+00, 1.04251912e+00], [ -1.61264555e+01,   5.44898242e-01, 2.39518645e-01, -1.88092950e-02], [ -8.86360735e+00,   2.39518645e-01, 1.55501840e-01, -2.18638648e-02], [  1.04251912e+00, -1.88092950e-02, -2.18638648e-02, 3.71222222e-02]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        i_s = 'Maximum number of iterations reached.'
-        self.assertAlmostEqual(reg.iter_stop,i_s,7)
-        its = 1
-        self.assertAlmostEqual(reg.iteration,its,7)
-        my = 38.436224469387746
-        self.assertAlmostEqual(reg.mean_y,my)
-        std_y = 18.466069465206047
-        self.assertAlmostEqual(reg.std_y,std_y)
-        sig2 = 0
-        #self.assertAlmostEqual(reg.sig2,sig2)
-        hth = np.array([[    49.        ,    704.371999  ,    139.75      ], [   704.371999  ,  11686.67338121,   2246.12800625], [   139.75      ,   2246.12800625,    498.5851]])
-        np.testing.assert_array_almost_equal(reg.hth,hth,4)
-
 class GM_Endog_Error_Hom_Tester(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -208,56 +114,6 @@ class GM_Endog_Error_Hom_Tester(unittest.TestCase):
         z_stat = np.array([[ 2.35638617,  0.01845372], [ 0.62901874,  0.52933679], [-1.69662923,  0.08976678], [ 2.24244556,  0.02493259]])
         np.testing.assert_array_almost_equal(reg.z_stat,z_stat,6)
 
-
-class BaseGM_Combo_Hom_Tester(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        self.X = np.array(X).T
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-    def test_model(self):
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, 1, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        reg = BaseGM_Combo_Hom(self.y, self.X, yend=yd2, q=q2, w=self.w.sparse, A1='hom_sc')
-        np.testing.assert_array_almost_equal(reg.y[0],np.array([80.467003]),7)
-        x = np.array([  1.     ,  19.531])
-        np.testing.assert_array_almost_equal(reg.x[0],x,7)
-        betas = np.array([[ 10.12541428], [  1.56832263], [  0.15132076], [  0.21033397]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,7)
-        np.testing.assert_array_almost_equal(reg.u[0],np.array([34.3450723]),7)
-        np.testing.assert_array_almost_equal(reg.e_filtered[0],np.array([ 36.6149682]),7)
-        np.testing.assert_array_almost_equal(reg.predy[0],np.array([ 46.1219307]),7)
-        self.assertAlmostEquals(reg.n,49,7)
-        self.assertAlmostEquals(reg.k,3,7)
-        vm = np.array([[  2.33694742e+02,  -6.66856869e-01,  -5.58304254e+00, 4.85488380e+00], [ -6.66856869e-01,   1.94241504e-01, -5.42327138e-02, 5.37225570e-02], [ -5.58304254e+00,  -5.42327138e-02, 1.63860721e-01, -1.44425498e-01], [  4.85488380e+00, 5.37225570e-02, -1.44425498e-01, 1.78622255e-01]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        z = np.array([  1.       ,  19.531    ,  35.4585005])
-        np.testing.assert_array_almost_equal(reg.z[0],z,7)
-        h = np.array([  1.   ,  19.531,  18.594])
-        np.testing.assert_array_almost_equal(reg.h[0],h,7)
-        yend = np.array([ 35.4585005])
-        np.testing.assert_array_almost_equal(reg.yend[0],yend,7)
-        q = np.array([ 18.594])
-        np.testing.assert_array_almost_equal(reg.q[0],q,7)
-        i_s = 'Maximum number of iterations reached.'
-        self.assertAlmostEqual(reg.iter_stop,i_s,7)
-        its = 1
-        self.assertAlmostEqual(reg.iteration,its,7)
-        my = 38.436224469387746
-        self.assertAlmostEqual(reg.mean_y,my)
-        std_y = 18.466069465206047
-        self.assertAlmostEqual(reg.std_y,std_y)
-        sig2 = 232.22680651270042
-        #self.assertAlmostEqual(reg.sig2,sig2)
-        np.testing.assert_allclose(reg.sig2,sig2)
-        hth = np.array([[    49.        ,    704.371999  ,    724.7435916 ], [   704.371999  ,  11686.67338121,  11092.519988  ], [   724.7435916 ,  11092.519988  , 11614.62257048]])
-        np.testing.assert_array_almost_equal(reg.hth,hth,4)
-
-
 class GM_Combo_Hom_Tester(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -312,9 +168,8 @@ class GM_Combo_Hom_Tester(unittest.TestCase):
         np.testing.assert_array_almost_equal(reg.vm,vm,6)
 
 suite = unittest.TestSuite()
-test_classes = [BaseGM_Error_Hom_Tester, GM_Error_Hom_Tester,\
-        BaseGM_Endog_Error_Hom_Tester, GM_Endog_Error_Hom_Tester, \
-        BaseGM_Combo_Hom_Tester, GM_Combo_Hom_Tester]
+test_classes = [GM_Error_Hom_Tester, GM_Endog_Error_Hom_Tester, \
+                GM_Combo_Hom_Tester]
 for i in test_classes:
     a = unittest.TestLoader().loadTestsFromTestCase(i)
     suite.addTest(a)
diff --git a/pysal/contrib/handler/tests/test_error_spom_regimes.py b/pysal/contrib/handler/tests/test_error_spom_regimes.py
index a082596..cdeb624 100644
--- a/pysal/contrib/handler/tests/test_error_spom_regimes.py
+++ b/pysal/contrib/handler/tests/test_error_spom_regimes.py
@@ -10,9 +10,6 @@ from functools import partial
 GM_Error_Hom_Regimes = partial(Model, mtype='GM_Error_Hom_Regimes')
 GM_Endog_Error_Hom_Regimes = partial(Model, mtype='GM_Endog_Error_Hom_Regimes')
 GM_Combo_Hom_Regimes = partial(Model, mtype='GM_Combo_Hom_Regimes')
-BaseGM_Error_Hom_Regimes = partial(Model, mtype='BaseGM_Error_Hom_Regimes')
-BaseGM_Endog_Error_Hom_Regimes = partial(Model, mtype='BaseGM_Endog_Error_Hom_Regimes')
-BaseGM_Combo_Hom_Regimes = partial(Model, mtype='BaseGM_Combo_Hom_Regimes')
 
 GM_Error_Hom = partial(Model, mtype='GM_Error_Hom')
 GM_Endog_Error_Hom = partial(Model, mtype='GM_Endog_Error_Hom')
@@ -222,7 +219,8 @@ class TestGM_Error_Hom_Regimes(unittest.TestCase):
         np.testing.assert_array_almost_equal(model.vm.diagonal(), vm, 6)
 
     def test_model_combo(self):
-        reg = GM_Combo_Hom_Regimes(self.y, self.X2, self.regimes, self.yd, self.q, w=self.w, A1='het')
+        reg = GM_Combo_Hom_Regimes(self.y, self.X2, self.regimes, 
+                                   yend=self.yd, q=self.q, w=self.w, A1='het')
         betas = np.array([[ 36.93726782],
        [ -0.829475  ],
        [ 30.86675168],
@@ -278,7 +276,10 @@ class TestGM_Error_Hom_Regimes(unittest.TestCase):
 
     def test_model_combo_regi_error(self):
         #Columbus:
-        reg = GM_Combo_Hom_Regimes(self.y, self.X2, self.regimes, self.yd, self.q, w=self.w, regime_lag_sep=True, regime_err_sep=True, A1='het')
+        reg = GM_Combo_Hom_Regimes(self.y, self.X2, self.regimes,
+                                   yend=self.yd, q=self.q, w=self.w, 
+                                   regime_lag_sep=True, regime_err_sep=True, 
+                                   A1='het')
         betas = np.array([[  4.20115146e+01],
        [ -1.39171512e-01],
        [ -6.53001838e-01],
diff --git a/pysal/contrib/handler/tests/test_error_spom_sparse.py b/pysal/contrib/handler/tests/test_error_spom_sparse.py
index 538ff62..a907655 100644
--- a/pysal/contrib/handler/tests/test_error_spom_sparse.py
+++ b/pysal/contrib/handler/tests/test_error_spom_sparse.py
@@ -15,44 +15,6 @@ GM_Error_Hom = partial(Model, mtype='GM_Error_Hom')
 GM_Endog_Error_Hom = partial(Model, mtype='GM_Endog_Error_Hom')
 GM_Combo_Hom = partial(Model, mtype='GM_Combo_Hom')
 
-BaseGM_Error_Hom = partial(Model, mtype='BaseGM_Error_Hom')
-BaseGM_Endog_Error_Hom = partial(Model, mtype='BaseGM_Endog_Error_Hom')
-BaseGM_Combo_Hom = partial(Model, mtype='BaseGM_Combo_Hom')
-
-class BaseGM_Error_Hom_Tester(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        X.append(db.by_col("CRIME"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = sparse.csr_matrix(self.X)
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-    def test_model(self):
-        reg = BaseGM_Error_Hom(self.y, self.X, self.w.sparse, A1='hom_sc')
-        np.testing.assert_array_almost_equal(reg.y[0],np.array([80.467003]),7)
-        x = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_array_almost_equal(reg.x[0].toarray()[0],x,7)
-        betas = np.array([[ 47.9478524 ], [  0.70633223], [ -0.55595633], [  0.41288558]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,7)
-        np.testing.assert_array_almost_equal(reg.u[0],np.array([27.466734]),6)
-        np.testing.assert_array_almost_equal(reg.e_filtered[0],np.array([ 32.37298547]),7)
-        i_s = 'Maximum number of iterations reached.'
-        self.assertAlmostEqual(reg.iter_stop,i_s,7)
-        np.testing.assert_array_almost_equal(reg.predy[0],np.array([ 53.000269]),6)
-        self.assertAlmostEquals(reg.n,49,7)
-        self.assertAlmostEquals(reg.k,3,7)
-        sig2 = 189.94459439729718
-        self.assertAlmostEqual(reg.sig2,sig2)
-        vm = np.array([[  1.51340717e+02,  -5.29057506e+00,  -1.85654540e+00, -2.39139054e-03], [ -5.29057506e+00,   2.46669610e-01, 5.14259101e-02, 3.19241302e-04], [ -1.85654540e+00,   5.14259101e-02, 3.20510550e-02,  -5.95640240e-05], [ -2.39139054e-03,   3.19241302e-04, -5.95640240e-05,  3.36690159e-02]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        xtx = np.array([[  4.90000000e+01,   7.04371999e+02, 1.72131237e+03], [  7.04371999e+02,   1.16866734e+04,   2.15575320e+04], [  1.72131237e+03,   2.15575320e+04, 7.39058986e+04]])
-        np.testing.assert_array_almost_equal(reg.xtx,xtx,4)
-
 class GM_Error_Hom_Tester(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -97,64 +59,6 @@ class GM_Error_Hom_Tester(unittest.TestCase):
         xtx = np.array([[  4.90000000e+01,   7.04371999e+02, 1.72131237e+03], [  7.04371999e+02,   1.16866734e+04,   2.15575320e+04], [  1.72131237e+03,   2.15575320e+04, 7.39058986e+04]])
         np.testing.assert_array_almost_equal(reg.xtx,xtx,4)
 
-
-class BaseGM_Endog_Error_Hom_Tester(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = sparse.csr_matrix(self.X)
-        yd = []
-        yd.append(db.by_col("CRIME"))
-        self.yd = np.array(yd).T
-        q = []
-        q.append(db.by_col("DISCBD"))
-        self.q = np.array(q).T
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-    def test_model(self):
-        reg = BaseGM_Endog_Error_Hom(self.y, self.X, self.yd, self.q, self.w.sparse, A1='hom_sc')
-        np.testing.assert_array_almost_equal(reg.y[0],np.array([ 80.467003]),7)
-        x = np.array([  1.     ,  19.531])
-        np.testing.assert_array_almost_equal(reg.x[0].toarray()[0],x,7)
-        z = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_array_almost_equal(reg.z[0].toarray()[0],z,7)
-        h = np.array([  1.   ,  19.531,   5.03 ])
-        np.testing.assert_array_almost_equal(reg.h[0].toarray()[0],h,7)
-        yend = np.array([ 15.72598])
-        np.testing.assert_array_almost_equal(reg.yend[0],yend,7)
-        q = np.array([ 5.03])
-        np.testing.assert_array_almost_equal(reg.q[0],q,7)
-        betas = np.array([[ 55.36575166], [  0.46432416], [ -0.66904404], [  0.43205526]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,6)
-        u = np.array([ 26.55390939])
-        np.testing.assert_array_almost_equal(reg.u[0],u,6)
-        np.testing.assert_array_almost_equal(reg.e_filtered[0],np.array([ 31.74114306]),7)
-        predy = np.array([ 53.91309361])
-        np.testing.assert_array_almost_equal(reg.predy[0],predy,6)
-        self.assertAlmostEquals(reg.n,49,7)
-        self.assertAlmostEquals(reg.k,3,7)
-        sig2 = 190.59435238060928
-        self.assertAlmostEqual(reg.sig2,sig2)
-        vm = np.array([[  5.52064057e+02,  -1.61264555e+01,  -8.86360735e+00, 1.04251912e+00], [ -1.61264555e+01,   5.44898242e-01, 2.39518645e-01, -1.88092950e-02], [ -8.86360735e+00,   2.39518645e-01, 1.55501840e-01, -2.18638648e-02], [  1.04251912e+00, -1.88092950e-02, -2.18638648e-02, 3.71222222e-02]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        i_s = 'Maximum number of iterations reached.'
-        self.assertAlmostEqual(reg.iter_stop,i_s,7)
-        its = 1
-        self.assertAlmostEqual(reg.iteration,its,7)
-        my = 38.436224469387746
-        self.assertAlmostEqual(reg.mean_y,my)
-        std_y = 18.466069465206047
-        self.assertAlmostEqual(reg.std_y,std_y)
-        sig2 = 0
-        #self.assertAlmostEqual(reg.sig2,sig2)
-        hth = np.array([[    49.        ,    704.371999  ,    139.75      ], [   704.371999  ,  11686.67338121,   2246.12800625], [   139.75      ,   2246.12800625,    498.5851]])
-        np.testing.assert_array_almost_equal(reg.hth,hth,4)
-
 class GM_Endog_Error_Hom_Tester(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -214,56 +118,6 @@ class GM_Endog_Error_Hom_Tester(unittest.TestCase):
         z_stat = np.array([[ 2.35638617,  0.01845372], [ 0.62901874,  0.52933679], [-1.69662923,  0.08976678], [ 2.24244556,  0.02493259]])
         np.testing.assert_array_almost_equal(reg.z_stat,z_stat,6)
 
-
-class BaseGM_Combo_Hom_Tester(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        X = []
-        X.append(db.by_col("INC"))
-        self.X = np.array(X).T
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-    def test_model(self):
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, 1, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = sparse.csr_matrix(self.X)
-        reg = BaseGM_Combo_Hom(self.y, self.X, yend=yd2, q=q2, w=self.w.sparse, A1='hom_sc')
-        np.testing.assert_array_almost_equal(reg.y[0],np.array([80.467003]),7)
-        x = np.array([  1.     ,  19.531])
-        np.testing.assert_array_almost_equal(reg.x[0].toarray()[0],x,7)
-        betas = np.array([[ 10.12541428], [  1.56832263], [  0.15132076], [  0.21033397]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,7)
-        np.testing.assert_array_almost_equal(reg.u[0],np.array([34.3450723]),7)
-        np.testing.assert_array_almost_equal(reg.e_filtered[0],np.array([ 36.6149682]),7)
-        np.testing.assert_array_almost_equal(reg.predy[0],np.array([ 46.1219307]),7)
-        self.assertAlmostEquals(reg.n,49,7)
-        self.assertAlmostEquals(reg.k,3,7)
-        vm = np.array([[  2.33694742e+02,  -6.66856869e-01,  -5.58304254e+00, 4.85488380e+00], [ -6.66856869e-01,   1.94241504e-01, -5.42327138e-02, 5.37225570e-02], [ -5.58304254e+00,  -5.42327138e-02, 1.63860721e-01, -1.44425498e-01], [  4.85488380e+00, 5.37225570e-02, -1.44425498e-01, 1.78622255e-01]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        z = np.array([  1.       ,  19.531    ,  35.4585005])
-        np.testing.assert_array_almost_equal(reg.z[0].toarray()[0],z,7)
-        h = np.array([  1.   ,  19.531,  18.594])
-        np.testing.assert_array_almost_equal(reg.h[0].toarray()[0],h,7)
-        yend = np.array([ 35.4585005])
-        np.testing.assert_array_almost_equal(reg.yend[0],yend,7)
-        q = np.array([ 18.594])
-        np.testing.assert_array_almost_equal(reg.q[0],q,7)
-        i_s = 'Maximum number of iterations reached.'
-        self.assertAlmostEqual(reg.iter_stop,i_s,7)
-        its = 1
-        self.assertAlmostEqual(reg.iteration,its,7)
-        my = 38.436224469387746
-        self.assertAlmostEqual(reg.mean_y,my)
-        std_y = 18.466069465206047
-        self.assertAlmostEqual(reg.std_y,std_y)
-        sig2 = 232.22680644168395
-        self.assertAlmostEqual(reg.sig2,sig2, places=6)
-        hth = np.array([[    49.        ,    704.371999  ,    724.7435916 ], [   704.371999  ,  11686.67338121,  11092.519988  ], [   724.7435916 ,  11092.519988  , 11614.62257048]])
-        np.testing.assert_array_almost_equal(reg.hth,hth,4)
-
-
 class GM_Combo_Hom_Tester(unittest.TestCase):
     def setUp(self):
         db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
@@ -318,9 +172,7 @@ class GM_Combo_Hom_Tester(unittest.TestCase):
         np.testing.assert_array_almost_equal(reg.vm,vm,6)
 
 suite = unittest.TestSuite()
-test_classes = [BaseGM_Error_Hom_Tester, GM_Error_Hom_Tester,\
-        BaseGM_Endog_Error_Hom_Tester, GM_Endog_Error_Hom_Tester, \
-        BaseGM_Combo_Hom_Tester, GM_Combo_Hom_Tester]
+test_classes = [GM_Error_Hom_Tester, GM_Endog_Error_Hom_Tester, GM_Combo_Hom_Tester]
 for i in test_classes:
     a = unittest.TestLoader().loadTestsFromTestCase(i)
     suite.addTest(a)
diff --git a/pysal/contrib/handler/tests/test_ols.py b/pysal/contrib/handler/tests/test_ols.py
index daf466e..26eec1c 100644
--- a/pysal/contrib/handler/tests/test_ols.py
+++ b/pysal/contrib/handler/tests/test_ols.py
@@ -8,11 +8,10 @@ from functools import partial
 from pysal.contrib.handler import Model
 
 OLS = partial(Model, mtype='OLS')
-BaseOLS = partial(Model, mtype='BaseOLS')
 
 PEGP = pysal.examples.get_path
 
-class TestBaseOLS(unittest.TestCase):
+class TestOLS(unittest.TestCase):
     def setUp(self):
         db = pysal.open(PEGP('columbus.dbf'),'r')
         y = np.array(db.by_col("HOVAL"))
@@ -23,41 +22,10 @@ class TestBaseOLS(unittest.TestCase):
         self.X = np.array(X).T
         self.w = pysal.weights.rook_from_shapefile(PEGP("columbus.shp"))
 
-    def test_ols(self):
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        ols = BaseOLS(self.y,self.X)
-        np.testing.assert_array_almost_equal(ols.betas, np.array([[
-            46.42818268], [  0.62898397], [ -0.48488854]]))
-        vm = np.array([[  1.74022453e+02,  -6.52060364e+00,  -2.15109867e+00],
-           [ -6.52060364e+00,   2.87200008e-01,   6.80956787e-02],
-           [ -2.15109867e+00,   6.80956787e-02,   3.33693910e-02]])
-        np.testing.assert_array_almost_equal(ols.vm, vm,6)
-
-    def test_ols_white1(self):
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        ols = BaseOLS(self.y,self.X,robust='white', sig2n_k=True)
-        np.testing.assert_array_almost_equal(ols.betas, np.array([[
-            46.42818268], [  0.62898397], [ -0.48488854]]))
-        vm = np.array([[  2.05819450e+02,  -6.83139266e+00,  -2.64825846e+00],
-       [ -6.83139266e+00,   2.58480813e-01,   8.07733167e-02],
-       [ -2.64825846e+00,   8.07733167e-02,   3.75817181e-02]])
-        np.testing.assert_array_almost_equal(ols.vm, vm,6)
-
-    def test_ols_white2(self):
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        ols = BaseOLS(self.y,self.X,robust='white', sig2n_k=False)
-        np.testing.assert_array_almost_equal(ols.betas, np.array([[
-            46.42818268], [  0.62898397], [ -0.48488854]]))
-        vm = np.array([[  1.93218259e+02,  -6.41314413e+00,  -2.48612018e+00],
-       [ -6.41314413e+00,   2.42655457e-01,   7.58280116e-02],
-       [ -2.48612018e+00,   7.58280116e-02,   3.52807966e-02]])
-        np.testing.assert_array_almost_equal(ols.vm, vm,6)
-
     def test_OLS(self):
-        ols = OLS(self.y, self.X, self.w, spat_diag=True, moran=True, \
+        ols = OLS(self.y, self.X, w=self.w, spat_diag=True, moran=True, \
                 white_test=True, name_y='home value', name_x=['income','crime'], \
                 name_ds='columbus')
-        
         np.testing.assert_array_almost_equal(ols.aic, \
                 408.73548964604873 ,7)
         np.testing.assert_array_almost_equal(ols.ar2, \
diff --git a/pysal/contrib/handler/tests/test_ols_sparse.py b/pysal/contrib/handler/tests/test_ols_sparse.py
index 53cc2b0..5bd9ed9 100644
--- a/pysal/contrib/handler/tests/test_ols_sparse.py
+++ b/pysal/contrib/handler/tests/test_ols_sparse.py
@@ -8,11 +8,10 @@ from pysal.contrib.handler import Model
 from functools import partial
 
 OLS = partial(Model, mtype='OLS')
-BaseOLS = partial(Model, mtype='BaseOLS')
 
 PEGP = pysal.examples.get_path
 
-class TestBaseOLS(unittest.TestCase):
+class TestOLS(unittest.TestCase):
     def setUp(self):
         db = pysal.open(PEGP('columbus.dbf'),'r')
         y = np.array(db.by_col("HOVAL"))
@@ -23,20 +22,9 @@ class TestBaseOLS(unittest.TestCase):
         self.X = np.array(X).T
         self.w = pysal.weights.rook_from_shapefile(PEGP("columbus.shp"))
 
-    def test_ols(self):
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = sparse.csr_matrix(self.X)
-        ols = BaseOLS(self.y,self.X)
-        np.testing.assert_array_almost_equal(ols.betas, np.array([[
-            46.42818268], [  0.62898397], [ -0.48488854]]))
-        vm = np.array([[  1.74022453e+02,  -6.52060364e+00,  -2.15109867e+00],
-           [ -6.52060364e+00,   2.87200008e-01,   6.80956787e-02],
-           [ -2.15109867e+00,   6.80956787e-02,   3.33693910e-02]])
-        np.testing.assert_array_almost_equal(ols.vm, vm,6)
-
     def test_OLS(self):
         self.X = sparse.csr_matrix(self.X)
-        ols = OLS(self.y, self.X, self.w, spat_diag=True, moran=True, \
+        ols = OLS(self.y, self.X, w=self.w, spat_diag=True, moran=True, \
                 name_y='home value', name_x=['income','crime'], \
                 name_ds='columbus', nonspat_diag=True, white_test=True)
         
diff --git a/pysal/contrib/handler/tests/test_probit.py b/pysal/contrib/handler/tests/test_probit.py
index 1546bd8..e658033 100644
--- a/pysal/contrib/handler/tests/test_probit.py
+++ b/pysal/contrib/handler/tests/test_probit.py
@@ -7,58 +7,6 @@ from pysal.contrib.handler import Model
 from functools import partial
 
 Probit = partial(Model, mtype='Probit')
-BaseProbit = partial(Model, mtype='BaseProbit')
-
-class TestBaseProbit(unittest.TestCase):
-    def setUp(self):
-        db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
-        y = np.array(db.by_col("CRIME"))
-        y = np.reshape(y, (49,1))
-        self.y = (y>40).astype(float)
-        X = []
-        X.append(db.by_col("INC"))
-        X.append(db.by_col("HOVAL"))
-        self.X = np.array(X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-
-    def test_model(self):
-        reg = BaseProbit(self.y, self.X, w=self.w)
-        betas = np.array([[ 3.35381078], [-0.1996531 ], [-0.02951371]])
-        np.testing.assert_array_almost_equal(reg.betas,betas,6)
-        predy = np.array([ 0.00174739])
-        np.testing.assert_array_almost_equal(reg.predy[0],predy,6)
-        n = 49
-        self.assertAlmostEqual(reg.n,n,6)
-        k = 3
-        self.assertAlmostEqual(reg.k,k,6)
-        y = np.array([ 0.])
-        np.testing.assert_array_almost_equal(reg.y[0],y,6)
-        x = np.array([  1.      ,  19.531   ,  80.467003])
-        np.testing.assert_array_almost_equal(reg.x[0],x,6)
-        vm = np.array([[  8.52813879e-01,  -4.36272459e-02,  -8.05171472e-03], [ -4.36272459e-02,   4.11381444e-03,  -1.92834842e-04], [ -8.05171472e-03,  -1.92834842e-04,   3.09660240e-04]])
-        np.testing.assert_array_almost_equal(reg.vm,vm,6)
-        xmean = np.array([[  1.        ], [ 14.37493876], [ 38.43622447 ]])
-        np.testing.assert_array_almost_equal(reg.xmean,xmean,6)        
-        predpc = 85.714285714285708
-        self.assertAlmostEqual(reg.predpc,predpc,5)
-        logl = -20.06009093055782
-        self.assertAlmostEqual(reg.logl,logl,5)
-        scale = 0.23309310130643665
-        self.assertAlmostEqual(reg.scale,scale,5)
-        slopes = np.array([[-0.04653776], [-0.00687944]])
-        np.testing.assert_array_almost_equal(reg.slopes,slopes,6)
-        slopes_vm = np.array([[  1.77101993e-04,  -1.65021168e-05], [ -1.65021168e-05,   1.60575016e-05]])
-        np.testing.assert_array_almost_equal(reg.slopes_vm,slopes_vm,6)
-        LR = 25.317683245671716
-        self.assertAlmostEqual(reg.LR[0],LR,5)
-        Pinkse_error = 2.9632385352516728
-        self.assertAlmostEqual(reg.Pinkse_error[0],Pinkse_error,5)
-        KP_error = 1.6509224700582124
-        self.assertAlmostEqual(reg.KP_error[0],KP_error,5)
-        PS_error = 2.3732463777623511
-        self.assertAlmostEqual(reg.PS_error[0],PS_error,5)
 
 class TestProbit(unittest.TestCase):
     def setUp(self):
diff --git a/pysal/contrib/handler/tests/test_twosls.py b/pysal/contrib/handler/tests/test_twosls.py
index e656dc4..913a8a0 100644
--- a/pysal/contrib/handler/tests/test_twosls.py
+++ b/pysal/contrib/handler/tests/test_twosls.py
@@ -5,107 +5,8 @@ import pysal
 from pysal.contrib.handler import Model
 from functools import partial
 
-BaseTSLS = partial(Model, mtype='BaseTSLS')
 TSLS = partial(Model, mtype='TSLS')
 
-class TestBaseTSLS(unittest.TestCase):
-    def setUp(self):
-        db = pysal.open(pysal.examples.get_path("columbus.dbf"),'r')
-        self.y = np.array(db.by_col("CRIME"))
-        self.y = np.reshape(self.y, (49,1))
-        self.X = []
-        self.X.append(db.by_col("INC"))
-        self.X = np.array(self.X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.yd = []
-        self.yd.append(db.by_col("HOVAL"))
-        self.yd = np.array(self.yd).T
-        self.q = []
-        self.q.append(db.by_col("DISCBD"))
-        self.q = np.array(self.q).T
-
-    def test_basic(self):
-        reg = BaseTSLS(self.y, self.X, self.yd, self.q)
-        betas = np.array([[ 88.46579584], [  0.5200379 ], [ -1.58216593]])
-        np.testing.assert_array_almost_equal(reg.betas, betas, 7)
-        h_0 = np.array([  1.   ,  19.531,   5.03 ])
-        np.testing.assert_array_almost_equal(reg.h[0], h_0)
-        hth = np.array([[    49.        ,    704.371999  ,    139.75      ],
-                        [   704.371999  ,  11686.67338121,   2246.12800625],
-                        [   139.75      ,   2246.12800625,    498.5851    ]])
-        np.testing.assert_array_almost_equal(reg.hth, hth, 7)
-        hthi = np.array([[ 0.1597275 , -0.00762011, -0.01044191],
-                        [-0.00762011,  0.00100135, -0.0023752 ],
-                        [-0.01044191, -0.0023752 ,  0.01563276]]) 
-        np.testing.assert_array_almost_equal(reg.hthi, hthi, 7)
-        self.assertEqual(reg.k, 3)
-        self.assertEqual(reg.kstar, 1)
-        self.assertAlmostEqual(reg.mean_y, 35.128823897959187, 7)
-        self.assertEqual(reg.n, 49)
-        pfora1a2 = np.array([[ 9.58156106, -0.22744226, -0.13820537],
-                             [ 0.02580142,  0.08226331, -0.03143731],
-                             [-3.13896453, -0.33487872,  0.20690965]]) 
-        np.testing.assert_array_almost_equal(reg.pfora1a2, pfora1a2, 7)
-        predy_5 = np.array([[-28.68949467], [ 28.99484984], [ 55.07344824], [ 38.26609504], [ 57.57145851]]) 
-        np.testing.assert_array_almost_equal(reg.predy[0:5], predy_5, 7)
-        q_5 = np.array([[ 5.03], [ 4.27], [ 3.89], [ 3.7 ], [ 2.83]])
-        np.testing.assert_array_equal(reg.q[0:5], q_5)
-        self.assertAlmostEqual(reg.sig2n_k, 587.56797852699822, 7)
-        self.assertAlmostEqual(reg.sig2n, 551.5944288212637, 7)
-        self.assertAlmostEqual(reg.sig2, 551.5944288212637, 7)
-        self.assertAlmostEqual(reg.std_y, 16.732092091229699, 7)
-        u_5 = np.array([[ 44.41547467], [-10.19309584], [-24.44666724], [ -5.87833504], [ -6.83994851]]) 
-        np.testing.assert_array_almost_equal(reg.u[0:5], u_5, 7)
-        self.assertAlmostEqual(reg.utu, 27028.127012241919, 7)
-        varb = np.array([[ 0.41526237,  0.01879906, -0.01730372],
-                         [ 0.01879906,  0.00362823, -0.00184604],
-                         [-0.01730372, -0.00184604,  0.0011406 ]]) 
-        np.testing.assert_array_almost_equal(reg.varb, varb, 7)
-        vm = np.array([[ 229.05640809,   10.36945783,   -9.54463414],
-                       [  10.36945783,    2.0013142 ,   -1.01826408],
-                       [  -9.54463414,   -1.01826408,    0.62914915]]) 
-        np.testing.assert_array_almost_equal(reg.vm, vm, 7)
-        x_0 = np.array([  1.   ,  19.531])
-        np.testing.assert_array_almost_equal(reg.x[0], x_0, 7)
-        y_5 = np.array([[ 15.72598 ], [ 18.801754], [ 30.626781], [ 32.38776 ], [ 50.73151 ]]) 
-        np.testing.assert_array_almost_equal(reg.y[0:5], y_5, 7)
-        yend_5 = np.array([[ 80.467003], [ 44.567001], [ 26.35    ], [ 33.200001], [ 23.225   ]]) 
-        np.testing.assert_array_almost_equal(reg.yend[0:5], yend_5, 7)
-        z_0 = np.array([  1.      ,  19.531   ,  80.467003]) 
-        np.testing.assert_array_almost_equal(reg.z[0], z_0, 7)
-        zthhthi = np.array([[  1.00000000e+00,  -1.66533454e-16,   4.44089210e-16],
-                            [  0.00000000e+00,   1.00000000e+00,   0.00000000e+00],
-                            [  1.26978671e+01,   1.05598709e+00,   3.70212359e+00]]) 
-        np.testing.assert_array_almost_equal(reg.zthhthi, zthhthi, 7)
-        
-    def test_n_k(self):
-        reg = BaseTSLS(self.y, self.X, self.yd, self.q, sig2n_k=True)
-        betas = np.array([[ 88.46579584], [  0.5200379 ], [ -1.58216593]])
-        np.testing.assert_array_almost_equal(reg.betas, betas, 7)
-        vm = np.array([[ 243.99486949,   11.04572682,  -10.16711028],
-                       [  11.04572682,    2.13183469,   -1.08467261],
-                       [ -10.16711028,   -1.08467261,    0.67018062]]) 
-        np.testing.assert_array_almost_equal(reg.vm, vm, 7)
-
-    def test_white(self):
-        reg = BaseTSLS(self.y, self.X, self.yd, self.q, robust='white')
-        betas = np.array([[ 88.46579584], [  0.5200379 ], [ -1.58216593]])
-        np.testing.assert_array_almost_equal(reg.betas, betas, 7)
-        vm = np.array([[ 208.27139316,   15.6687805 ,  -11.53686154],
-                       [  15.6687805 ,    2.26882747,   -1.30312033],
-                       [ -11.53686154,   -1.30312033,    0.81940656]]) 
-        np.testing.assert_array_almost_equal(reg.vm, vm, 7)
-
-    def test_hac(self):
-        gwk = pysal.kernelW_from_shapefile(pysal.examples.get_path('columbus.shp'),k=15,function='triangular', fixed=False)
-        reg = BaseTSLS(self.y, self.X, self.yd, self.q, robust='hac', gwk=gwk)
-        betas = np.array([[ 88.46579584], [  0.5200379 ], [ -1.58216593]])
-        np.testing.assert_array_almost_equal(reg.betas, betas, 7)
-        vm = np.array([[ 231.07254978,   15.42050291,  -11.3941033 ],
-                       [  15.01376346,    1.92422887,   -1.11865505],
-                       [ -11.34381641,   -1.1279227 ,    0.72053806]]) 
-        np.testing.assert_array_almost_equal(reg.vm, vm, 7)
-
 class TestTSLS(unittest.TestCase):
     def setUp(self):
         db = pysal.open(pysal.examples.get_path("columbus.dbf"),'r')
diff --git a/pysal/contrib/handler/tests/test_twosls_sp.py b/pysal/contrib/handler/tests/test_twosls_sp.py
index 34a5fc4..54aa74f 100644
--- a/pysal/contrib/handler/tests/test_twosls_sp.py
+++ b/pysal/contrib/handler/tests/test_twosls_sp.py
@@ -7,167 +7,8 @@ import pysal.spreg.diagnostics as D
 from pysal.contrib.handler import Model
 from functools import partial
 
-BaseGM_Lag = partial(Model, mtype='BaseGM_Lag')
 GM_Lag = partial(Model, mtype='GM_Lag')
 
-class TestBaseGMLag(unittest.TestCase):
-    def setUp(self):
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-        self.db = pysal.open(pysal.examples.get_path("columbus.dbf"), 'r')
-        y = np.array(self.db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        
-    def test___init__(self):
-        w_lags = 2
-        X = []
-        X.append(self.db.by_col("INC"))
-        X.append(self.db.by_col("CRIME"))
-        self.X = np.array(X).T
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, w_lags, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        reg = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w.sparse, w_lags=w_lags)
-        betas = np.array([[  4.53017056e+01], [  6.20888617e-01], [ -4.80723451e-01], [  2.83622122e-02]])
-        np.testing.assert_array_almost_equal(reg.betas, betas, 7)
-        h_0 = np.array([  1.        ,  19.531     ,  15.72598   ,  18.594     ,
-                            24.7142675 ,  13.72216667,  27.82929567])
-        np.testing.assert_array_almost_equal(reg.h[0], h_0)
-        hth = np.  array([   49.        ,   704.371999  ,  1721.312371  ,   724.7435916 ,
-                             1707.35412945,   711.31248483,  1729.63201243])
-        np.testing.assert_array_almost_equal(reg.hth[0], hth, 7)
-        hthi = np.array([  7.33701328e+00,   2.27764882e-02,   2.18153588e-02,
-                           -5.11035447e-02,   1.22515181e-03,  -2.38079378e-01,
-                           -1.20149133e-01])
-        np.testing.assert_array_almost_equal(reg.hthi[0], hthi, 7)
-        self.assertEqual(reg.k, 4)
-        self.assertEqual(reg.kstar, 1)
-        self.assertAlmostEqual(reg.mean_y, 38.436224469387746, 7)
-        self.assertEqual(reg.n, 49)
-        pfora1a2 = np.array([ 80.5588479 ,  -1.06625281,  -0.61703759,  -1.10071931]) 
-        np.testing.assert_array_almost_equal(reg.pfora1a2[0], pfora1a2, 7)
-        predy_5 = np.array([[ 50.87411532],[ 50.76969931],[ 41.77223722],[ 33.44262382],[ 28.77418036]])
-        np.testing.assert_array_almost_equal(reg.predy[0:5], predy_5, 7)
-        q_5 = np.array([ 18.594     ,  24.7142675 ,  13.72216667,  27.82929567])
-        np.testing.assert_array_almost_equal(reg.q[0], q_5)
-        self.assertAlmostEqual(reg.sig2n_k, 234.54258763039289, 7)
-        self.assertAlmostEqual(reg.sig2n, 215.39625394627919, 7)
-        self.assertAlmostEqual(reg.sig2, 215.39625394627919, 7)
-        self.assertAlmostEqual(reg.std_y, 18.466069465206047, 7)
-        u_5 = np.array( [[ 29.59288768], [ -6.20269831], [-15.42223722], [ -0.24262282], [ -5.54918036]])
-        np.testing.assert_array_almost_equal(reg.u[0:5], u_5, 7)
-        self.assertAlmostEqual(reg.utu, 10554.41644336768, 7)
-        varb = np.array( [[  1.48966377e+00, -2.28698061e-02, -1.20217386e-02, -1.85763498e-02],
-                          [ -2.28698061e-02,  1.27893998e-03,  2.74600023e-04, -1.33497705e-04],
-                          [ -1.20217386e-02,  2.74600023e-04,  1.54257766e-04,  6.86851184e-05],
-                          [ -1.85763498e-02, -1.33497705e-04,  6.86851184e-05,  4.67711582e-04]])
-        np.testing.assert_array_almost_equal(reg.varb, varb, 7)
-        vm = np.array([[  3.20867996e+02, -4.92607057e+00, -2.58943746e+00, -4.00127615e+00],
-                       [ -4.92607057e+00,  2.75478880e-01,  5.91478163e-02, -2.87549056e-02],
-                       [ -2.58943746e+00,  5.91478163e-02,  3.32265449e-02,  1.47945172e-02],
-                       [ -4.00127615e+00, -2.87549056e-02,  1.47945172e-02,  1.00743323e-01]])
-        np.testing.assert_array_almost_equal(reg.vm, vm, 6)
-        x_0 = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_array_almost_equal(reg.x[0], x_0, 7)
-        y_5 = np.array( [[ 80.467003], [ 44.567001], [ 26.35    ], [ 33.200001], [ 23.225   ]])
-        np.testing.assert_array_almost_equal(reg.y[0:5], y_5, 7)
-        yend_5 = np.array( [[ 35.4585005 ], [ 46.67233467], [ 45.36475125], [ 32.81675025], [ 30.81785714]])
-        np.testing.assert_array_almost_equal(reg.yend[0:5], yend_5, 7)
-        z_0 = np.array([  1.       ,  19.531    ,  15.72598  ,  35.4585005]) 
-        np.testing.assert_array_almost_equal(reg.z[0], z_0, 7)
-        zthhthi = np.array( [[  1.00000000e+00, -2.22044605e-16, -2.22044605e-16 , 2.22044605e-16,
-                                4.44089210e-16,  0.00000000e+00, -8.88178420e-16],
-                             [  0.00000000e+00,  1.00000000e+00, -3.55271368e-15 , 3.55271368e-15,
-                               -7.10542736e-15,  7.10542736e-14,  0.00000000e+00],
-                             [  1.81898940e-12,  2.84217094e-14,  1.00000000e+00 , 0.00000000e+00,
-                               -2.84217094e-14,  5.68434189e-14,  5.68434189e-14],
-                             [ -8.31133940e+00, -3.76104678e-01, -2.07028208e-01 , 1.32618931e+00,
-                               -8.04284562e-01,  1.30527047e+00,  1.39136816e+00]])
-        np.testing.assert_array_almost_equal(reg.zthhthi, zthhthi, 7)
-
-    def test_init_white_(self):
-        w_lags = 2
-        X = []
-        X.append(self.db.by_col("INC"))
-        X.append(self.db.by_col("CRIME"))
-        self.X = np.array(X).T
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, w_lags, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        base_gm_lag = BaseGM_Lag(self.y, self.X,  yend=yd2, q=q2, w=self.w.sparse, w_lags=w_lags, robust='white')
-        tbetas = np.array([[  4.53017056e+01], [  6.20888617e-01], [ -4.80723451e-01], [  2.83622122e-02]])
-        np.testing.assert_array_almost_equal(base_gm_lag.betas, tbetas) 
-        dbetas = D.se_betas(base_gm_lag)
-        se_betas = np.array([ 20.47077481, 0.50613931, 0.20138425, 0.38028295 ])
-        np.testing.assert_array_almost_equal(dbetas, se_betas)
-
-    def test_init_hac_(self):
-        w_lags = 2
-        X = []
-        X.append(self.db.by_col("INC"))
-        X.append(self.db.by_col("CRIME"))
-        self.X = np.array(X).T
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, w_lags, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        gwk = pysal.kernelW_from_shapefile(pysal.examples.get_path('columbus.shp'),k=15,function='triangular', fixed=False)        
-        base_gm_lag = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w.sparse, w_lags=w_lags, robust='hac', gwk=gwk)
-        tbetas = np.array([[  4.53017056e+01], [  6.20888617e-01], [ -4.80723451e-01], [  2.83622122e-02]])
-        np.testing.assert_array_almost_equal(base_gm_lag.betas, tbetas) 
-        dbetas = D.se_betas(base_gm_lag)
-        se_betas = np.array([ 19.08513569,   0.51769543,   0.18244862,   0.35460553])
-        np.testing.assert_array_almost_equal(dbetas, se_betas)
-
-    def test_init_discbd(self):
-        w_lags = 2
-        X = np.array(self.db.by_col("INC"))
-        self.X = np.reshape(X, (49,1))
-        yd = np.array(self.db.by_col("CRIME"))
-        yd = np.reshape(yd, (49,1))
-        q = np.array(self.db.by_col("DISCBD"))
-        q = np.reshape(q, (49,1))
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, yd, q, w_lags, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        reg = BaseGM_Lag(self.y, self.X, w=self.w.sparse, yend=yd2, q=q2, w_lags=w_lags)
-        tbetas = np.array([[ 100.79359082], [  -0.50215501], [  -1.14881711], [  -0.38235022]])
-        np.testing.assert_array_almost_equal(tbetas, reg.betas)
-        dbetas = D.se_betas(reg)
-        se_betas = np.array([ 53.0829123 ,   1.02511494,   0.57589064,   0.59891744 ])
-        np.testing.assert_array_almost_equal(dbetas, se_betas)
-
-    def test_n_k(self):
-        w_lags = 2
-        X = []
-        X.append(self.db.by_col("INC"))
-        X.append(self.db.by_col("CRIME"))
-        self.X = np.array(X).T
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, w_lags, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        reg = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w.sparse, w_lags=w_lags, sig2n_k=True)
-        betas = np.  array([[  4.53017056e+01], [  6.20888617e-01], [ -4.80723451e-01], [  2.83622122e-02]])
-        np.testing.assert_array_almost_equal(reg.betas, betas, 7)
-        vm = np.array( [[  3.49389596e+02, -5.36394351e+00, -2.81960968e+00, -4.35694515e+00],
-                         [ -5.36394351e+00,  2.99965892e-01,  6.44054000e-02, -3.13108972e-02],
-                         [ -2.81960968e+00,  6.44054000e-02,  3.61800155e-02,  1.61095854e-02],
-                         [ -4.35694515e+00, -3.13108972e-02,  1.61095854e-02,  1.09698285e-01]])
-        np.testing.assert_array_almost_equal(reg.vm, vm, 7)
-
-    def test_lag_q(self):
-        w_lags = 2
-        X = np.array(self.db.by_col("INC"))
-        self.X = np.reshape(X, (49,1))
-        yd = np.array(self.db.by_col("CRIME"))
-        yd = np.reshape(yd, (49,1))
-        q = np.array(self.db.by_col("DISCBD"))
-        q = np.reshape(q, (49,1))
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, yd, q, w_lags, False)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        reg = BaseGM_Lag(self.y, self.X, w=self.w.sparse, yend=yd2, q=q2, w_lags=w_lags, lag_q=False)
-        tbetas = np.array( [[ 108.83261383], [  -0.48041099], [  -1.18950006], [  -0.56140186]])
-        np.testing.assert_array_almost_equal(tbetas, reg.betas)
-        dbetas = D.se_betas(reg)
-        se_betas = np.array([ 58.33203837,   1.09100446,   0.62315167,   0.68088777])
-        np.testing.assert_array_almost_equal(dbetas, se_betas)
-
-
-
 class TestGMLag(unittest.TestCase):
     def setUp(self):
         self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
@@ -321,7 +162,7 @@ class TestGMLag(unittest.TestCase):
         q = np.array(self.db.by_col("DISCBD"))
         q = np.reshape(q, (49,1))
         w = pysal.queen_from_shapefile(pysal.examples.get_path('columbus.shp'))
-        reg = GM_Lag(self.y, X, yd, q, spat_diag=True, w=w)
+        reg = GM_Lag(self.y, X, yend=yd, q=q, spat_diag=True, w=w)
         betas = np.array([[  5.46344924e+01], [  4.13301682e-01], [ -5.92637442e-01], [ -7.40490883e-03]])
         np.testing.assert_array_almost_equal(reg.betas, betas, 7)
         vm = np.array( [[  4.45202654e+02, -1.50290275e+01, -6.36557072e+00, -5.71403440e-03],
@@ -348,7 +189,7 @@ class TestGMLag(unittest.TestCase):
         name_w = 'queen'
         name_gwk = 'k=5'
         name_ds = 'columbus'
-        reg = GM_Lag(self.y, X, yd, q,
+        reg = GM_Lag(self.y, X, yend=yd, q=q,
                 spat_diag=True, w=w, robust='hac', gwk=gwk,
                 name_x=name_x, name_y=name_y, name_q=name_q, name_w=name_w,
                 name_yend=name_yend, name_gwk=name_gwk, name_ds=name_ds)
diff --git a/pysal/contrib/handler/tests/test_twosls_sp_sparse.py b/pysal/contrib/handler/tests/test_twosls_sp_sparse.py
index 4dac949..0c3affa 100644
--- a/pysal/contrib/handler/tests/test_twosls_sp_sparse.py
+++ b/pysal/contrib/handler/tests/test_twosls_sp_sparse.py
@@ -9,165 +9,6 @@ from functools import partial
 from pysal.contrib.handler import Model
 
 GM_Lag = partial(Model, mtype='GM_Lag')
-BaseGM_Lag = partial(Model, mtype='BaseGM_Lag')
-
-class TestBaseGMLag(unittest.TestCase):
-    def setUp(self):
-        self.w = pysal.rook_from_shapefile(pysal.examples.get_path("columbus.shp"))
-        self.w.transform = 'r'
-        self.db = pysal.open(pysal.examples.get_path("columbus.dbf"), 'r')
-        y = np.array(self.db.by_col("HOVAL"))
-        self.y = np.reshape(y, (49,1))
-        
-    def test___init__(self):
-        X = []
-        X.append(self.db.by_col("INC"))
-        X.append(self.db.by_col("CRIME"))
-        self.X = np.array(X).T
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, 2, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = SP.csr_matrix(self.X)
-        reg = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w, w_lags=2)
-        betas = np.array([[  4.53017056e+01], [  6.20888617e-01], [ -4.80723451e-01], [  2.83622122e-02]])
-        np.testing.assert_array_almost_equal(reg.betas, betas, 7)
-        h_0 = np.array([  1.        ,  19.531     ,  15.72598   ,  18.594     ,
-                            24.7142675 ,  13.72216667,  27.82929567])
-        np.testing.assert_array_almost_equal(reg.h.toarray()[0], h_0)
-        hth = np.array([   49.        ,   704.371999  ,  1721.312371  ,   724.7435916 ,
-                             1707.35412945,   711.31248483,  1729.63201243])
-        np.testing.assert_array_almost_equal(reg.hth[0], hth, 7)
-        hthi = np.array([  7.33701328e+00,   2.27764882e-02,   2.18153588e-02,
-                           -5.11035447e-02,   1.22515181e-03,  -2.38079378e-01,
-                           -1.20149133e-01])
-        np.testing.assert_array_almost_equal(reg.hthi[0], hthi, 7)
-        self.assertEqual(reg.k, 4)
-        self.assertEqual(reg.kstar, 1)
-        self.assertAlmostEqual(reg.mean_y, 38.436224469387746, 7)
-        self.assertEqual(reg.n, 49)
-        pfora1a2 = np.array([ 80.5588479 ,  -1.06625281,  -0.61703759,  -1.10071931]) 
-        np.testing.assert_array_almost_equal(reg.pfora1a2[0], pfora1a2, 7)
-        predy_5 = np.array([[ 50.87411532],[ 50.76969931],[ 41.77223722],[ 33.44262382],[ 28.77418036]])
-        np.testing.assert_array_almost_equal(reg.predy[0:5], predy_5, 7)
-        q_5 = np.array([ 18.594     ,  24.7142675 ,  13.72216667,  27.82929567])
-        np.testing.assert_array_almost_equal(reg.q[0], q_5)
-        self.assertAlmostEqual(reg.sig2n_k, 234.54258763039289, 7)
-        self.assertAlmostEqual(reg.sig2n, 215.39625394627919, 7)
-        self.assertAlmostEqual(reg.sig2, 215.39625394627919, 7)
-        self.assertAlmostEqual(reg.std_y, 18.466069465206047, 7)
-        u_5 = np.array( [[ 29.59288768], [ -6.20269831], [-15.42223722], [ -0.24262282], [ -5.54918036]])
-        np.testing.assert_array_almost_equal(reg.u[0:5], u_5, 7)
-        self.assertAlmostEqual(reg.utu, 10554.41644336768, 7)
-        varb = np.array( [[  1.48966377e+00, -2.28698061e-02, -1.20217386e-02, -1.85763498e-02],
-                          [ -2.28698061e-02,  1.27893998e-03,  2.74600023e-04, -1.33497705e-04],
-                          [ -1.20217386e-02,  2.74600023e-04,  1.54257766e-04,  6.86851184e-05],
-                          [ -1.85763498e-02, -1.33497705e-04,  6.86851184e-05,  4.67711582e-04]])
-        np.testing.assert_array_almost_equal(reg.varb, varb, 7)
-        vm = np.array([[  3.20867996e+02, -4.92607057e+00, -2.58943746e+00, -4.00127615e+00],
-                       [ -4.92607057e+00,  2.75478880e-01,  5.91478163e-02, -2.87549056e-02],
-                       [ -2.58943746e+00,  5.91478163e-02,  3.32265449e-02,  1.47945172e-02],
-                       [ -4.00127615e+00, -2.87549056e-02,  1.47945172e-02,  1.00743323e-01]])
-        np.testing.assert_array_almost_equal(reg.vm, vm, 6)
-        x_0 = np.array([  1.     ,  19.531  ,  15.72598])
-        np.testing.assert_array_almost_equal(reg.x.toarray()[0], x_0, 7)
-        y_5 = np.array( [[ 80.467003], [ 44.567001], [ 26.35    ], [ 33.200001], [ 23.225   ]])
-        np.testing.assert_array_almost_equal(reg.y[0:5], y_5, 7)
-        yend_5 = np.array( [[ 35.4585005 ], [ 46.67233467], [ 45.36475125], [ 32.81675025], [ 30.81785714]])
-        np.testing.assert_array_almost_equal(reg.yend[0:5], yend_5, 7)
-        z_0 = np.array([  1.       ,  19.531    ,  15.72598  ,  35.4585005]) 
-        np.testing.assert_array_almost_equal(reg.z.toarray()[0], z_0, 7)
-        zthhthi = np.array( [[  1.00000000e+00, -2.22044605e-16, -2.22044605e-16 , 2.22044605e-16,
-                                4.44089210e-16,  0.00000000e+00, -8.88178420e-16],
-                             [  0.00000000e+00,  1.00000000e+00, -3.55271368e-15 , 3.55271368e-15,
-                               -7.10542736e-15,  7.10542736e-14,  0.00000000e+00],
-                             [  1.81898940e-12,  2.84217094e-14,  1.00000000e+00 , 0.00000000e+00,
-                               -2.84217094e-14,  5.68434189e-14,  5.68434189e-14],
-                             [ -8.31133940e+00, -3.76104678e-01, -2.07028208e-01 , 1.32618931e+00,
-                               -8.04284562e-01,  1.30527047e+00,  1.39136816e+00]])
-        np.testing.assert_array_almost_equal(reg.zthhthi, zthhthi, 7)
-
-    def test_init_white_(self):
-        X = []
-        X.append(self.db.by_col("INC"))
-        X.append(self.db.by_col("CRIME"))
-        self.X = np.array(X).T
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, 2, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = SP.csr_matrix(self.X)
-        base_gm_lag = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w, w_lags=2, robust='white')
-        tbetas = np.array([[  4.53017056e+01], [  6.20888617e-01], [ -4.80723451e-01], [  2.83622122e-02]])
-        np.testing.assert_array_almost_equal(base_gm_lag.betas, tbetas) 
-        dbetas = D.se_betas(base_gm_lag)
-        se_betas = np.array([ 20.47077481, 0.50613931, 0.20138425, 0.38028295 ])
-        np.testing.assert_array_almost_equal(dbetas, se_betas)
-
-    def test_init_hac_(self):
-        X = []
-        X.append(self.db.by_col("INC"))
-        X.append(self.db.by_col("CRIME"))
-        self.X = np.array(X).T
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, 2, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = SP.csr_matrix(self.X)
-        gwk = pysal.kernelW_from_shapefile(pysal.examples.get_path('columbus.shp'),k=15,function='triangular', fixed=False)        
-        base_gm_lag = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w, w_lags=2, robust='hac', gwk=gwk)
-        tbetas = np.array([[  4.53017056e+01], [  6.20888617e-01], [ -4.80723451e-01], [  2.83622122e-02]])
-        np.testing.assert_array_almost_equal(base_gm_lag.betas, tbetas) 
-        dbetas = D.se_betas(base_gm_lag)
-        se_betas = np.array([ 19.08513569,   0.51769543,   0.18244862,   0.35460553])
-        np.testing.assert_array_almost_equal(dbetas, se_betas)
-
-    def test_init_discbd(self):
-        X = np.array(self.db.by_col("INC"))
-        self.X = np.reshape(X, (49,1))
-        yd = np.array(self.db.by_col("CRIME"))
-        yd = np.reshape(yd, (49,1))
-        q = np.array(self.db.by_col("DISCBD"))
-        q = np.reshape(q, (49,1))
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, yd, q, 2, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = SP.csr_matrix(self.X)
-        reg = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w, w_lags=2)
-        tbetas = np.array([[ 100.79359082], [  -0.50215501], [  -1.14881711], [  -0.38235022]])
-        np.testing.assert_array_almost_equal(tbetas, reg.betas)
-        dbetas = D.se_betas(reg)
-        se_betas = np.array([ 53.0829123 ,   1.02511494,   0.57589064,   0.59891744 ])
-        np.testing.assert_array_almost_equal(dbetas, se_betas)
-
-    def test_n_k(self):
-        X = []
-        X.append(self.db.by_col("INC"))
-        X.append(self.db.by_col("CRIME"))
-        self.X = np.array(X).T
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, 2, True)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = SP.csr_matrix(self.X)
-        reg = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w, w_lags=2, sig2n_k=True)
-        betas = np.  array([[  4.53017056e+01], [  6.20888617e-01], [ -4.80723451e-01], [  2.83622122e-02]])
-        np.testing.assert_array_almost_equal(reg.betas, betas, 7)
-        vm = np.array( [[  3.49389596e+02, -5.36394351e+00, -2.81960968e+00, -4.35694515e+00],
-                         [ -5.36394351e+00,  2.99965892e-01,  6.44054000e-02, -3.13108972e-02],
-                         [ -2.81960968e+00,  6.44054000e-02,  3.61800155e-02,  1.61095854e-02],
-                         [ -4.35694515e+00, -3.13108972e-02,  1.61095854e-02,  1.09698285e-01]])
-        np.testing.assert_array_almost_equal(reg.vm, vm, 7)
-
-    def test_lag_q(self):
-        X = np.array(self.db.by_col("INC"))
-        self.X = np.reshape(X, (49,1))
-        yd = np.array(self.db.by_col("CRIME"))
-        yd = np.reshape(yd, (49,1))
-        q = np.array(self.db.by_col("DISCBD"))
-        q = np.reshape(q, (49,1))
-        yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, yd, q, 2, False)
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = SP.csr_matrix(self.X)
-        reg = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w, w_lags=2, lag_q=False)
-        tbetas = np.array( [[ 108.83261383], [  -0.48041099], [  -1.18950006], [  -0.56140186]])
-        np.testing.assert_array_almost_equal(tbetas, reg.betas)
-        dbetas = D.se_betas(reg)
-        se_betas = np.array([ 58.33203837,   1.09100446,   0.62315167,   0.68088777])
-        np.testing.assert_array_almost_equal(dbetas, se_betas)
-
-
 
 class TestGMLag(unittest.TestCase):
     def setUp(self):
@@ -329,7 +170,7 @@ class TestGMLag(unittest.TestCase):
         q = np.array(self.db.by_col("DISCBD"))
         q = np.reshape(q, (49,1))
         w = pysal.queen_from_shapefile(pysal.examples.get_path('columbus.shp'))
-        reg = GM_Lag(self.y, X, yd, q, spat_diag=True, w=w)
+        reg = GM_Lag(self.y, X, yend=yd, q=q, spat_diag=True, w=w)
         betas = np.array([[  5.46344924e+01], [  4.13301682e-01], [ -5.92637442e-01], [ -7.40490883e-03]])
         np.testing.assert_array_almost_equal(reg.betas, betas, 7)
         vm = np.array( [[  4.45202654e+02, -1.50290275e+01, -6.36557072e+00, -5.71403440e-03],
@@ -357,7 +198,7 @@ class TestGMLag(unittest.TestCase):
         name_w = 'queen'
         name_gwk = 'k=5'
         name_ds = 'columbus'
-        reg = GM_Lag(self.y, X, yd, q,
+        reg = GM_Lag(self.y, X, yend=yd, q=q,
                 spat_diag=True, w=w, robust='hac', gwk=gwk,
                 name_x=name_x, name_y=name_y, name_q=name_q, name_w=name_w,
                 name_yend=name_yend, name_gwk=name_gwk, name_ds=name_ds)
diff --git a/pysal/contrib/handler/tests/test_twosls_sparse.py b/pysal/contrib/handler/tests/test_twosls_sparse.py
index d3c8f10..3521755 100644
--- a/pysal/contrib/handler/tests/test_twosls_sparse.py
+++ b/pysal/contrib/handler/tests/test_twosls_sparse.py
@@ -8,106 +8,6 @@ from pysal.contrib.handler import Model
 from functools import partial
 
 TSLS = partial(Model, mtype='TSLS')
-BaseTSLS = partial(Model, mtype='BaseTSLS')
-
-class TestBaseTSLS(unittest.TestCase):
-    def setUp(self):
-        db = pysal.open(pysal.examples.get_path("columbus.dbf"),'r')
-        self.y = np.array(db.by_col("CRIME"))
-        self.y = np.reshape(self.y, (49,1))
-        self.X = []
-        self.X.append(db.by_col("INC"))
-        self.X = np.array(self.X).T
-        self.X = np.hstack((np.ones(self.y.shape),self.X))
-        self.X = SP.csr_matrix(self.X)
-        self.yd = []
-        self.yd.append(db.by_col("HOVAL"))
-        self.yd = np.array(self.yd).T
-        self.q = []
-        self.q.append(db.by_col("DISCBD"))
-        self.q = np.array(self.q).T
-
-    def test_basic(self):
-        reg = BaseTSLS(self.y, self.X, self.yd, self.q)
-        betas = np.array([[ 88.46579584], [  0.5200379 ], [ -1.58216593]])
-        np.testing.assert_array_almost_equal(reg.betas, betas, 7)
-        h_0 = np.array([  1.   ,  19.531,   5.03 ])
-        np.testing.assert_array_almost_equal(reg.h.toarray()[0], h_0)
-        hth = np.array([[    49.        ,    704.371999  ,    139.75      ],
-                        [   704.371999  ,  11686.67338121,   2246.12800625],
-                        [   139.75      ,   2246.12800625,    498.5851    ]])
-        np.testing.assert_array_almost_equal(reg.hth, hth, 7)
-        hthi = np.array([[ 0.1597275 , -0.00762011, -0.01044191],
-                        [-0.00762011,  0.00100135, -0.0023752 ],
-                        [-0.01044191, -0.0023752 ,  0.01563276]]) 
-        np.testing.assert_array_almost_equal(reg.hthi, hthi, 7)
-        self.assertEqual(reg.k, 3)
-        self.assertEqual(reg.kstar, 1)
-        self.assertAlmostEqual(reg.mean_y, 35.128823897959187, 7)
-        self.assertEqual(reg.n, 49)
-        pfora1a2 = np.array([[ 9.58156106, -0.22744226, -0.13820537],
-                             [ 0.02580142,  0.08226331, -0.03143731],
-                             [-3.13896453, -0.33487872,  0.20690965]]) 
-        np.testing.assert_array_almost_equal(reg.pfora1a2, pfora1a2, 7)
-        predy_5 = np.array([[-28.68949467], [ 28.99484984], [ 55.07344824], [ 38.26609504], [ 57.57145851]]) 
-        np.testing.assert_array_almost_equal(reg.predy[0:5], predy_5, 7)
-        q_5 = np.array([[ 5.03], [ 4.27], [ 3.89], [ 3.7 ], [ 2.83]])
-        np.testing.assert_array_equal(reg.q[0:5], q_5)
-        self.assertAlmostEqual(reg.sig2n_k, 587.56797852699822, 7)
-        self.assertAlmostEqual(reg.sig2n, 551.5944288212637, 7)
-        self.assertAlmostEqual(reg.sig2, 551.5944288212637, 7)
-        self.assertAlmostEqual(reg.std_y, 16.732092091229699, 7)
-        u_5 = np.array([[ 44.41547467], [-10.19309584], [-24.44666724], [ -5.87833504], [ -6.83994851]]) 
-        np.testing.assert_array_almost_equal(reg.u[0:5], u_5, 7)
-        self.assertAlmostEqual(reg.utu, 27028.127012241919, 7)
-        varb = np.array([[ 0.41526237,  0.01879906, -0.01730372],
-                         [ 0.01879906,  0.00362823, -0.00184604],
-                         [-0.01730372, -0.00184604,  0.0011406 ]]) 
-        np.testing.assert_array_almost_equal(reg.varb, varb, 7)
-        vm = np.array([[ 229.05640809,   10.36945783,   -9.54463414],
-                       [  10.36945783,    2.0013142 ,   -1.01826408],
-                       [  -9.54463414,   -1.01826408,    0.62914915]]) 
-        np.testing.assert_array_almost_equal(reg.vm, vm, 7)
-        x_0 = np.array([  1.   ,  19.531])
-        np.testing.assert_array_almost_equal(reg.x.toarray()[0], x_0, 7)
-        y_5 = np.array([[ 15.72598 ], [ 18.801754], [ 30.626781], [ 32.38776 ], [ 50.73151 ]]) 
-        np.testing.assert_array_almost_equal(reg.y[0:5], y_5, 7)
-        yend_5 = np.array([[ 80.467003], [ 44.567001], [ 26.35    ], [ 33.200001], [ 23.225   ]]) 
-        np.testing.assert_array_almost_equal(reg.yend[0:5], yend_5, 7)
-        z_0 = np.array([  1.      ,  19.531   ,  80.467003]) 
-        np.testing.assert_array_almost_equal(reg.z.toarray()[0], z_0, 7)
-        zthhthi = np.array([[  1.00000000e+00,  -1.66533454e-16,   4.44089210e-16],
-                            [  0.00000000e+00,   1.00000000e+00,   0.00000000e+00],
-                            [  1.26978671e+01,   1.05598709e+00,   3.70212359e+00]]) 
-        np.testing.assert_array_almost_equal(reg.zthhthi, zthhthi, 7)
-        
-    def test_n_k(self):
-        reg = BaseTSLS(self.y, self.X, self.yd, self.q, sig2n_k=True)
-        betas = np.array([[ 88.46579584], [  0.5200379 ], [ -1.58216593]])
-        np.testing.assert_array_almost_equal(reg.betas, betas, 7)
-        vm = np.array([[ 243.99486949,   11.04572682,  -10.16711028],
-                       [  11.04572682,    2.13183469,   -1.08467261],
-                       [ -10.16711028,   -1.08467261,    0.67018062]]) 
-        np.testing.assert_array_almost_equal(reg.vm, vm, 7)
-
-    def test_white(self):
-        reg = BaseTSLS(self.y, self.X, self.yd, self.q, robust='white')
-        betas = np.array([[ 88.46579584], [  0.5200379 ], [ -1.58216593]])
-        np.testing.assert_array_almost_equal(reg.betas, betas, 7)
-        vm = np.array([[ 208.27139316,   15.6687805 ,  -11.53686154],
-                       [  15.6687805 ,    2.26882747,   -1.30312033],
-                       [ -11.53686154,   -1.30312033,    0.81940656]]) 
-        np.testing.assert_array_almost_equal(reg.vm, vm, 7)
-
-    def test_hac(self):
-        gwk = pysal.kernelW_from_shapefile(pysal.examples.get_path('columbus.shp'),k=15,function='triangular', fixed=False)
-        reg = BaseTSLS(self.y, self.X, self.yd, self.q, robust='hac', gwk=gwk)
-        betas = np.array([[ 88.46579584], [  0.5200379 ], [ -1.58216593]])
-        np.testing.assert_array_almost_equal(reg.betas, betas, 7)
-        vm = np.array([[ 231.07254978,   15.42050291,  -11.3941033 ],
-                       [  15.01376346,    1.92422887,   -1.11865505],
-                       [ -11.34381641,   -1.1279227 ,    0.72053806]]) 
-        np.testing.assert_array_almost_equal(reg.vm, vm, 7)
 
 class TestTSLS(unittest.TestCase):
     def setUp(self):
diff --git a/pysal/esda/moran.py b/pysal/esda/moran.py
index b3ec42a..4cec902 100644
--- a/pysal/esda/moran.py
+++ b/pysal/esda/moran.py
@@ -309,7 +309,7 @@ class Moran_BV:
         self.zx = zx
         self.zy = zy
         n = x.shape[0]
-        self.den =  n - 1.  # zx'zx = zy'zy = n-1
+        self.den = n - 1.  # zx'zx = zy'zy = n-1
         w.transform = transformation
         self.w = w
         self.I = self.__calc(zy)
@@ -568,21 +568,21 @@ class Moran_Local:
                    alternative: the observed Ii is further away or extreme
                    from the median of simulated values. It is either extremelyi
                    high or extremely low in the distribution of simulated Is.
-    EI_sim       : float
+    EI_sim       : array
                    (if permutations>0)
-                   average value of I from permutations
-    VI_sim       : float
+                   average values of local Is from permutations
+    VI_sim       : array
                    (if permutations>0)
-                   variance of I from permutations
-    seI_sim      : float
+                   variance of Is from permutations
+    seI_sim      : array
                    (if permutations>0)
-                   standard deviation of I under permutations.
-    z_sim        : float
+                   standard deviations of Is under permutations.
+    z_sim        : arrray
                    (if permutations>0)
-                   standardized I based on permutations
-    p_z_sim      : float
+                   standardized Is based on permutations
+    p_z_sim      : array
                    (if permutations>0)
-                   p-value based on standard normal approximation from
+                   p-values based on standard normal approximation from
                    permutations (one-sided)
                    for two-sided tests, these values should be multiplied by 2
 
@@ -598,7 +598,7 @@ class Moran_Local:
     >>> lm.q
     array([4, 4, 4, 2, 3, 3, 1, 4, 3, 3])
     >>> lm.p_z_sim[0]
-    0.46756830387716064
+    0.24669152541631179
     >>> lm = ps.Moran_Local(y, w, transformation = "r", permutations = 99, \
                             geoda_quads=True)
     >>> lm.q
@@ -642,8 +642,8 @@ class Moran_Local:
             larger[low_extreme] = self.permutations - larger[low_extreme]
             self.p_sim = (larger + 1.0) / (permutations + 1.0)
             self.sim = sim
-            self.EI_sim = sim.mean()
-            self.seI_sim = sim.std()
+            self.EI_sim = sim.mean(axis=0)
+            self.seI_sim = sim.std(axis=0)
             self.VI_sim = self.seI_sim * self.seI_sim
             self.z_sim = (self.Is - self.EI_sim) / self.seI_sim
             self.p_z_sim = 1 - stats.norm.cdf(np.abs(self.z_sim))
@@ -750,24 +750,25 @@ class Moran_Local_BV:
                    alternative: the observed Ii is further away or extreme
                    from the median of simulated values. It is either extremelyi
                    high or extremely low in the distribution of simulated Is.
-    EI_sim       : float
+    EI_sim       : array
                    (if permutations>0)
-                   average value of I from permutations
-    VI_sim       : float
+                   average values of local Is from permutations
+    VI_sim       : array
                    (if permutations>0)
-                   variance of I from permutations
-    seI_sim      : float
+                   variance of Is from permutations
+    seI_sim      : array
                    (if permutations>0)
-                   standard deviation of I under permutations.
-    z_sim        : float
+                   standard deviations of Is under permutations.
+    z_sim        : arrray
                    (if permutations>0)
-                   standardized I based on permutations
-    p_z_sim      : float
+                   standardized Is based on permutations
+    p_z_sim      : array
                    (if permutations>0)
-                   p-value based on standard normal approximation from
+                   p-values based on standard normal approximation from
                    permutations (one-sided)
                    for two-sided tests, these values should be multiplied by 2
 
+
     Examples
     --------
     >>> import pysal as ps
@@ -830,8 +831,8 @@ class Moran_Local_BV:
             larger[low_extreme] = self.permutations - larger[low_extreme]
             self.p_sim = (larger + 1.0) / (permutations + 1.0)
             self.sim = sim
-            self.EI_sim = sim.mean()
-            self.seI_sim = sim.std()
+            self.EI_sim = sim.mean(axis=0)
+            self.seI_sim = sim.std(axis=0)
             self.VI_sim = self.seI_sim * self.seI_sim
             self.z_sim = (self.Is - self.EI_sim) / self.seI_sim
             self.p_z_sim = 1 - stats.norm.cdf(np.abs(self.z_sim))
diff --git a/pysal/esda/tests/test_moran.py b/pysal/esda/tests/test_moran.py
index f61e962..858916b 100644
--- a/pysal/esda/tests/test_moran.py
+++ b/pysal/esda/tests/test_moran.py
@@ -62,9 +62,8 @@ class Moran_Local_Tester(unittest.TestCase):
     def test_Moran_Local(self):
         lm = moran.Moran_Local(
             self.y, self.w, transformation="r", permutations=99)
-        self.assertAlmostEquals(lm.z_sim[0], -0.081383956359666748)
-        self.assertAlmostEquals(lm.p_z_sim[0], 0.46756830387716064)
-        self.assertAlmostEquals(lm.VI_sim, 0.2067126047680822)
+        self.assertAlmostEquals(lm.z_sim[0], -0.68493799168603808)
+        self.assertAlmostEquals(lm.p_z_sim[0],  0.24669152541631179)
 
 
 class Moran_Local_BV_Tester(unittest.TestCase):
@@ -79,9 +78,8 @@ class Moran_Local_BV_Tester(unittest.TestCase):
         lm = moran.Moran_Local_BV(self.x, self.y, self.w,
                                   transformation="r", permutations=99)
         self.assertAlmostEquals(lm.Is[0], 1.4649221250620736)
-        self.assertAlmostEquals(lm.z_sim[0], 2.9246889997781773)
-        self.assertAlmostEquals(lm.p_z_sim[0], 0.0017240031348827456)
-        self.assertAlmostEquals(lm.VI_sim, 0.24983591065175745)
+        self.assertAlmostEquals(lm.z_sim[0],  1.5816540860500772)
+        self.assertAlmostEquals(lm.p_z_sim[0], 0.056864279811026153)
 
 
 class Moran_Local_Rate_Tester(unittest.TestCase):
@@ -95,13 +93,12 @@ class Moran_Local_Rate_Tester(unittest.TestCase):
     def test_moran_rate(self):
         lm = moran.Moran_Local_Rate(self.e, self.b, self.w,
                                     transformation="r", permutations=99)
-        self.assertAlmostEquals(lm.z_sim[0], -0.27099998923550017)
-        self.assertAlmostEquals(lm.p_z_sim[0], 0.39319552026912641)
-        self.assertAlmostEquals(lm.VI_sim, 0.21879403675396222)
+        self.assertAlmostEquals(lm.z_sim[0], -0.13699844503985936)
+        self.assertAlmostEquals(lm.p_z_sim[0], 0.44551601210081715)
 
 
 suite = unittest.TestSuite()
-test_classes = [Moran_Tester, Moran_Rate_Tester, 
+test_classes = [Moran_Tester, Moran_Rate_Tester,
                 Moran_BV_matrix_Tester, Moran_Local_Tester,
                 Moran_Local_BV_Tester, Moran_Local_Rate_Tester]
 for i in test_classes:
diff --git a/pysal/meta/wmd.py b/pysal/meta/wmd.py
index e1bd3d0..f2c3491 100644
--- a/pysal/meta/wmd.py
+++ b/pysal/meta/wmd.py
@@ -1,6 +1,12 @@
 import pysal as ps
 import json
-from six.moves import urllib as urllib
+
+# compatibility for Python 2 & Python 3:
+try:
+    from urllib.request import urlopen
+except ImportError:
+    from urllib2 import urlopen
+
 import copy
 import numpy as np
 
@@ -352,7 +358,7 @@ WEIGHT_TYPES['intersection'] = _intersection
 
 
 def _uri_reader(uri):
-    j = json.load(urllib.urlopen(uri))
+    j = json.load(urlopen(uri))
     return j
 
 def _wmd_read_only(fileName):
@@ -411,7 +417,7 @@ def _download_shapefiles(file_name):
         file_parts[-1] = file_name
         new_url = "/".join(file_parts)
         #print file_name, new_url
-        u = urllib.urlopen(new_url)
+        u = urlopen(new_url)
         f = open(file_name, 'wb')
         meta = u.info()
         file_size = int(meta.getheaders("Content-Length")[0])
diff --git a/pysal/version.py b/pysal/version.py
index 4dcf25d..6be3469 100644
--- a/pysal/version.py
+++ b/pysal/version.py
@@ -1,3 +1,3 @@
 import datetime
-version = "1.11.1"
-stable_release_date = datetime.date(2016, 4, 1)
+version = "1.11.2"
+stable_release_date = datetime.date(2016, 5, 18)
diff --git a/pysal/weights/Distance.py b/pysal/weights/Distance.py
index 7d6bec1..223d2c2 100644
--- a/pysal/weights/Distance.py
+++ b/pysal/weights/Distance.py
@@ -11,11 +11,11 @@ from pysal.common import KDTree
 from pysal.weights import W
 import scipy.stats
 import numpy as np
+from util import isKDTree
 
 __all__ = ["knnW", "Kernel", "DistanceBand"]
 
-
-def knnW(kdtree, k=2, p=2, ids=None):
+def knnW(data, k=2, p=2, ids=None):
     """
     Creates nearest neighbor weights matrix based on k nearest
     neighbors.
@@ -82,8 +82,12 @@ def knnW(kdtree, k=2, p=2, ids=None):
     pysal.weights.W
 
     """
-    data = kdtree.data
-    nnq = kdtree.query(data, k=k+1, p=p)
+    if isKDTree(data):
+        kdt = data
+        data = kdt.data
+    else:
+        kdt = KDTree(data)
+    nnq = kdt.query(data, k=k+1, p=p)
     info = nnq[1]
 
     neighbors = {}
@@ -264,7 +268,7 @@ class Kernel(W):
     def __init__(self, data, bandwidth=None, fixed=True, k=2,
                  function='triangular', eps=1.0000001, ids=None,
                  diagonal=False):
-        if issubclass(type(data), scipy.spatial.KDTree):
+        if isKDTree(data):
             self.kdt = data
             self.data = self.kdt.data
             data = self.data
@@ -357,7 +361,7 @@ class Kernel(W):
             c = c ** (-0.5)
             self.kernel = [c * np.exp(-(zi ** 2) / 2.) for zi in zs]
         else:
-            print 'Unsupported kernel function', self.function
+            print('Unsupported kernel function', self.function)
 
 
 class DistanceBand(W):
@@ -401,24 +405,21 @@ class DistanceBand(W):
     --------
 
     >>> points=[(10, 10), (20, 10), (40, 10), (15, 20), (30, 20), (30, 30)]
+    >>> wcheck = pysal.W({0: [1, 3], 1: [0, 3], 2: [], 3: [0, 1], 4: [5], 5: [4]})
+    WARNING: there is one disconnected observation (no neighbors)
+    Island id:  [2]
     >>> w=DistanceBand(points,threshold=11.2)
     WARNING: there is one disconnected observation (no neighbors)
     Island id:  [2]
-    >>> w.weights
-    {0: [1, 1], 1: [1, 1], 2: [], 3: [1, 1], 4: [1], 5: [1]}
-    >>> w.neighbors
-    {0: [1, 3], 1: [0, 3], 2: [], 3: [1, 0], 4: [5], 5: [4]}
+    >>> pysal.weights.util.neighbor_equality(w, wcheck)
+    True
     >>> w=DistanceBand(points,threshold=14.2)
-    >>> w.weights
-    {0: [1, 1], 1: [1, 1, 1], 2: [1], 3: [1, 1], 4: [1, 1, 1], 5: [1]}
-    >>> ps.weights.util.neighbor_equality(w,pysal.W( {0: [1, 3], 1: [0, 3, 4],
-                                                     2: [4], 3: [1, 0], 4:
-                                                     [5, 2, 1], 5: [4]}))
+    >>> wcheck = pysal.W({0: [1, 3], 1: [0, 3, 4], 2: [4], 3: [1, 0], 4: [5, 2, 1], 5: [4]})
+    >>> pysal.weights.util.neighbor_equality(w, wcheck)
     True
 
 
 
-
     inverse distance weights
 
     >>> w=DistanceBand(points,threshold=11.2,binary=False)
@@ -452,7 +453,7 @@ class DistanceBand(W):
         See detail in pysal issue #126.
 
         """
-        if issubclass(type(data), scipy.spatial.KDTree):
+        if isKDTree(data):
             self.kd = data
             self.data = self.kd.data
         else:
diff --git a/pysal/weights/spatial_lag.py b/pysal/weights/spatial_lag.py
index 5615ad7..24c88fa 100644
--- a/pysal/weights/spatial_lag.py
+++ b/pysal/weights/spatial_lag.py
@@ -5,7 +5,7 @@ __author__ = "Sergio J. Rey <srey at asu.edu>, David C. Folch <david.folch at asu.edu>
 __all__ = ['lag_spatial', 'lag_categorical']
 
 import numpy as np
-from six import iteritems as diter
+from pysal.common import iteritems as diter
 
 def lag_spatial(w, y):
     """
@@ -128,43 +128,30 @@ def lag_categorical(w, y, ties='tryself'):
 
     >>> import pysal
     >>> import numpy as np
+    >>> np.random.seed(12345)
     >>> w = pysal.lat2W(3, 3)
     >>> y = ['a','b','a','b','c','b','c','b','c']
     >>> y_l = pysal.weights.spatial_lag.lag_categorical(w, y)
-    >>> y_l
-    array(['b', 'a', 'b', 'c', 'b', 'c', 'b', 'c', 'b'], dtype='|S1')
+    >>> np.array_equal(y_l, np.array(['b', 'a', 'b', 'c', 'b', 'c', 'b', 'c', 'b']))
+    True
 
     Explicitly reshape y into a (9x1) array and calculate lag again
 
     >>> yvect = np.array(y).reshape(9,1)
     >>> yvect_l = pysal.weights.spatial_lag.lag_categorical(w,yvect)
-    array([['b'],
-           ['a'],
-           ['b'],
-           ['c'],
-           ['b'],
-           ['c'],
-           ['b'],
-           ['c'],
-           ['b']],
-          dtype='|S1')
+    >>> check = np.array( [ [i] for i in  ['b', 'a', 'b', 'c', 'b', 'c', 'b', 'c', 'b']] )
+    >>> np.array_equal(yvect_l, check)
+    True
 
     compute the lag of a 9x2 matrix of categories
 
     >>> y2 = ['a', 'c', 'c', 'd', 'b', 'a', 'd', 'd', 'c']
     >>> ym = np.vstack((y,y2)).T
     >>> ym_lag = pysal.weights.spatial_lag.lag_categorical(w,ym)
-    >>> ym_lag
-    array([['b', 'b'],
-	   ['a', 'c'],
-	   ['b', 'c'],
-	   ['c', 'd'],
-	   ['b', 'd'],
-	   ['c', 'c'],
-	   ['c', 'd'],
-	   ['c', 'd'],
-	   ['b', 'b']],
-	  dtype='|S1')
+    >>> check = np.array([['b', 'b'], ['a', 'c'], ['b', 'c'], ['c', 'd'], ['b', 'd'], ['c', 'c'], ['b', 'd'], ['c', 'd'], ['b', 'b']])
+    >>> np.array_equal(check, ym_lag)
+    True
+
     """
     if isinstance(y, list):
         y = np.array(y)
diff --git a/pysal/weights/user.py b/pysal/weights/user.py
index ed21235..7a24e55 100644
--- a/pysal/weights/user.py
+++ b/pysal/weights/user.py
@@ -359,13 +359,15 @@ def threshold_binaryW_from_array(array, threshold, p=2, radius=None):
     Examples
     --------
     >>> points=[(10, 10), (20, 10), (40, 10), (15, 20), (30, 20), (30, 30)]
+    >>> wcheck = pysal.W({0: [1, 3], 1: [0, 3, ], 2: [], 3: [1, 0], 4: [5], 5: [4]})
+    WARNING: there is one disconnected observation (no neighbors)
+    Island id:  [2]
     >>> w=threshold_binaryW_from_array(points,threshold=11.2)
     WARNING: there is one disconnected observation (no neighbors)
     Island id:  [2]
-    >>> w.weights
-    {0: [1, 1], 1: [1, 1], 2: [], 3: [1, 1], 4: [1], 5: [1]}
-    >>> w.neighbors
-    {0: [1, 3], 1: [0, 3], 2: [], 3: [1, 0], 4: [5], 5: [4]}
+    >>> pysal.weights.util.neighbor_equality(w, wcheck)
+    True
+
     >>>
     """
     if radius is not None:
@@ -1089,8 +1091,11 @@ def min_threshold_dist_from_shapefile(shapefile, radius=None, p=2):
     """
     points = get_points_array_from_shapefile(shapefile)
     if radius is not None:
-        points = pysal.cg.KDTree(points, distance_metric='Arc', radius=radius)
-    return min_threshold_distance(points,p)
+        kdt = pysal.cg.kdtree.Arc_KDTree(points, radius=radius)
+        nn = kdt.query(kdt.data, k=2)
+        nnd = nn[0].max(axis=0)[1]
+        return nnd
+    return min_threshold_distance(points, p)
 
 
 def build_lattice_shapefile(nrows, ncols, outFileName):
diff --git a/pysal/weights/util.py b/pysal/weights/util.py
index 98e1178..4ab3b48 100644
--- a/pysal/weights/util.py
+++ b/pysal/weights/util.py
@@ -15,6 +15,8 @@ __all__ = ['lat2W', 'block_weights', 'comb', 'order', 'higher_order',
            'higher_order_sp', 'hexLat2W', 'regime_weights']
 
 
+KDTREE_TYPES = [scipy.spatial.KDTree, scipy.spatial.cKDTree]
+
 def hexLat2W(nrows=5, ncols=5):
     """
     Create a W object for a hexagonal lattice.
@@ -647,10 +649,10 @@ def shimbel(w):
 
     info = {}
     ids = w.id_order
-    for id in ids:
+    for i in ids:
         s = [0] * w.n
-        s[ids.index(id)] = -1
-        for j in w.neighbors[id]:
+        s[ids.index(i)] = -1
+        for j in w.neighbors[i]:
             s[ids.index(j)] = 1
         k = 1
         flag = s.count(0)
@@ -667,7 +669,7 @@ def shimbel(w):
                         s[nid] = knext
             k = knext
             flag = s.count(0)
-        info[id] = s
+        info[i] = s
     return info
 
 
@@ -1256,6 +1258,13 @@ def neighbor_equality(w1, w2):
             return False
     return True
 
+def isKDTree(obj):
+    """
+    This is a utility function to determine whether or not an object is a
+    KDTree, since KDTree and cKDTree have no common parent type
+    """
+    return any([issubclass(type(obj), KDTYPE) for KDTYPE in KDTREE_TYPES])
+
 if __name__ == "__main__":
     from pysal import lat2W
 
diff --git a/setup.py b/setup.py
index c270edc..823fbbd 100644
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,7 @@ with open('README.rst') as file:
 
 MAJOR = 1
 MINOR = 11
-MICRO = 1
+MICRO = 2
 ISRELEASED = False
 VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pysal.git



More information about the Pkg-grass-devel mailing list