Learn R Programming

epicmodel

Overview

epicmodel is short for “Causal Modeling in Epidemiology” and wants to offer all necessary tools for a causal modeling workflow in R for epidemiologists. Causal modeling describes a structured process of making causal assumptions based on which an epidemiological study is conducted and its results are interpreted. We are always making causal assumptions, at least implicitly. Causal modeling is about doing so explicitly. Did you ever wonder what to measure, how to define your variables, or how to model your outcome of interest? If yes, chances are you need to think about your causal model in more detail.

Causal models are created by making causal assumptions (i.e., that variable A causes variable B) within a causal modeling framework. The current version of epicmodel focuses on one of these frameworks, sufficient-component cause (SCC) models, and offers a way to create them using R. SCC models describe, which sets of causes are in combination sufficient for the outcome of interest to occur.

The package documentation contains many terms with a specific meaning in the context of this package. Check the glossary for an overview: vignette("glossary").

Usage

Creating SCC models follows a three-step workflow (see vignette("epicmodel") for an overview):

  1. Create the input for SCC model creation, the so called steplist, using the built-in shiny app. See vignette("steplist") for details.
  2. Let epicmodel create the SCC model from the steplist
  3. Use the SCC model, e.g., for:
  • Estimating standardized effect size
  • Investigating the effect of prevention and intervention
  • Inspecting the mechanisms behind sufficient causes
  • Transforming the SCC model to a directed acyclic graph (DAG)

Installation

For the latest release:

install.packages("epicmodel")

For the development version:

# install.packages("devtools")
devtools::install_github("forsterepi/epicmodel")

Copy Link

Version

Install

install.packages('epicmodel')

Monthly Downloads

193

Version

0.2.1

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Felix Forster

Last Published

December 15th, 2025

Functions in epicmodel (0.2.1)

prevent

Explore effect of prevention
remove_all_modules

Remove all modules
remove_segment

Remove segments
scc_cause_sets

Extracting component causes from SCC model
mechanism

Investigate mechanisms
sc_contain_steps

Do steps appear in sufficient causes?
scc_rain

Rain example SCC model
necessary_causes

Extract necessary causes
remove_na

Removing NA in icc and outc
show_steps

Show all steps of a SCC model
uncheck_steplist

Unchecking epicmodel_steplist objects
plot_dag

Plot DAG
scc_to_dag

Transform SCC to DAG
steplist_party

Birthday party example steplist
steplist_rain

Rain example steplist
effect_size

Determine standardized effect size of component causes
launch_steplist_creator

Launch steplist creator shiny app
intervene

Explore effect of interventions
check_steplist

Check epicmodel_steplist class objects
are_sufficient

Check if a certain set of component causes is suffcient
new_scc

SCC model objects
export_mechanism

Export mechanisms
create_scc

Creating SCC models
epicmodel-package

epicmodel: Causal Modeling in Epidemiology
new_steplist

Steplist objects