var
Estimate a vector autoregression to model how multiple time series affect each other, enabling Granger-causality tests and impulse-response analysis for data-driven decisions.
Instructions
Estimate a Vector Autoregression (VAR) model. Validation: certified parity evidence. Assumptions: All system variables are jointly covariance-stationary (no unit roots / cointegration left unmodeled); Lag order p is adequate so residuals are white noise; under-fitting biases IRFs and Granger tests; Reduced-form errors are serially uncorrelated; structural IRF identification relies on the chosen ordering/recursive scheme. Pre-conditions: Multivariate (>=2 column) time-ordered DataFrame of comparable-frequency series; Sample length large relative to kp+trend parameters to estimate each equation. Failure modes: Coefficient covariance is singular or IRFs diverge because k^2p parameters exceed available observations -> Reduce lags, drop variables, or extend the sample so n is much larger than k*p; Explosive IRFs / non-decaying responses from a non-stationary (unit-root or trending) system -> Difference or detrend the series first, or use trend='ct', and confirm stationarity before fitting. Alternatives: sp.local_projections, sp.arima, sp.iv. Typical minimum N: 100.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lags | No | Number of lags. | |
| alpha | No | Significance level. | |
| se_df | No | Residual-variance denominator for coefficient standard errors. ``'stata'``/``'ml'`` uses ``T`` and matches Stata ``var`` default conditional-MLE standard errors. ``'r'``/``'unbiased'`` uses ``T - k_params`` and matches the equation-by-equation ``lm()`` standard errors returned inside R ``vars::VAR()``. | stata |
| trend | No | trend parameter (str). | c |
| detail | No | Payload depth: 'minimal' (~150 tokens) for sub-step calls where only the point estimate is needed; 'standard' (~1K tokens) for diagnostics + coefficient table; 'agent' (~2K tokens, default) adds violations / next_steps / suggested_functions so the LLM can plan its next call without another round-trip. | agent |
| as_handle | No | If true, cache the fitted result on the server and return result_id + result_uri alongside the JSON payload so a subsequent tools/call can chain without re-running. | |
| data_path | Yes | Absolute path or URL to a data file. Supported: .csv / .tsv / .txt (delimited), .parquet / .pq, .feather / .arrow, .xlsx / .xls, .dta (Stata), .json / .jsonl. Schemes: file://, s3://, gs://, https://. | |
| result_id | No | Optional handle to a previously-fitted result (returned by an earlier call when as_handle=true). Tools that operate on a fitted object accept this in place of re-supplying data_path + columns. | |
| variables | No | Variable names. If None, uses all numeric columns. | |
| data_columns | No | Optional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads. | |
| data_sample_n | No | Optional uniform random subsample size (seed=0, deterministic) — useful on huge panels. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||