API Reference

This is the class and function reference of pysal.

pysal.lib: PySAL Core

Spatial Weights

weights.W(neighbors[, weights, id_order, …]) Spatial weights class.

Distance Weights

weights.DistanceBand(data, threshold[, p, …]) Spatial weights based on distance band.
weights.Kernel(data[, bandwidth, fixed, k, …]) Spatial weights based on kernel functions.
weights.KNN(data[, k, p, ids, radius, …]) Creates nearest neighbor weights matrix based on k nearest neighbors.

Contiguity Weights

weights.Queen(polygons, **kw) Construct a weights object from a collection of pysal polygons that share at least one vertex.
weights.Rook(polygons, **kw) Construct a weights object from a collection of pysal polygons that share at least one edge.
weights.Voronoi(points) Voronoi weights for a 2-d point set
weights.W(neighbors[, weights, id_order, …]) Spatial weights class.

spint Weights

weights.WSP(sparse[, id_order]) Thin W class for spreg.
weights.netW(link_list[, share, transform]) Create a network-contiguity based weight object based on different nodal relationships encoded in a network.
weights.mat2L(edge_matrix) Convert a matrix denoting network connectivity (edges or flows) to a list denoting edges
weights.ODW(Wo, Wd[, transform, …]) Constructs an o*d by o*d origin-destination style spatial weight for o*d flows using standard spatial weights on o origins and d destinations.
weights.vecW(origin_x, origin_y, dest_x, …) Distance-based spatial weight for vectors that is computed using a 4-dimensional distance between the origin x,y-coordinates and the destination x,y-coordinates

Weights Util Classes and Functions

weights.block_weights(regimes[, ids, sparse]) Construct spatial weights for regime neighbors.
weights.lat2W([nrows, ncols, rook, id_type]) Create a W object for a regular lattice.
weights.comb(items[, n]) Combinations of size n taken from items
weights.order(w[, kmax]) Determine the non-redundant order of contiguity up to a specific order.
weights.higher_order(w[, k]) Contiguity weights object of order k.
weights.shimbel(w) Find the Shimbel matrix for first order contiguity matrix.
weights.remap_ids(w, old2new[, id_order]) Remaps the IDs in a spatial weights object.
weights.full2W(m[, ids]) Create a PySAL W object from a full array.
weights.full(w) Generate a full numpy array.
weights.WSP2W(wsp[, silence_warnings]) Convert a pysal WSP object (thin weights matrix) to a pysal W object.
weights.get_ids(in_shps, idVariable) Gets the IDs from the DBF file that moves with a given shape file or a geopandas.GeoDataFrame.
weights.get_points_array_from_shapefile(…) Gets a data array of x and y coordinates from a given shapefile.

Weights user Classes and Functions

weights.min_threshold_distance(data[, p]) Get the maximum nearest neighbor distance.
weights.lat2SW([nrows, ncols, criterion, row_st]) Create a sparse W matrix for a regular lattice.
weights.w_local_cluster(w) Local clustering coefficients for each unit as a node in a graph.
weights.higher_order_sp(w[, k, …]) Contiguity weights for either a sparse W or W for order k.
weights.hexLat2W([nrows, ncols]) Create a W object for a hexagonal lattice.
weights.attach_islands(w, w_knn1) Attach nearest neighbor to islands in spatial weight w.
weights.nonplanar_neighbors(w, geodataframe) Detect neighbors for non-planar polygon collections
weights.fuzzy_contiguity(gdf[, tolerance, …]) Fuzzy contiguity spatial weights
weights.min_threshold_dist_from_shapefile(…) Kernel weights with adaptive bandwidths.
weights.build_lattice_shapefile(nrows, …) Build a lattice shapefile with nrows rows and ncols cols.
weights.spw_from_gal(galfile) Sparse scipy matrix for w from a gal file.

Set Theoretic Weights

