run_regression
Run OLS linear regression on Excel data. Specify file, sheet, dependent and independent columns to get coefficients, R-squared, residuals, and diagnostics, with optional output to a new sheet or file.
Instructions
Run an OLS linear regression and optionally write results to a sheet/file.
Args: file_path: Input workbook path. sheet_name: Worksheet containing data. y_column: Dependent variable column name. x_columns: List of independent variable column names. header_row: 1-based header row index. output_sheet: Optional sheet name for regression output. output_file: Optional path to write results to a separate file.
Returns: RegressionResult: Contains coefficients, R-squared, residuals and diagnostics.
Notes:
- Read-only unless output_file/output_sheet is provided (then mutates workbook/creates file).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file_path": "<file_path>",
"sheet_name": "<sheet_name>",
"y_column": "<y_column>",
"x_columns": "<x_columns>"
},
"name": "run_regression"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| y_column | Yes | ||
| file_path | Yes | ||
| x_columns | Yes | ||
| header_row | No | ||
| sheet_name | Yes | ||
| output_file | No | ||
| output_sheet | No | Regression Output |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| equation | No | ||
| f_pvalue | No | ||
| p_values | No | ||
| ss_total | No | ||
| t_values | No | ||
| intercept | No | ||
| r_squared | No | ||
| std_errors | No | ||
| f_statistic | No | ||
| predictions | No | ||
| ss_residual | No | ||
| coefficients | No | ||
| output_sheet | No | ||
| n_observations | No | ||
| adjusted_r_squared | No | ||
| confidence_intervals | No |