fit_model: Linear model fitting on a dataframe

Description Usage Arguments Examples

View source: R/fit_linear_model.R

Description

This function allows you to fit a (multiple) linear model between dependend and independend variables and perform cross validation. DEPRECATED USE FIT_MODEL2 INSTEAD!!!!

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
fit_model(
  df,
  frml,
  family = "lm",
  subset = "full",
  preProc = "",
  verbose = F,
  force_in = "",
  gam_grid = NULL,
  cubist_grid = NULL,
  rf_grid = NULL,
  svmRadial_grid = NULL,
  ...
)

Arguments

df

data.frame, A data.frame that is used to fit a linear model between dependent and independent variables.

frml

formula, A formula object for building the linear model

family

string, 'lm' or 'gam' for linear model or generalized additive model, respectively.

verbose

logical, if True the R2 of every model fit will be printed.

...

further arguments passed on to caret::trainControl (method, number, repeats). Defaults correspond to repeatedcv using 5 folds repeated for 3 times. method = the resampling method: "boot", "boot632", "optimism_boot", "boot_all", "cv", "repeatedcv", "LOOCV", "LGOCV" (for repeated training/test splits), "none" (only fits one model to the entire training set), "oob" (only for random forest, bagged trees, bagged earth, bagged flexible discriminant analysis, or conditional tree forest models), timeslice, "adaptive_cv", "adaptive_boot" or "adaptive_LGOCV"

plots

Should scatterplots of the form plot(frml, data = df) be added to the output?

Examples

1
2
3
4
fit_model(df = df.interp,
  frml = huglin ~ elevation,
  output = 'full',
  plots = T)

sitscholl/rebecka_package documentation built on Aug. 25, 2020, 4:20 a.m.