foresty: Forest Plots and Subgroup Effects from Fitted Regression Models
Draws forest plots of exposure effects from fitted regression
models. Name an exposure and 'foresty' plots its effect. Name an effect
modifier as well and it refits the model with the interaction term,
estimates the exposure effect within each level of the modifier as a
linear combination of the coefficients, and reports the joint interaction
test beside those estimates. It takes one exposure and one modifier at a
time, so the interaction is always a two-way one. Rows of the plot and of
the table beside it share one scale, in a layout that can follow a
journal's house style. The same results go to a self-contained HTML page
holding the subgroup estimates, the joint test and the coefficient table.
The 'car' package computes the linear combinations and their tests.
Models fitted by stats::glm(), stats::lm(), the 'survival' package, the
'lme4' package and the 'geepack' package are supported, as is any fit
supplying coef() and vcov(). Ordinal outcomes are supported through the
'MASS' package and nominal ones through the 'nnet' package, where the
figure carries one row per level of the outcome and the interaction is
tested jointly across the equations. Fits from the 'rms' package are
refused, naming the function that fits the same model in their place.
The estimation of an exposure effect within a level of a modifier, and the
test of the difference between such estimates, follow Altman and Bland
(2003) <doi:10.1136/bmj.326.7382.219> and VanderWeele and Knol (2014)
<doi:10.1515/em-2013-0005>; the reporting of subgroup effects beside the
interaction test follows Wang et al. (2007) <doi:10.1056/NEJMsr077003>,
and the figure itself the forest plot described by Lewis and Clarke (2001)
<doi:10.1136/bmj.322.7300.1479>.
| Version: |
0.1.0 |
| Depends: |
R (≥ 4.1) |
| Imports: |
car (≥ 3.1.0), checkmate (≥ 2.1.0), ggplot2 (≥ 3.4.0), grDevices, grid, patchwork (≥ 1.1.0), scales (≥ 1.2.0), stats, utils |
| Suggests: |
base64enc, broom (≥ 1.0.0), bslib (≥ 0.5.0), data.table, geepack, gt (≥ 0.9.0), Hmisc, knitr, lme4, MASS, nnet, ragg, rmarkdown, rms, sandwich (≥ 3.0.0), shiny (≥ 1.7.0), survival (≥ 3.2.0), svglite, tibble, testthat (≥ 3.0.0), zip |
| Published: |
2026-09-12 |
| DOI: |
10.32614/CRAN.package.foresty (may not be active yet) |
| Author: |
Akihiro Shiroshita [aut, cre, cph],
Yuki Kataoka [aut] |
| Maintainer: |
Akihiro Shiroshita <akihirokun8 at gmail.com> |
| BugReports: |
https://github.com/AkiShiroshita/foresty/issues |
| License: |
GPL-3 |
| URL: |
https://github.com/AkiShiroshita/foresty,
https://akishiroshita.github.io/foresty/ |
| NeedsCompilation: |
no |
| Language: |
en-GB |
| Citation: |
foresty citation info |
| Materials: |
README, NEWS |
| CRAN checks: |
foresty results |
Documentation:
Downloads:
Linking:
Please use the canonical form
https://CRAN.R-project.org/package=foresty
to link to this page.