weights.w_union(w1, w2[, silence_warnings]) Returns a binary weights object, w, that includes all neighbor pairs that exist in either w1 or w2.
weights.w_intersection(w1, w2[, w_shape, …]) Returns a binary weights object, w, that includes only those neighbor pairs that exist in both w1 and w2.
weights.w_difference(w1, w2[, w_shape, …]) Returns a binary weights object, w, that includes only neighbor pairs in w1 that are not in w2.
weights.w_symmetric_difference(w1, w2[, …]) Returns a binary weights object, w, that includes only neighbor pairs that are not shared by w1 and w2.
weights.w_subset(w1, ids[, silence_warnings]) Returns a binary weights object, w, that includes only those observations in ids.
weights.w_clip(w1, w2[, outSP, silence_warnings]) Clip a continuous W object (w1) with a different W object (w2) so only cells where w2 has a non-zero value remain with non-zero values in w1.

Spatial Lag

weights.lag_spatial(w, y) Spatial lag operator.
weights.lag_categorical(w, y[, ties]) Spatial lag operator for categorical variables.

cg: Computational Geometry

alpha_shapes

cg.alpha_shape(xys, alpha) Alpha-shape delineation (Edelsbrunner, Kirkpatrick & Seidel, 1983) from a collection of points …
cg.alpha_shape_auto(xys[, step, verbose]) Computation of alpha-shape delineation with automated selection of alpha.

voronoi

cg.voronoi_frames(points[, radius]) Composite helper to return Voronoi regions and generator points as individual dataframes

sphere

cg.RADIUS_EARTH_KM float(x) -> floating point number
cg.RADIUS_EARTH_MILES float(x) -> floating point number
cg.arcdist(pt0, pt1[, radius]) Arc distance between two points on a sphere.
cg.arcdist2linear(arc_dist[, radius]) Convert an arc distance (spherical earth) to a linear distance (R3) in the unit sphere.
cg.brute_knn(pts, k[, mode]) valid modes are [‘arc’,’xrz’]
cg.fast_knn(pts, k[, return_dist]) Computes k nearest neighbors on a sphere.
cg.fast_threshold(pts, dist[, radius]) Find all neighbors on a sphere within a threshold distance
cg.linear2arcdist(linear_dist[, radius]) Convert a linear distance in the unit sphere (R3) to an arc distance based on supplied radius
cg.toLngLat(xyz) Convert x,y,z to latitude and longitude
cg.toXYZ(pt) Convert a point’s latitude and longitude to x,y,z
cg.lonlat(pointslist) Converts point order from lat-lon tuples to lon-lat (x,y) tuples
cg.harcdist(p0, p1[, lonx, radius]) Alternative arc distance function, uses haversine formula
cg.geointerpolate(p0, p1, t[, lonx]) Finds a point on a sphere along the great circle distance between two points on a sphere also known as a way point in great circle navigation
cg.geogrid(pup, pdown, k[, lonx]) Computes a k+1 by k+1 set of grid points for a bounding box in lat-lon uses geointerpolate

shapes

cg.Point(loc) Geometric class for point objects.
cg.LineSegment(start_pt, end_pt) Geometric representation of line segment objects.
cg.Line(m, b) Geometric representation of line objects.
cg.Ray(origin, second_p) Geometric representation of ray objects.
cg.Chain(vertices) Geometric representation of a chain, also known as a polyline.
cg.Polygon(vertices[, holes]) Geometric representation of polygon objects.
cg.Rectangle(left, lower, right, upper) Geometric representation of rectangle objects.
cg.asShape(obj) Returns a pysal shape object from obj.

standalone

