Skip to content

Fit Model (Ctrl+M)

Fit Model report

When to use it

Generalized linear model fit for binary (0/1) or non-negative integer response columns with one or more continuous predictors. Use when the binary/count response and X's are numeric; the report surfaces actual-vs-predicted, residual-vs-fitted, model summary and parameter estimates. Supports Continuous modeling type for predictors; Y is binary (binomial/logistic) or non-negative integer (Poisson). Nominal/Ordinal predictors are not accepted by the current launch path.

GUI workflow

  1. Press Fit Model (Ctrl+M) — Launch Dialog opens with Fit Model active.
  2. Roles: Y, Response * (multiple, required), X, Factor * (multiple, required), By (multiple, optional), Weight, Freq (optional).
  3. Assign response and one or more predictors via the picker; single zones re-assign on click, multi zones accumulate, and one column occupies at most one zone.
  4. Run opens the floating report window.

Floating report window

  • Model Summary — family (Binomial/Poisson), n, AIC, BIC, deviance residual.
  • Parameter Estimates — Term, Estimate, SE, z, p.
  • Actual vs Predicted — brushable scatter (fitted on x-axis, actual on y-axis).
  • Residual vs Fitted — brushable scatter (fitted on x-axis, residual on y-axis) with a zero reference line.

Header ... menu: Toggle CI/PI, Save Residuals, Save Script to Table, Export SVG, Export JSON. Hidden rows are omitted; brushes are linked.

Mathematical formulation

GLM specification:

\[g(\mu_i) = x_i^{\top}\beta,\qquad \mu_i = \mathbb{E}[Y_i]\]
  • Binomial: logit link \(g(\mu) = \ln\frac{\mu}{1-\mu}\), logistic regression (probability response).
  • Poisson: log link \(g(\mu) = \ln\mu\), count response.

Estimated by maximum likelihood with Newton-Raphson-style solver (leap_stats::glm::fit_glm; intercept; max 100 iterations; tol 1e-6); reported converged flag and iteration count.

Summary statistics: AIC \(= 2k - 2\ln L\), BIC \(= k\ln n - 2\ln L\), deviance residual, and coefficients with standard errors and z-tests (p-values from the corresponding normal CDF).

CLI parity — exact flags

Fit Model (Ctrl+M) — Launch Dialog → Run.

leap glm data.csv --y <col> --x <col1,col2> --family binomial|poisson [--selected <ids>]

JSON output: family, selected_only, n_total, n_used, exclusion counts, converged, iterations, n_params, rank, coefficients (estimate / se / z_stat / p_value / ci_low / ci_high / ratio), deviance_null, deviance_residual, log_likelihood, aic, bic.