{"library":"spreg","title":"spreg","type":"library","description":"PySAL Spatial Econometric Regression in Python. Provides spatial regression models (OLS, ML, GM, Panel) and diagnostics. Current version: 1.9.0. Released approximately every 3-6 months.","language":"python","status":"active","last_verified":"Sat May 09","install":{"commands":["pip install spreg"],"cli":null},"imports":["from spreg import OLS","from spreg import GM_Lag","from spreg import ML_Error","from spreg import spsearch"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/pysal/spreg","docs":null,"changelog":null,"pypi":"https://pypi.org/project/spreg/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import numpy as np\nimport libpysal\nfrom spreg import OLS\n\n# Generate random data\nnp.random.seed(123)\nn = 100\nx = np.random.randn(n, 2)\ny = 1 + 2*x[:,0] + 3*x[:,1] + np.random.randn(n)*0.5\n\n# Create spatial weights (Queen contiguity from random points)\npts = np.random.rand(n, 2)\nw = libpysal.weights.DistanceBand.from_array(pts, threshold=0.5, binary=True)\nw.transform = 'r'\n\n# Fit OLS\nm1 = OLS(y, x, w=w, spat_diag=True)\nprint(m1.summary)","lang":"python","description":"Basic OLS with spatial diagnostics using random data and distance-based weights.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}