/** Supported exponential-family distributions. */ export type GlmFamily = 'poisson' | 'gamma'; /** Supported link functions. */ export type GlmLink = 'log' | 'inverse'; /** Options for `glm`. */ export interface GlmOptions { /** Exponential family: `'poisson'` (counts) or `'gamma'` (positive continuous). */ family: GlmFamily; /** Link function. Default `'log'` for both families (`'inverse'` — the Gamma * canonical link — is also supported for `family: 'gamma'`). */ link?: GlmLink; /** Prepend a column of ones (default true), matching `ols`'s convention. */ intercept?: boolean; /** Convergence tolerance on the max-norm change in the linear predictor (default 1e-10). */ tol?: number; /** Maximum IRLS iterations (default 100). */ maxIter?: number; } /** Result of `glm`. */ export interface GlmResult { /** Fitted coefficients (intercept first, if included). */ coefficients: number[]; /** Fitted mean response `μ = linkInverse(Xβ)` for the training rows. */ fittedValues: number[]; /** Residual deviance `Σ d(yᵢ, μᵢ)` (family-specific unit deviance). */ deviance: number; /** Number of IRLS iterations performed. */ iterations: number; /** Predict the mean response for new rows. */ predict: (x: number[][]) => number[]; } /** * Fit a generalized linear model `μ = linkInverse(Xβ)` by IRLS (Fisher * scoring). Supports `family: 'poisson'` (log link only) and `family: * 'gamma'` (log or inverse link). * * @param X - Design matrix (rows = observations, cols = predictors) * @param y - Response vector (non-negative for Poisson, strictly positive for Gamma) * @param opts - `family` (required), `link` (default `'log'`), `intercept` * (default true), `tol` (default 1e-10), `maxIter` (default 100) * * @example * glm([[1], [2], [3], [4], [5]], [1, 2, 3, 5, 8], { family: 'poisson' }) * // => coefficients ~= [-0.374104, 0.492678] (matches statsmodels sm.GLM(..., family=Poisson())) */ export declare function glm(X: number[][], y: number[], opts: GlmOptions): GlmResult; //# sourceMappingURL=glm.d.ts.map