regression
Fit linear, logistic, Poisson, ordinal, multinomial, mixed, or GAM models and report coefficients, confidence intervals, fit statistics, and diagnostics.
Instructions
Fit a regression model and report coefficients with confidence intervals, model fit and diagnostics. Supported type values:
linear: OLS, with optional standardised betas and robust (HC3) standard errors
logistic: binary outcome, reported with odds ratios and a classification table
poisson / negbin: count outcomes, reported with incidence rate ratios
ordinal: ordered outcome (proportional odds); order the levels with data_transform first
multinomial: unordered outcome with more than two categories
mixed / mixed_logistic: multilevel models; give the random part in
random, e.g. random='(1 | school)'gam: smooth terms, written in the formula as s(x)
Specify the model either as formula ('y ~ x1 + x2 + x1:x2') or as dv plus predictors. The fit is saved in the session for model_diagnostics, model_compare and model_predict.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dv | No | Outcome column, as an alternative to `formula`. | |
| data | Yes | Dataset name in the session. | |
| link | No | Link function, e.g. 'logit', 'probit', 'log'. | |
| type | No | linear, glm, logistic, poisson, negbin, ordinal, multinomial, mixed, mixed_logistic or gam. | linear |
| plots | No | Include residual diagnostic plots. | |
| digits | No | Decimal places. | |
| family | No | Family for type='glm' or 'gam', e.g. 'binomial', 'Gamma'. | |
| random | No | Random-effects term for mixed models, e.g. '(1 | school)' or '(1 + time | id)'. | |
| robust | No | Add heteroscedasticity-robust (HC3) standard errors. | |
| formula | No | R formula, e.g. 'score ~ age + sex + age:sex' or 'y ~ s(x) + z' for a GAM. | |
| save_as | No | Name for the fitted model in the session. | |
| weights | No | Column of case weights. | |
| conf_level | No | Confidence level for coefficients. | |
| predictors | No | Predictor columns, used with `dv`. | |
| standardize | No | Add standardised beta coefficients (linear models). |