Description Usage Arguments Value Author(s) See Also Examples
DynNOm.lrm
displays the results of a lrm
model object from the rms
package as a dynamic nomogram in an 'RStudio' panel or web browser.
1 2 | DynNom.lrm(model, data,
clevel = 0.95, covariate = c("slider", "numeric"))
|
model |
a |
data |
dataframe containing the accompanying data |
clevel |
confidence level required |
covariate |
The option to choose the type of covariate(s) input control widget for numeric values. If "slider" (the default) is chosen a shiny application with slider control widgets are used while if "numeric" is chosen numeric values input controls will be displayed. |
A dynamic nomogram in a shiny application which recognises all the predictors in the model and uses them to build a sidebar panel. It sets up drop down menus for factors and sliders set at the mean and bounded by the range for covariates.
The individual predictions with a relative confidence interval are calculated using the predict
function, displaying either graphically as an interactive plot in the Graphical Summary
tab or a table in the Numerical Summary
tab. A table of model output is also available in the Model Summary
tab.
Davood Roshan, Amirhossein Jalali, Alberto Alvarez-Iglesias, John Newell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ## Not run:
# example
n <- 1000
set.seed(17)
age <- rnorm(n, 50, 10)
blood.pressure <- rnorm(n, 120, 15)
cholesterol <- rnorm(n, 200, 25)
sex <- factor(sample(c('female', 'male'), n, TRUE))
label(age) <- 'Age' # label is in Hmisc
label(cholesterol) <- 'Total Cholesterol'
label(blood.pressure) <- 'Systolic Blood Pressure'
label(sex) <- 'Sex'
units(cholesterol) <- 'mg/dl'
units(blood.pressure) <- 'mmHg'
ch <- cut2(cholesterol, g = 40, levels.mean = TRUE)
d <- data.frame(age = seq(0, 90, by = 10))
L <- .4 * (sex == 'male') + .045 * (age - 50) +
(log(cholesterol - 10) - 5.2) * ( -2 * (sex == 'female') + 2 * (sex == 'male'))
y <- ifelse(runif(n) < plogis(L), 1, 0)
cholesterol[1:3] <- NA
ddist <- datadist(age, blood.pressure, cholesterol, sex)
options(datadist = 'ddist')
data = data.frame(y = y, blood.pressure = blood.pressure, sex = sex, age = age,
cholesterol = cholesterol)
model <- lrm(y ~ blood.pressure + sex * (age + rcs(cholesterol, 4)),
x = TRUE, y = TRUE)
DynNom.lrm(model, data)
## End(Not run)
if (interactive()) {
fit <- lrm(formula = vs ~ wt + disp, data = mtcars)
DynNom.lrm(fit, mtcars, clevel = 0.9)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.