cg.bbcommon(bb, bbother) Old Stars method for bounding box overlap testing Also defined in pysal.weights._cont_binning
cg.get_bounding_box(items) Find bounding box for a list of geometries
cg.get_angle_between(ray1, ray2) Returns the angle formed between a pair of rays which share an origin get_angle_between(Ray, Ray) -> number
cg.is_collinear(p1, p2, p3) Returns whether a triplet of points is collinear.
cg.get_segments_intersect(seg1, seg2) Returns the intersection of two segments.
cg.get_segment_point_intersect(seg, pt) Returns the intersection of a segment and point.
cg.get_polygon_point_intersect(poly, pt) Returns the intersection of a polygon and point.
cg.get_rectangle_point_intersect(rect, pt) Returns the intersection of a rectangle and point.
cg.get_ray_segment_intersect(ray, seg) Returns the intersection of a ray and line segment.
cg.get_rectangle_rectangle_intersection(r0, r1) Returns the intersection between two rectangles.
cg.get_polygon_point_dist(poly, pt) Returns the distance between a polygon and point.
cg.get_points_dist(pt1, pt2) Returns the distance between a pair of points.
cg.get_segment_point_dist(seg, pt) Returns the distance between a line segment and point and distance along the segment of the closest point on the segment to the point as a ratio of the length of the segment.
cg.get_point_at_angle_and_dist(ray, angle, dist) Returns the point at a distance and angle relative to the origin of a ray.
cg.convex_hull(points) Returns the convex hull of a set of points.
cg.is_clockwise(vertices) Returns whether a list of points describing a polygon are clockwise or counterclockwise.
cg.point_touches_rectangle(point, rect) Returns True if the point is in the rectangle or touches it’s boundary.
cg.get_shared_segments(poly1, poly2[, bool_ret]) Returns the line segments in common to both polygons.
cg.distance_matrix(X[, p, threshold]) Distance Matrices

locators

cg.Grid(bounds, resolution) Representation of a binning data structure.
cg.PointLocator(points) An abstract representation of a point indexing data structure.
cg.PolygonLocator(polygons) An abstract representation of a polygon indexing data structure.

kdtree

cg.KDTree(data[, leafsize, distance_metric, …]) kd-tree built on top of kd-tree functionality in scipy.

io

io.open alias of pysal.lib.io.fileio.FileIO
io.fileio.FileIO([dataPath, mode, dataFormat]) Metaclass for supporting spatial data file read and write

examples

examples.available([verbose]) List available datasets
examples.explain(name) Explain a dataset by name
examples.get_path(example_name[, raw]) Get path of example folders

pysal.explore: Exploratory spatial data analysis

pysal.explore.esda: Spatial Autocorrelation Analysis

Gamma Statistic

esda.Gamma(y, w[, operation, standardize, …]) Gamma index for spatial autocorrelation

Geary Statistic

esda.Geary(y, w[, transformation, permutations]) Global Geary C Autocorrelation statistic

Getis-Ord Statistics

esda.G(y, w[, permutations]) Global G Autocorrelation Statistic
esda.G_Local(y, w[, transform, …]) Generalized Local G Autocorrelation

Join Count Statistics

esda.Join_Counts(y, w[, permutations]) Binary Join Counts

Moran Statistics

esda.Moran(y, w[, transformation, …]) Moran’s I Global Autocorrelation Statistic
esda.Moran_BV(x, y, w[, transformation, …]) Bivariate Moran’s I
esda.Moran_BV_matrix(variables, w[, …]) Bivariate Moran Matrix
esda.Moran_Local(y, w[, transformation, …]) Local Moran Statistics
esda.Moran_Local_BV(x, y, w[, …]) Bivariate Local Moran Statistics
esda.Moran_Rate(e, b, w[, adjusted, …]) Adjusted Moran’s I Global Autocorrelation Statistic for Rate Variables [AR99]
esda.Moran_Local_Rate(e, b, w[, adjusted, …]) Adjusted Local Moran Statistics for Rate Variables [Assuncao1999]

pysal.explore.giddy: Geospatial Distribution Dynamics

Markov Methods

