CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-spreg

Spatial econometric regression models for analyzing geographically-related data interactions.

Overall
score

87%

Overview
Eval results
Files

probit-models.mddocs/

Probit Models

Spatial probit regression for binary choice models with spatial dependence, supporting various spatial structures and diagnostic tests.

Capabilities

Spatial Probit Model

class Probit:
    def __init__(self, y, x, w=None, optim='newton', scalem='phimean', maxiter=100,
                 vm=False, name_y=None, name_x=None, name_w=None, name_ds=None,
                 latex=False, hard_bound=False):
        """
        Spatial probit regression for binary dependent variables.

        Parameters:
        - y (array): nx1 binary dependent variable (0/1)
        - x (array): nxk independent variables
        - w (sparse matrix, optional): Spatial weights for spatial probit
        - optim (str): Optimization method ('newton' or 'bfgs')
        - scalem (str): Scale method ('phimean' or 'xmean')
        - maxiter (int): Maximum iterations for optimization
        - vm (bool): Include variance-covariance matrix
        - hard_bound (bool): Enforce spatial parameter bounds

        Attributes:
        - betas (array): Estimated coefficients
        - rho (float): Spatial dependence parameter (if spatial)
        - logl (float): Log-likelihood value
        - predy (array): Predicted probabilities
        - summary (str): Formatted results
        """

Usage Examples

Basic Probit Model

import numpy as np
import spreg

# Binary dependent variable
n = 100
x = np.random.randn(n, 2)
linear_combo = 1 + x[:, 0] + 2 * x[:, 1] + np.random.randn(n)
y = (linear_combo > 0).astype(int).reshape(-1, 1)

# Probit estimation
probit_model = spreg.Probit(y, x, name_y='choice', name_x=['x1', 'x2'])
print(probit_model.summary)

Install with Tessl CLI

npx tessl i tessl/pypi-spreg

docs

diagnostics.md

index.md

ml-models.md

ols-models.md

panel-models.md

probit-models.md

regime-models.md

spatial-error-models.md

sur-models.md

tsls-models.md

utilities.md

tile.json