The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

CRAN_Status_Badge CRAN_downloads_month CRAN_downloads_total

rmsMD

rmsMD provides streamlined functions for summarising and visualising regression models fitted with the rms package, in the preferred format for medical journal reporting.

It includes support for linear, logistic, and Cox models, handles restricted cubic splines (RCS) automatically, and produces publication-ready tables and plots.


Installation

You can install rmsMD from CRAN:

install.packages("rmsMD")

It is recommended that this package is used alognside rms, which can be installed via:

install.packages("rms")

Quick start

Fit regression models and create clean outputs

Fit a logistic regression model with restricted cubic splines for age and BMI.
Generate a publication-ready summary table from the fitted model.

library(rmsMD)
library(rms)

# Fit an OLS model including a restricted cubic spline 
# for Age and BMI (with 4 knots)
fit_lrm <- lrm(majorcomplication ~ rcs(age,4) + 
                 rcs(bmi,4) + 
                 sex + 
                 smoking, 
               data = data)

# Generate a publication-ready summary table
modelsummary_rms(fit_lrm)

Example output table


Building basic plots

Create basic plots of the model’s restricted cubic spline terms to visualize adjusted effects.

# Most basic output
ggrmsMD(fit_lrm, data)

Basic RCS plot


Plot customisation

Customize axis labels, plot titles, and shading to highlight inferior outcomes visually.

# x axis labels can be stored in a list
xlabels <- list ("age" = "Age (years)",
                 "bmi" = "Body Mass Index")

# titles for each variable can be stored in a list
titles <- list ("age" = "Impact of Age on Complications",
                 "bmi" = "Impact of BMI on Complications")

ggrmsMD(fit_lrm, data,
        # set y axis label for all plots
        ylab = "Complications (adjusted OR)", 
        # set y axis limits
        ylim = c(0,3),
        # set higher OR as inferior outcome to assign red shading
        shade_inferior = "higher", 
        # set x axis labels for each variable
        xlabs = xlabels, 
        # set titles for each variable
        titles = titles 
        )

Advanced RCS plot


Learn more

See the Standard workflow with restricted cubic splines vignette for a full worked example.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.