giddy.markov.Markov(class_ids[, classes]) Classic Markov transition matrices.
giddy.markov.Spatial_Markov(y, w[, k, m, …]) Markov transitions conditioned on the value of the spatial lag.
giddy.markov.LISA_Markov(y, w[, …]) Markov for Local Indicators of Spatial Association
giddy.markov.kullback(F) Kullback information based test of Markov Homogeneity.
giddy.markov.prais(pmat) Prais conditional mobility measure.
giddy.markov.homogeneity(transition_matrices) Test for homogeneity of Markov transition probabilities across regimes.
giddy.ergodic.steady_state(P) Calculates the steady state probability vector for a regular Markov transition matrix P.
giddy.ergodic.fmpt(P) Calculates the matrix of first mean passage times for an ergodic transition probability matrix.
giddy.ergodic.var_fmpt(P) Variances of first mean passage times for an ergodic transition probability matrix.

Directional LISA

giddy.directional.Rose(Y, w[, k]) Rose diagram based inference for directional LISAs.

Economic Mobility Indices

giddy.mobility.markov_mobility(p[, measure, ini]) Markov-based mobility index.

Exchange Mobility Methods

giddy.rank.Theta(y, regime[, permutations]) Regime mobility measure.
giddy.rank.Tau(x, y) Kendall’s Tau is based on a comparison of the number of pairs of n observations that have concordant ranks between two variables.
giddy.rank.SpatialTau(x, y, w[, permutations]) Spatial version of Kendall’s rank correlation statistic.
giddy.rank.Tau_Local(x, y) Local version of the classic Tau.
giddy.rank.Tau_Local_Neighbor(x, y, w[, …]) Neighbor set LIMA.
giddy.rank.Tau_Local_Neighborhood(x, y, w[, …]) Neighborhood set LIMA.
giddy.rank.Tau_Regional(x, y, regime[, …]) Inter and intraregional decomposition of the classic Tau.

pysal.explore.inequality: Spatial Inequality Analysis

Theil Inequality Measures

inequality.theil.Theil(y) Classic Theil measure of inequality
inequality.theil.TheilD(y, partition) Decomposition of Theil’s T based on partitioning of observations into exhaustive and mutually exclusive groups
inequality.theil.TheilDSim(y, partition[, …]) Random permutation based inference on Theil’s inequality decomposition.

Gini Inequality Measures

inequality.gini.Gini_Spatial(x, w[, …]) Spatial Gini coefficient

pysal.explore.spaghetti:

spaghetti.Network

spaghetti.Network([in_data, node_sig, …]) Spatially-constrained network representation and analytical functionality.
spaghetti.Network.extractgraph() Using the existing network representation, create a graph-theoretic representation by removing all nodes with a neighbor incidence of two (non-articulation points).
spaghetti.Network.contiguityweights([graph, …]) Create a contiguity based W object.
spaghetti.Network.distancebandweights(threshold) Create distance based weights.
spaghetti.Network.snapobservations(in_data, name) Snap a point pattern shapefile to this network object.
spaghetti.Network.compute_distance_to_nodes(x, …) Given an observation on a network edge, return the distance to the two nodes that bound that end.
spaghetti.Network.compute_snap_dist(pattern, idx) Given an observation snapped to a network edge, calculate the distance from the original location to the snapped location.
spaghetti.Network.count_per_edge(obs_on_network) Compute the counts per edge.
spaghetti.Network.simulate_observations(count) Generate a simulated point pattern on the network.
spaghetti.Network.enum_links_node(v0) Returns the edges (links) around node.
spaghetti.Network.node_distance_matrix(…) Called from within allneighbordistances(), nearestneighbordistances(), and distancebandweights().
spaghetti.Network.allneighbordistances(…) Compute either all distances between i and j in a single point pattern or all distances between each i from a source pattern and all j from a destination pattern.
spaghetti.Network.nearestneighbordistances(…) Compute the interpattern nearest neighbor distances or the intrapattern nearest neighbor distances between a source pattern and a destination pattern.
spaghetti.Network.NetworkF(pointpattern[, …]) Computes a network constrained F-Function
spaghetti.Network.NetworkG(pointpattern[, …]) Computes a network constrained G-Function
spaghetti.Network.NetworkK(pointpattern[, …]) Computes a network constrained K-Function
spaghetti.Network.segment_edges(distance) Segment all of the edges in the network at either a
spaghetti.Network.savenetwork(filename) Save a network to disk as a binary file.
spaghetti.Network.loadnetwork(filename) Load a network from a binary file saved on disk.

