Skip to contents

A formula-interface linear (gaussian) or logistic (binomial) regression returning a model object that exposes coefficients, variance-covariance, fitted values, residuals, response and predictor metadata, convergence information, and supports prediction with confidence / prediction intervals and default plot / summary methods.

Usage

morie_lm(
  formula,
  data,
  family = c("gaussian", "binomial"),
  center = FALSE,
  scale = FALSE,
  na_predictor = c("omit", "fail"),
  na_response = c("omit", "keep"),
  nofit = FALSE
)

Arguments

formula

A model formula.

data

A data.frame.

family

"gaussian" (linear) or "binomial" (logistic).

center, scale

Logical; center predictors to zero mean / scale to unit SD before fitting (the fit is back-transformed so coefficients remain on the original scale). Documented and tested (RE2.3).

na_predictor

How to handle missing predictor values: "omit" (drop incomplete predictor rows) or "fail" (error). Controlled separately from the response (RE2.2).

na_response

How to handle missing response values: "omit" or "keep" (retain rows with missing response so fitted values can still be generated for their predictors) (RE2.2).

nofit

If TRUE, return an unfitted model specification (RE4.1).

Value

A morie_lm object, or an unfitted morie_lm_spec when nofit = TRUE.

Examples

morie_lm(mpg ~ hp + wt, mtcars)
#> <morie_lm>
#>   mpg ~ hp + wt  family=gaussian  n=32  AIC=156.65
#>   coefficients:
#> (Intercept)          hp          wt 
#>     37.2273     -0.0318     -3.8778