Scatterplot and Regression Model
tm_a_regression.Rd
Scatterplot and Regression Model
Usage
tm_a_regression(
label = "Regression Analysis",
regressor,
response,
plot_height = c(600, 200, 2000),
plot_width = NULL,
alpha = c(1, 0, 1),
size = c(2, 1, 8),
ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void",
"test"),
ggplot2_args = teal.widgets::ggplot2_args(),
pre_output = NULL,
post_output = NULL,
default_plot_type = 1,
default_outlier_label = "USUBJID"
)
Arguments
- label
(
character
) Label shown in the navigation item for the module.- regressor
(
data_extract_spec
orlist
of multipledata_extract_spec
) Regressor variables from an incoming dataset with filtering and selecting.- response
(
data_extract_spec
orlist
of multipledata_extract_spec
) Response variables from an incoming dataset with filtering and selecting.- plot_height
optional, (
numeric
) A vector of length three withc(value, min and max)
for a slider encoding the plot height.- plot_width
optional, (
numeric
) A vector of length three withc(value, min and max)
for a slider encoding the plot width.- alpha
optional, (
numeric
) If scalar then the plot points will have a fixed opacity. If a slider should be presented to adjust the plot point opacity dynamically then it can be a vector of length three withc(value, min, max)
.- size
optional, (
numeric
) If scalar then the plot point sizes will have a fixed size If a slider should be presented to adjust the plot point sizes dynamically then it can be a vector of length three withc(value, min, max)
.- ggtheme
optional, (
character
)ggplot2
theme to be used by default. One ofc("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")
. Each theme can be chosen by the user during the session. Defaults to"gray"
.- ggplot2_args
-
optional, (
ggplot2_args
) object created byteal.widgets::ggplot2_args()
with settings for all the plots or named list ofggplot2_args
objects for plot-specific settings. The argument is merged with options variableteal.ggplot2_args
and default module setup.List names should match the following:
c("default", "Response vs Regressor", "Residuals vs Fitted", "Scale-Location", "Cook's distance", "Residuals vs Leverage"", "Cook's dist vs Leverage")
.For more details see the vignette:
vignette("custom-ggplot2-arguments", package = "teal.widgets")
. - pre_output
(
shiny.tag
, optional)
with text placed before the output to put the output into context. For example a title.- post_output
(
shiny.tag
, optional) with text placed after the output to put the output into context. For example theshiny::helpText()
elements are useful.- default_plot_type
-
optional, (
numeric
) Defaults to Response vs Regressor.Response vs Regressor
Residuals vs Fitted
Normal Q-Q
Scale-Location
Cook's distance
Residuals vs Leverage
Cook's dist vs Leverage
- default_outlier_label
optional, (
character
) The default column selected to label outliers.
Note
For more examples, please see the vignette "Using regression plots" via
vignette("using-regression-plots", package = "teal.modules.general")
.
Examples
# Regression graphs from selected response variable (BMRKR1) and
# selected regressors (AGE)
library(scda)
ADSL <- synthetic_cdisc_data("latest")$adsl
app <- init(
data = cdisc_data(
cdisc_dataset("ADSL", ADSL, code = "ADSL <- synthetic_cdisc_data(\"latest\")$adsl"),
check = TRUE
),
modules = modules(
tm_a_regression(
label = "Regression",
response = data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variable:",
choices = "BMRKR1",
selected = "BMRKR1",
multiple = FALSE,
fixed = TRUE
)
),
regressor = data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variables:",
choices = variable_choices(ADSL, c("AGE", "SEX", "RACE")),
selected = "AGE",
multiple = TRUE,
fixed = FALSE
)
),
ggplot2_args = teal.widgets::ggplot2_args(labs = list(subtitle = "Plot generated by Regression Module"))
)
)
)
#> [INFO] 2022-06-14 17:42:09.7748 pid:1110 token:[] teal.modules.general Initializing tm_a_regression
if (FALSE) {
shinyApp(app$ui, app$server)
}