spaghetti.NetworkBase

spaghetti.NetworkBase(ntw, pointpattern[, …]) Base object for performing network analysis on a spaghetti.Network object.
spaghetti.NetworkBase.computeenvelope() compute upper and lower bounds of envelope
spaghetti.NetworkBase.setbounds(nearest) set upper and lower bounds
spaghetti.NetworkBase.validatedistribution() enusure statistical distribution is supported

spaghetti.NetworkF

spaghetti.NetworkF(ntw, pointpattern[, …]) Compute a network constrained F statistic.
spaghetti.NetworkF.computeenvelope() compute upper and lower bounds of envelope
spaghetti.NetworkF.setbounds(nearest) set upper and lower bounds
spaghetti.NetworkF.validatedistribution() enusure statistical distribution is supported
spaghetti.NetworkF.computeobserved() compute the observed nearest and simulated nearest
spaghetti.NetworkF.computepermutations() compute permutations of the nearest

spaghetti.NetworkG

spaghetti.NetworkG(ntw, pointpattern[, …]) Compute a network constrained G statistic.
spaghetti.NetworkG.computeenvelope() compute upper and lower bounds of envelope
spaghetti.NetworkG.setbounds(nearest) set upper and lower bounds
spaghetti.NetworkG.validatedistribution() enusure statistical distribution is supported
spaghetti.NetworkG.computeobserved() compute the observed nearest
spaghetti.NetworkG.computepermutations() compute permutations of the nearest

spaghetti.NetworkK

spaghetti.NetworkK(ntw, pointpattern[, …]) Compute a network constrained K statistic.
spaghetti.NetworkK.computeenvelope() compute upper and lower bounds of envelope
spaghetti.NetworkK.setbounds(nearest) set upper and lower bounds
spaghetti.NetworkK.validatedistribution() enusure statistical distribution is supported
spaghetti.NetworkK.computeobserved() compute the observed nearest
spaghetti.NetworkK.computepermutations() compute permutations of the nearest

spaghetti.PointPattern

spaghetti.PointPattern([in_data, …]) A stub point pattern class used to store a point pattern.

spaghetti.SimulatedPointPattern

spaghetti.SimulatedPointPattern() Struct style class to mirror the Point Pattern Class.

spaghetti

spaghetti.compute_length(v0, v1) Compute the euclidean distance between two points.
spaghetti.dijkstra(ntw, cost, v0[, n]) Compute the shortest path between a start node and all other nodes in an origin-destination matrix.
spaghetti.dijkstra_mp(ntw_cost_node) Compute the shortest path between a start node and all other nodes in the web utilizing multiple cores upon request.
spaghetti.generatetree(pred) Rebuild the shortest path from root origin to destination
spaghetti.get_neighbor_distances(ntw, v0, l) Get distances to the nearest node neighbors along connecting edges.
spaghetti.snap_points_on_segments(points, …) Place points onto closet segment in a set of segments
spaghetti.squared_distance_point_segment(…) Find the squared distance between a point and a segment.
spaghetti.ffunction(nearest, lowerbound, …) Compute an F-Function
spaghetti.gfunction(nearest, lowerbound, …) Compute a G-Function
spaghetti.kfunction(nearest, upperbound, …) Compute a K-Function

pysal.viz: Geovisualization

pysal.viz.mapclassify: Choropleth map classification

Classifiers

