knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
This package can be downloaded from CRAN or from Github as below
# CRAN installation install.packages("rmdl") # Or remote/developmental version remotes::install_github("shah-in-boots/rmdl")
The package {rmdl}
was intended as a way to handle causal- and epidemiology-based modeling by the following principles:
The package is simple to use.
The mtcars
dataset will serve as the example, and we will use linear regressions as the primary test.
This toy example shows that we will be building six models in parallel, with the key exposure being the wt term, and the two outcomes being mpg and hp.
library(rmdl) f <- fmls(mpg + hp ~ .x(wt) + disp + cyl + am, pattern = "parallel") m <- fit(f, .fn = lm, data = mtcars, raw = FALSE) mt <- model_table(mileage = m) print(mt)
There are several important extended classes that this package introduces, however they are primarily used for internal validation and for shortcuts to allow more effective communication.
fmls
are a version of the base R
formula object, but contain additional information and have extra featurestm
are atomic elements used to describe individual variables, and departs from how terms are generally treated in the {stats}
packagemdl
and mdl_tbl
exist primarily as tidy versions of class regression modelingThe {rmdl}
package is intended to be flexible, extensible, and easy-to-use (albeit opinionated).
Please see the vignettes for additional information.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.