ols_with_spatial_diagnostics_safe
Perform spatial diagnostics and run Ordinary Least Squares (OLS) regression on geospatial datasets. Input shapefiles or GeoPackages, specify dependent and independent variables, and optionally define spatial weights for analysis.
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 |
---|---|---|---|
binary | No | ||
data_path | Yes | ||
id_field | No | ||
k | No | ||
threshold | No | ||
weights_method | No | queen | |
weights_path | No | ||
x_fields | Yes | ||
y_field | Yes |
Input Schema (JSON Schema)
{
"properties": {
"binary": {
"default": true,
"title": "Binary",
"type": "boolean"
},
"data_path": {
"title": "Data Path",
"type": "string"
},
"id_field": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Id Field"
},
"k": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "K"
},
"threshold": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"title": "Threshold"
},
"weights_method": {
"default": "queen",
"title": "Weights Method",
"type": "string"
},
"weights_path": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Weights Path"
},
"x_fields": {
"items": {
"type": "string"
},
"title": "X Fields",
"type": "array"
},
"y_field": {
"title": "Y Field",
"type": "string"
}
},
"required": [
"data_path",
"y_field",
"x_fields"
],
"title": "ols_with_spatial_diagnostics_safeArguments",
"type": "object"
}