mapclassify.Box_Plot(y[, hinge]) Box_Plot Map Classification
mapclassify.Equal_Interval(y[, k]) Equal Interval Classification
mapclassify.Fisher_Jenks(y[, k]) Fisher Jenks optimal classifier - mean based
mapclassify.Fisher_Jenks_Sampled(y[, k, …]) Fisher Jenks optimal classifier - mean based using random sample
mapclassify.HeadTail_Breaks(y) Head/tail Breaks Map Classification for Heavy-tailed Distributions
mapclassify.Jenks_Caspall(y[, k]) Jenks Caspall Map Classification
mapclassify.Jenks_Caspall_Forced(y[, k]) Jenks Caspall Map Classification with forced movements
mapclassify.Jenks_Caspall_Sampled(y[, k, pct]) Jenks Caspall Map Classification using a random sample
mapclassify.Max_P_Classifier(y[, k, initial]) Max_P Map Classification
mapclassify.Maximum_Breaks(y[, k, mindiff]) Maximum Breaks Map Classification
mapclassify.Natural_Breaks(y[, k, initial]) Natural Breaks Map Classification
mapclassify.Quantiles(y[, k]) Quantile Map Classification
mapclassify.Percentiles(y[, pct]) Percentiles Map Classification
mapclassify.Std_Mean(y[, multiples]) Standard Deviation and Mean Map Classification
mapclassify.User_Defined(y, bins) User Specified Binning

Utilities

mapclassify.K_classifiers(y[, pct]) Evaluate all k-classifers and pick optimal based on k and GADF
mapclassify.gadf(y[, method, maxk, pct]) Evaluate the Goodness of Absolute Deviation Fit of a Classifier Finds the minimum value of k for which gadf>pct

pysal.viz.splot: Lightweight visualization interface

Giddy

splot.giddy.dynamic_lisa_heatmap(rose[, p, ax]) Heatmap indicating significant transition of LISA values over time inbetween Moran Scatterplot quadrants
splot.giddy.dynamic_lisa_rose(rose[, …]) Plot dynamic LISA values in a rose diagram.
splot.giddy.dynamic_lisa_vectors(rose[, ax, …]) Plot vectors of positional transition of LISA values in Moran scatterplot
splot.giddy.dynamic_lisa_composite(rose, gdf) Composite visualisation for dynamic LISA values over two points in time.
splot.giddy.dynamic_lisa_composite_explore(…) Interactive exploration of dynamic LISA values for different dates in a dataframe.

ESDA

splot.esda.moran_scatterplot(moran[, …]) Moran Scatterplot
splot.esda.plot_moran(moran[, zstandard, …]) Global Moran’s I simulated reference distribution and scatterplot.
splot.esda.plot_moran_simulation(moran[, …]) Global Moran’s I simulated reference distribution.
splot.esda.plot_moran_bv(moran_bv[, …]) Bivariate Moran’s I simulated reference distribution and scatterplot.
splot.esda.plot_moran_bv_simulation(moran_bv) Bivariate Moran’s I simulated reference distribution.
splot.esda.lisa_cluster(moran_loc, gdf[, p, …]) Create a LISA Cluster map
splot.esda.plot_local_autocorrelation(…[, …]) Produce three-plot visualisation of Moran Scatteprlot, LISA cluster and Choropleth maps, with Local Moran region and quadrant masking
splot.esda.moran_facet(moran_matrix[, …]) Moran Facet visualization.

Weights

splot.libpysal.plot_spatial_weights(w, gdf) Plot spatial weights network.

mapping

splot.mapping.value_by_alpha_cmap(x, y[, …]) Calculates Value by Alpha rgba values
splot.mapping.vba_choropleth(x, y, gdf[, …]) Value by Alpha Choropleth
splot.mapping.vba_legend(rgb_bins, …[, ax]) Creates Value by Alpha heatmap used as choropleth legend.
splot.mapping.mapclassify_bin(y, classifier) Classify your data with pysal.mapclassify Note: Input parameters are dependent on classifier used.

pysal.model: Linear models for spatial data analysis

pysal.model.spreg: Spatial Econometrics

These are the standard spatial regression models supported by the spreg package. Each of them contains a significant amount of detail in their docstring discussing how they’re used, how they’re fit, and how to interpret the results.

