predictshine: Make interactive model predictions with shiny

Description Usage Arguments Value Examples

Description

Make interactive model predictions with shiny

Usage

1
predictshine(fit, main = NULL, variable_descriptions = NULL, ...)

Arguments

fit

a model object from either lm, glm or coxph.

main

a main title for the app, defaults to the name of fit

variable_descriptions

an optional character vector giving description of each variable in the model. Defaults to NULL, giving headings based on the variable names only

...

optional arguments to be passed to plot()

Value

An object that represents the app. Printing the object or passing it to runApp() will run the app.

Examples

 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')

tomliptrot/predictshine documentation built on May 31, 2019, 6:18 p.m.