A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/shah-in-boots/rmdl below:

shah-in-boots/rmdl: A Causality-Informed Modeling Appraoch

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:

  1. Role determination of variables
  2. Generativity in formula creation
  3. Multiple model management

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)
#> Loading required package: vctrs
#> Loading required package: tibble
#> 
#> Attaching package: 'tibble'
#> The following object is masked from 'package:vctrs':
#> 
#>     data_frame

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)
#> <mdl_tbl>
#>   id        formula_index data_id name  model_call formula_call outcome exposure
#>   <chr>     <list>        <chr>   <chr> <chr>      <chr>        <chr>   <chr>   
#> 1 47f9ee4e… <dbl [6]>     mtcars  mile… lm         mpg ~ wt + … mpg     wt      
#> 2 9a36f9dd… <dbl [6]>     mtcars  mile… lm         mpg ~ wt + … mpg     wt      
#> 3 00960980… <dbl [6]>     mtcars  mile… lm         mpg ~ wt + … mpg     wt      
#> 4 4266ee6e… <dbl [6]>     mtcars  mile… lm         hp ~ wt + d… hp      wt      
#> 5 490332f2… <dbl [6]>     mtcars  mile… lm         hp ~ wt + c… hp      wt      
#> 6 a070ec58… <dbl [6]>     mtcars  mile… lm         hp ~ wt + am hp      wt      
#> # ℹ 7 more variables: mediator <chr>, interaction <chr>, strata <lgl>,
#> #   level <lgl>, model_parameters <list>, model_summary <list>,
#> #   fit_status <lgl>

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.

The {rmdl} package is intended to be flexible, extensible, and easy-to-use (albeit opinionated). Please see the vignettes for additional information.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4