spreg.OLS(y, x[, w, robust, gwk, sig2n_k, …]) Ordinary least squares with results and diagnostics.
spreg.ML_Lag(y, x, w[, method, epsilon, …]) ML estimation of the spatial lag model with all results and diagnostics; Anselin (1988) [Anselin1988]
spreg.ML_Error(y, x, w[, method, epsilon, …]) ML estimation of the spatial lag model with all results and diagnostics; Anselin (1988) [Anselin1988]
spreg.GM_Lag(y, x[, yend, q, w, w_lags, …]) Spatial two stage least squares (S2SLS) with results and diagnostics; Anselin (1988) [Anselin1988]
spreg.GM_Error(y, x, w[, vm, name_y, …]) GMM method for a spatial error model, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [Kelejian1998] [Kelejian1999].
spreg.GM_Error_Het(y, x, w[, max_iter, …]) GMM method for a spatial error model with heteroskedasticity, with results and diagnostics; based on Arraiz et al [Arraiz2010], following Anselin [Anselin2011].
spreg.GM_Error_Hom(y, x, w[, max_iter, …]) GMM method for a spatial error model with homoskedasticity, with results and diagnostics; based on Drukker et al.
spreg.GM_Combo(y, x[, yend, q, w, w_lags, …]) GMM method for a spatial lag and error model with endogenous variables, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [Kelejian1998] [Kelejian1999].
spreg.GM_Combo_Het(y, x[, yend, q, w, …]) GMM method for a spatial lag and error model with heteroskedasticity and endogenous variables, with results and diagnostics; based on Arraiz et al [Arraiz2010], following Anselin [Anselin2011].
spreg.GM_Combo_Hom(y, x[, yend, q, w, …]) GMM method for a spatial lag and error model with homoskedasticity and endogenous variables, with results and diagnostics; based on Drukker et al.
spreg.GM_Endog_Error(y, x, yend, q, w[, vm, …]) GMM method for a spatial error model with endogenous variables, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [Kelejian1998] [Kelejian1999].
spreg.GM_Endog_Error_Het(y, x, yend, q, w[, …]) GMM method for a spatial error model with heteroskedasticity and endogenous variables, with results and diagnostics; based on Arraiz et al [Arraiz2010], following Anselin [Anselin2011].
spreg.GM_Endog_Error_Hom(y, x, yend, q, w[, …]) GMM method for a spatial error model with homoskedasticity and endogenous variables, with results and diagnostics; based on Drukker et al.
spreg.TSLS(y, x, yend, q[, w, robust, gwk, …]) Two stage least squares with results and diagnostics.
spreg.ThreeSLS(bigy, bigX, bigyend, bigq[, …]) User class for 3SLS estimation

Regimes Models

Regimes models are variants of spatial regression models which allow for structural instability in parameters. That means that these models allow different coefficient values in distinct subsets of the data.

spreg.OLS_Regimes(y, x, regimes[, w, …]) Ordinary least squares with results and diagnostics.
spreg.ML_Lag_Regimes(y, x, regimes[, w, …]) ML estimation of the spatial lag model with regimes (note no consistency checks, diagnostics or constants added); Anselin (1988) [Anselin1988]
spreg.ML_Error_Regimes(y, x, regimes[, w, …]) ML estimation of the spatial error model with regimes (note no consistency checks, diagnostics or constants added); Anselin (1988) [Anselin1988]
spreg.GM_Lag_Regimes(y, x, regimes[, yend, …]) Spatial two stage least squares (S2SLS) with regimes; Anselin (1988) [Anselin1988]
spreg.GM_Error_Regimes(y, x, regimes, w[, …]) GMM method for a spatial error model with regimes, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [Kelejian1998] [Kelejian1999].
spreg.GM_Error_Het_Regimes(y, x, regimes, w) GMM method for a spatial error model with heteroskedasticity and regimes; based on Arraiz et al [Arraiz2010], following Anselin [Anselin2011].
spreg.GM_Error_Hom_Regimes(y, x, regimes, w) GMM method for a spatial error model with homoskedasticity, with regimes, results and diagnostics; based on Drukker et al.
spreg.GM_Combo_Regimes(y, x, regimes[, …]) GMM method for a spatial lag and error model with regimes and endogenous variables, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [Kelejian1998] [Kelejian1999].
spreg.GM_Combo_Hom_Regimes(y, x, regimes[, …]) GMM method for a spatial lag and error model with homoskedasticity, regimes and endogenous variables, with results and diagnostics; based on Drukker et al.
spreg.GM_Combo_Het_Regimes(y, x, regimes[, …]) GMM method for a spatial lag and error model with heteroskedasticity, regimes and endogenous variables, with results and diagnostics; based on Arraiz et al [Arraiz2010], following Anselin [Anselin2011].
spreg.GM_Endog_Error_Regimes(y, x, yend, q, …) GMM method for a spatial error model with regimes and endogenous variables, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [Kelejian1998] [Kelejian1999].
spreg.GM_Endog_Error_Hom_Regimes(y, x, yend, …) GMM method for a spatial error model with homoskedasticity, regimes and endogenous variables.
spreg.GM_Endog_Error_Het_Regimes(y, x, yend, …) GMM method for a spatial error model with heteroskedasticity, regimes and endogenous variables, with results and diagnostics; based on Arraiz et al [Arraiz2010], following Anselin [Anselin2011].

