mixlogit
Estimate mixed logit models with random coefficients using simulated maximum likelihood to analyze discrete choice data and quantify preference heterogeneity for evidence-backed decisions.
Instructions
Mixed Logit (random-coefficient MNL) via simulated maximum likelihood.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| y | Yes | Column name with the 0/1 chosen indicator. | |
| alt | No | Alternative identifier -- accepted for API compatibility with ``statsmodels.MNLogit`` / Stata conventions, but the ordering of alternatives is taken directly from the DataFrame's row order within each ``chid`` group. | |
| tol | No | Numerical convergence tolerance. | |
| chid | Yes | Choice-situation identifier. All rows with the same ``chid`` form one choice set. | |
| alpha | No | Significance level. | |
| 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 |
| robust | No | Report OPG-sandwich robust SEs. ``False`` -> classical inverse Hessian. | |
| maxiter | No | maxiter parameter (int). | |
| n_draws | No | Number of Halton draws per individual. Rule-of-thumb: use ``>= 1000`` for correlated models or precise inference. | |
| verbose | No | verbose parameter (bool). | |
| x_fixed | No | Columns entering with fixed (non-random) coefficients. | |
| panel_id | No | Individual identifier. When provided, the SAME draws of the random coefficients are used for every choice of the individual (Train 2009 Section 6.5). Omit for cross-sectional data. | |
| x_random | No | Columns entering with random coefficients (at least one required). | |
| 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. | |
| correlated | No | If True, estimate a full Cholesky factor of ``cov(beta_random)``; otherwise only diagonal standard deviations. | |
| halton_seed | No | halton_seed parameter (int). | |
| random_dist | No | Per-random-variable distribution -- one of ``'normal'`` (default), ``'lognormal'``, ``'triangular'``. | |
| 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 | |||