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.
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,
chunk_label,
fontsize
)
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,
chunk_label,
fontsize
)
model |
model fit |
data |
data that model was fit on (an attempt will be made to extract this from the model) |
digits |
number of digits to round estimates to, does not affect p-values |
covTitle |
character with the names of the covariate (predictor) column. The default is to leave this empty for output or, for table only output to use the column name 'Covariate'. |
showN |
boolean indicating sample sizes should be shown for each comparison, can be useful for interactions |
showEvent |
boolean indicating if number of events should be shown. Only available for logistic. |
CIwidth |
width for confidence intervals, defaults to 0.95 |
vif |
boolean indicating if the variance inflation factor should be included. See details |
whichp |
string indicating whether you want to display p-values for levels within categorical data ("levels"), global p values ("global"), or both ("both"). Irrelevant for continuous predictors. |
caption |
table caption |
tableOnly |
boolean indicating if unformatted table should be returned |
p.adjust |
p-adjustments to be performed. Uses the p.adjust function from base R |
unformattedp |
boolean indicating if you would like the p-value to be returned unformatted (ie not rounded or prefixed with '<'). Should be used in conjuction with the digits argument. |
nicenames |
boolean indicating if you want to replace . and _ in strings with a space |
chunk_label |
only used if output is to Word to allow cross-referencing |
fontsize |
PDF/HTML output only, manually set the table 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 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=T, 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.
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 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=T) then a generalised VIF will be calculated in the same manner as the car package.
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
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.
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)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.