Fit (regularized) generalized linear model

fit_model(
  formula,
  data,
  method = c("glm", "glmnet", "cv.glmnet", "brms", "xgb", "bagging_ridge",
    "bayesian_ridge"),
  family = gaussian,
  alpha = 1,
  ...
)

Arguments

formula

An object of class formula with a symbolic description of the model to be fitted.

data

A data.frame containing the variables in the model.

method

A character string indicating the method to fit the model.

  • 'glm' - Generalized Liner Model with stats.

  • 'glmnet', 'cv.glmnet' - Regularized Generalized Liner Model with glmnet.

  • 'brms' - Bayesian Regression Models using brms.

  • 'xgb' - Gradient Boosting Regression using xgboost.

  • 'bagging_ridge' - Bagging Ridge Regression using scikit-learn via reticulate.

  • 'bayesian_ridge' - Bayesian Ridge Regression using scikit-learn via reticulate.

family

A description of the error distribution and link function to be used in the model. See stats for mode details.

alpha

The elasticnet mixing parameter. See glmnet for details.

...

Other parameters for the model fitting function.

Value

A list with two data frames: gof contains goodness of fit measures of the fit and coefs contains the fitted coefficients.