ols_with_spatial_diagnostics_safe
Run OLS regression with spatial diagnostics safely. Reads shapefile, builds spatial weights, converts numeric data, checks for NaN values, then executes regression.
Instructions
Safe MCP pipeline: Read shapefile, build/load W, convert numeric, check NaNs, run OLS.
Parameters:
data_path: path to shapefile or GeoPackage
y_field: dependent variable column name
x_fields: list of independent variable column names
weights_path: optional path to existing weights file (.gal or .gwt)
weights_method: 'queen', 'rook', 'distance_band', or 'knn' (used if weights_path not provided)
id_field: optional attribute name to use as observation IDs
threshold: required if method='distance_band'
k: required if method='knn'
binary: True for binary weights (DistanceBand only)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data_path | Yes | ||
| y_field | Yes | ||
| x_fields | Yes | ||
| weights_path | No | ||
| weights_method | No | queen | |
| id_field | No | ||
| threshold | No | ||
| k | No | ||
| binary | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||