Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

build_sequential_models

Model Building


Description

Simplify the process of building multiple models in a sequential order. This is particularly helpful in epidemiological cases of testing effect of additional parameters. Every parameter should be theoretically a part of the causal model for the exposure-outcome relationship.

Usage

build_sequential_models(formula, data, exposure = NULL, engine = "lm")

Arguments

formula

an object of class formula that shows the names of the outcomes (can be more than 1) and the names of the predictors (which should contain the exposure variable).

data

data frame or data table (or tibble) that contains the named variables

exposure

Variable that is forced to be maintained in every model as a predictor.

engine

Set the "engine" or the regression tool that will be used

Details

This is considering what is available with the modelr package and the tidymodels approach, and finding an in-between for the causality / epidemiology approach of building intentional, sequentional models. Expect changes in the process, and potential future dependencies on the tidymodels appraoches.

Value

A tidy tibble of models. Each one will likely be grouped by its outcome, and then with sequential columns using increased/additive models. Each model, in a tidy format, will have two additional columns.

  • outcomes identifies which outcome was used for the specific regression

  • covar number of covariates used in sequence of predictors given, with exposure always being placed in position 1

Examples

data(geh)
f <- svg_mag + qrs_tang ~ lab_hba1c + bmi
build_sequential_models(f, data = geh)

card

Cardiovascular and Autonomic Research Design

v0.1.0
MIT + file LICENSE
Authors
Anish S. Shah [aut, cre, cph] (<https://orcid.org/0000-0002-9729-1558>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.