Description Usage Arguments Value See Also Examples
View source: R/rms_model_results.R
Combine information from summary.rms(), anova.rms(), and other rms object info to create a single tidy data.frame of model results that could be printed in a report.
1 2 3 | rms_model_results(rmsObj, labeldf = NULL, shortLabs = NULL, rndDigits = 2,
rndTestStat = 1, rndInfo = rndDigits, printFormat = c("plain",
"markdown", "latex"), rmRows = c("nl.int", "nl", "int", "none"), addInfo)
|
rmsObj |
Object of class rms |
labeldf |
Data frame from which to get variable labels. Defaults to NULL, in which case variable names will be used. |
shortLabs |
Named vector of variable labels to replace in interaction rows. Must be in format c("variable name" = "shortened label"). |
rndDigits |
Number of digits to round reference, comparison, result and CI values to. Defaults to 2. |
rndTestStat |
Number of digits to round test statistic to. Defaults to 1. |
printFormat |
How to format results for printing. Defaults to plain text; LaTeX or Markdown available. |
rmRows |
Which sets of rows to exclude from final model results. For example, it is more appropriate to look at the test for total nonlinearity to determine whether to keep these terms than to look at individual variables' tests for nonlinearity. Example 2: in cases like nonlinear interactions, some rows of output can be redundant. Options: nl (removes rows labeled Nonlinear [Interaction] (...) in anova.rms()); int (removes rows labeled All Interactions in anova.rms()); nl.int (removes all of the above); none (keeps all rows). Defaults to nl.int. |
rndModInfo |
Number of digits to round model LR, R2, etc to. Defaults to rndDigits. |
whichInfo |
Vector of elements of rmsObj$stats to include. Defaults to model likelihood ratio, R^2, C, Dxy, as available. (Model df are included in the main table.) |
data.frame containing quantity descriptions, reference and comparison values, coefficient or ratio and 95 model statistics.
ols
, lrm
, cph
, Gls
,
summary.rms
, anova.rms
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Fit linear regression model using ols()
mymod <- ols(mpg ~ cyl * wt, data = mtcars)
## Make sure to set datadist; summary.rms() requires this
dd.mtcars <- datadist(mtcars)
options(datadist = 'dd.mtcars')
## Defaults, using variable names
rms_model_results(mymod)
## Defaults, using variable labels
label(mtcars$cyl) <- 'Number of cylinders'
label(mtcars$wt) <- 'Weight (1000 lbs)'
rms_model_results(mymod, labeldf = mtcars)
## Use shortened variable labels for interaction row
rms_model_results(mymod, labeldf = mtcars, shortLabs = c('cyl' = 'Cylinders', 'wt' = 'Weight'))
## Use shortened variable labels, format for Markdown
rms_model_results(mymod, labeldf = mtcars, shortLabs = c('cyl' = 'Cylinders', 'wt' = 'Weight'), printFormat = 'markdown')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.