Description Usage Arguments Value Author(s) See Also Examples
DynNom.Glm
displays the results of a Glm
model object from the rms
package as a dynamic nomogram in an 'RStudio' panel or web browser.
1 2 | DynNom.Glm(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 | ## Not run:
# example 1 - a generalized linear model
set.seed(1)
x1 <- runif(200)
x2 <- sample(0:3, 200, TRUE)
x3 <- sample(0:2, 200, TRUE)
distance <- (x1 + x2 / 3 + rnorm(200)) ^ 2
d <- datadist(x1, x2)
options(datadist = "d")
data1 = data.frame(distance, x1, x2, x3)
model1 <- Glm(distance ~ x3 + rcs(x1, 4) * scored(x2), data = data1)
DynNom.Glm(model1, data1)
# example 2 - a poisson regression model
counts <- c(18, 17, 15, 20, 10, 20, 25, 13, 12)
outcome <- gl(3, 1, 9)
treatment <- gl(3, 3)
data2 = data.frame(counts, outcome, treatment)
model2 <- Glm((2 * counts) ~ outcome + treatment, family = poisson(), data = data2)
DynNom.Glm(model2, data2)
## End(Not run)
if (interactive()) {
# a Gamma regression model
clotting <- data.frame(
u = c(5, 10, 15, 20, 30, 40, 60, 80, 100),
lot1 = c(118, 58, 42, 35, 27, 25, 21, 19, 18),
lot2 = c(69, 35, 26, 21, 18, 16, 13, 12, 12),
cat = c(rep("A",5), rep("B",4)))
model3 <- Glm(lot1 ~ log(u) + cat, data = clotting, family = Gamma)
DynNom.Glm(model3, clotting)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.