0
# Probit Models
1
2
Spatial probit regression for binary choice models with spatial dependence, supporting various spatial structures and diagnostic tests.
3
4
## Capabilities
5
6
### Spatial Probit Model
7
8
```python { .api }
9
class Probit:
10
def __init__(self, y, x, w=None, optim='newton', scalem='phimean', maxiter=100,
11
vm=False, name_y=None, name_x=None, name_w=None, name_ds=None,
12
latex=False, hard_bound=False):
13
"""
14
Spatial probit regression for binary dependent variables.
15
16
Parameters:
17
- y (array): nx1 binary dependent variable (0/1)
18
- x (array): nxk independent variables
19
- w (sparse matrix, optional): Spatial weights for spatial probit
20
- optim (str): Optimization method ('newton' or 'bfgs')
21
- scalem (str): Scale method ('phimean' or 'xmean')
22
- maxiter (int): Maximum iterations for optimization
23
- vm (bool): Include variance-covariance matrix
24
- hard_bound (bool): Enforce spatial parameter bounds
25
26
Attributes:
27
- betas (array): Estimated coefficients
28
- rho (float): Spatial dependence parameter (if spatial)
29
- logl (float): Log-likelihood value
30
- predy (array): Predicted probabilities
31
- summary (str): Formatted results
32
"""
33
```
34
35
## Usage Examples
36
37
### Basic Probit Model
38
39
```python
40
import numpy as np
41
import spreg
42
43
# Binary dependent variable
44
n = 100
45
x = np.random.randn(n, 2)
46
linear_combo = 1 + x[:, 0] + 2 * x[:, 1] + np.random.randn(n)
47
y = (linear_combo > 0).astype(int).reshape(-1, 1)
48
49
# Probit estimation
50
probit_model = spreg.Probit(y, x, name_y='choice', name_x=['x1', 'x2'])
51
print(probit_model.summary)
52
```