Description Usage Arguments Value Examples
Make interactive model predictions with shiny
1 | predictshine(fit, main = NULL, variable_descriptions = NULL, ...)
|
fit |
a model object from either lm, glm or coxph. |
main |
a main title for the app, defaults to the name of |
variable_descriptions |
an optional character vector giving description of each variable in the model. Defaults to |
... |
optional arguments to be passed to |
An object that represents the app. Printing the object or passing it to runApp()
will run the app.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # linear regression
# create demo linear model using school dataset
predictshine(mylm, main = 'Linear Model example', variable_descriptions = c('Admission (0 = yes, 1 = no)', 'Grade point average', 'Class rank'))
predictshine(mylm)
# Logistic regression
mylogit <- glm(admit ~ gre + gpa + rank, data = school, family = "binomial")
predictshine(mylogit)
# Survival
library(survival)
# Variables must be set to correct type outside of model call
lung$sex = factor(lung$sex )
lung$ph.ecog = factor(lung$ph.ecog )
# model must be set to TRUE
fit_cox = coxph(Surv(time, status) ~ age + sex + ph.ecog , lung, model = TRUE)
predictshine(fit_cox, xscale = 365 , xlab = 'Time (years)', ylab = 'Overall Survival')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.