| rm_mvsum | R Documentation |
Multivariable (or univariate) regression models are re-formatted for reporting and a global p-value is added for the evaluation of factor variables.
rm_mvsum(
model,
data,
digits = getOption("reportRmd.digits", 2),
covTitle = "",
showN = TRUE,
showEvent = TRUE,
CIwidth = 0.95,
vif = TRUE,
whichp = c("levels", "global", "both"),
caption = NULL,
tableOnly = FALSE,
p.adjust = "none",
unformattedp = FALSE,
nicenames = TRUE,
include_unadjusted = FALSE,
chunk_label,
fontsize
)
Global p-values are likelihood ratio tests for lm, glm and polr models. For lme models an attempt is made to re-fit the model using ML and if successful LRT is used to obtain a global p-value. For lmer models (lme4), if the lmerTest package is installed, Satterthwaite-based p-values and F-test global p-values are used; otherwise Wald z-based p-values and chi-squared LRT global p-values are returned. For glmer models (lme4), Wald z-based p-values are used with chi-squared LRT global p-values. Estimates are exponentiated for binomial (OR) and poisson/negative binomial (RR) families. For coxph models the model is re-run without robust variances with and without each variable and a LRT is presented. If unsuccessful a Wald p-value is returned. For GEE and CRR models Wald global p-values are returned. For negative binomial models a deviance test is used.
If the variance inflation factor is requested (VIF=TRUE, default) then a generalised VIF will be calculated in the same manner as the car package.
As of version 0.1.1 if global p-values are requested they will be included in the p-value column.
As of R 4.4.0 profile likelihood confidence intervals will be calculated automatically and there is no longer an option to force Wald tests.
The number of decimals places to display the statistics can be changed with digits, but this will not change the display of p-values. If more significant digits are required for p-values then use tableOnly=TRUE and format as desired.
A character vector of the table source code, unless tableOnly=TRUE in which case a data frame is returned
John Fox & Georges Monette (1992) Generalized Collinearity Diagnostics, Journal of the American Statistical Association, 87:417, 178-183, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/01621459.1992.10475190")}
John Fox and Sanford Weisberg (2019). An R Companion to Applied Regression, Third Edition. Thousand Oaks CA: Sage.
data("pembrolizumab")
glm_fit = glm(change_ctdna_group~sex:age+baseline_ctdna+l_size,
data=pembrolizumab,family = 'binomial')
rm_mvsum(glm_fit)
#linear model with p-value adjustment
lm_fit=lm(baseline_ctdna~age+sex+l_size+tmb,data=pembrolizumab)
rm_mvsum(lm_fit,p.adjust = "bonferroni")
#Coxph
require(survival)
res.cox <- coxph(Surv(os_time, os_status) ~ sex+age+l_size+tmb, data = pembrolizumab)
rm_mvsum(res.cox, vif=TRUE)
# lmer (lme4 mixed effects model) - single random intercept
if (require(lme4)){
lmer_fit <- lme4::lmer(age ~ sex + pdl1 + (1|cohort), data = pembrolizumab)
rm_mvsum(lmer_fit)
}
# lmer with multiple random effects and global p-values
if (require(lme4) && require(geepack)){
data(dietox, package = "geepack")
dietox$Cu <- as.factor(dietox$Cu)
lmer_fit2 <- lme4::lmer(Weight ~ Cu + Time + (1|Pig) + (1|Litter), data = dietox)
rm_mvsum(lmer_fit2, whichp = "both")
}
# glmer (binomial mixed effects model) - odds ratios
if (require(lme4)){
data(cbpp, package = "lme4")
glmer_fit <- lme4::glmer(cbind(incidence, size - incidence) ~ period + (1|herd),
data = cbpp, family = binomial)
rm_mvsum(glmer_fit)
}
# glmer.nb (negative binomial mixed effects model) - rate ratios
if (require(lme4) && require(geepack)){
data(dietox, package = "geepack")
dietox$Cu <- as.factor(dietox$Cu)
nb_fit <- lme4::glmer.nb(Weight ~ Cu + Time + (1|Pig), data = dietox)
rm_mvsum(nb_fit, whichp = "both")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.