DNbuilder: Shiny code for Dynamic Nomograms

Description Usage Arguments Value Author(s) References See Also Examples

Description

DNbuilder is a generic function to build dynamic nomograms and provide the required scripts for deploying them on a server on the web such as the http://shinyapps.io. DNbuilder supports lm, glm, coxph model objects.

Usage

1
2
DNbuilder(model, data, clevel = 0.95, m.summary = c("raw", "formatted"),
                   covariate = c("slider", "numeric"), ptype = c("st", "1-st"))

Arguments

model

an lm, glm or coxph model object

data

dataframe containing the accompanying data

clevel

confidence level required

m.summary

The option to choose the format of the model output in the 'Summary Model' tab. If "raw" (the default) is chosen the result of summary(model) will be display while if "formatted" is chosen the model summary using the stargazer package will be displayed.

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.

ptype

This plot type option relates to coxph objects only. If "st" (the default) is chosen, a plot of the estimated survivor function, S(t), is displayed. If "1-st" is chosen a plot of 1- S(t) is displayed.

Value

A new folder in the current working directory called DynNomapp which contains all the required scripts to deploy this dynamic nomogram on a server on the web such as the http://shinyapps.io. This folder includes ui.R, server.R and global.R script files needed to build the application and dataset.rds which is the accompanying dataset and a user guide text file called README.txt which explains how to deploy the app using all these objects.

Author(s)

Amirhossein Jalali, Alberto Alvarez-Iglesias, John Newell

References

Banks, J. 2006. Nomograms. Encyclopedia of Statistical Sciences. 8.
Easy web applications in R. http://shiny.rstudio.com

See Also

lm, glm, coxph, DynNom, DynNom.lm, DynNom.glm, DynNom.coxph

Examples

 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
## Not run: 
# simple linear regression models
model1 <- lm(uptake ~ Plant + conc + Plant * conc, data = CO2)
DNbuilder(model1, CO2)

# Generalized regression models
data1 =as.data.frame(Titanic)
model2 <- glm(Survived ~ Age + Class + Sex, data = data1, weights = Freq,
              family = binomial("probit"))
DNbuilder(model2, data1, clevel = 0.9)

# a proportional hazard model
data.kidney <- kidney
# always make sure that the categorical variables are in a factor class
data.kidney$sex <- as.factor(data.kidney$sex)
levels(data.kidney$sex) <- c("male", "female")

model3 <- coxph(Surv(time, status) ~ age + sex + disease, data.kidney)
DNbuilder(model3, data.kidney)
DNbuilder(model3, data.kidney, ptype = "1-st")

## End(Not run)

if (interactive()) {
# a poisson regression model
model4 <- glm(event ~ mag + station + dist + accel, data = attenu, family = poisson)
DynNom(model4, attenu, covariate = "numeric")
}

amirjll/DynNom-V4.1.1 documentation built on May 10, 2019, 1:17 a.m.