Seemingly-Unrelated Regressions

Seeimingly-unrelated regression models are a generalization of linear regression. These models (and their spatial generalizations) allow for correlation in the residual terms between groups that use the same model. In spatial Seeimingly-Unrelated Regressions, the error terms across groups are allowed to exhibit a structured type of correlation: spatail correlation.

spreg.SUR(bigy, bigX[, w, regimes, …]) User class for SUR estimation, both two step as well as iterated
spreg.SURerrorGM(bigy, bigX, w[, regimes, …]) User class for SUR Error estimation by Maximum Likelihood
spreg.SURerrorML(bigy, bigX, w[, regimes, …]) User class for SUR Error estimation by Maximum Likelihood
spreg.SURlagIV(bigy, bigX[, bigyend, bigq, …]) User class for spatial lag estimation using IV
spreg.ThreeSLS(bigy, bigX, bigyend, bigq[, …]) User class for 3SLS estimation

pysal.model.mgwr: Multiscale Geographically Weighted Regression

GWR Model Estimation and Inference

mgwr.gwr.GWR(coords, y, X, bw[, family, …]) Geographically weighted regression.
mgwr.gwr.GWRResults(model, params, predy, S, CCT) Basic class including common properties for all GWR regression models
mgwr.gwr.GWRResultsLite(model, resid, influ) Lightweight GWR that computes the minimum diagnostics needed for bandwidth selection

MGWR Estimation and Inference

mgwr.gwr.MGWR(coords, y, X, selector[, …]) Multiscale GWR estimation and inference.
mgwr.gwr.MGWRResults(model, params, predy, …) Class including common properties for a MGWR model.

Kernel Specification

mgwr.kernels.fix_gauss(coords, bw[, points, …]) Fixed Gaussian kernel.
mgwr.kernels.adapt_gauss(coords, nn[, …]) Spatially adaptive Gaussian kernel.
mgwr.kernels.fix_bisquare(coords, bw[, …]) Fixed bisquare kernel.
mgwr.kernels.adapt_bisquare(coords, nn[, …]) Spatially adaptive bisquare kernel.
mgwr.kernels.fix_exp(coords, bw[, points, …]) Fixed exponential kernel.
mgwr.kernels.adapt_exp(coords, nn[, points, …]) Spatially adaptive exponential kernel.

Bandwidth Selection

mgwr.sel_bw.Sel_BW(coords, y, X_loc[, …]) Select bandwidth for kernel

Visualization

mgwr.utils.shift_colormap(cmap[, start, …]) Function to offset the “center” of a colormap.
mgwr.utils.truncate_colormap(cmap[, minval, …]) Function to truncate a colormap by selecting a subset of the original colormap’s values
mgwr.utils.compare_surfaces(data, var1, …) Function that creates comparative visualization of GWR and MGWR surfaces.