Title: | Graphical Exploration of Design Matrices |
---|---|
Description: | Given a sample data table and a design formula, ExploreModelMatrix generates an interactive application for exploration of the resulting design matrix. This can be helpful for interpreting model coefficients and constructing appropriate contrasts in (generalized) linear models. Static visualizations can also be generated. |
Authors: | Charlotte Soneson [aut, cre] , Federico Marini [aut] , Michael Love [aut] , Florian Geier [aut] , Michael Stadler [aut] |
Maintainer: | Charlotte Soneson <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.19.0 |
Built: | 2024-11-03 19:18:56 UTC |
Source: | https://github.com/bioc/ExploreModelMatrix |
Given a sample data table and a design formula, explore the resulting design matrix graphically in an interactive application.
ExploreModelMatrix(sampleData = NULL, designFormula = NULL)
ExploreModelMatrix(sampleData = NULL, designFormula = NULL)
sampleData |
(optional) A |
designFormula |
(optional) A |
A Shiny app object
Charlotte Soneson, Federico Marini, Michael I Love, Florian Geier, Michael B Stadler
app <- ExploreModelMatrix( sampleData = data.frame(genotype = rep(c("A", "B"), each = 4), treatment = rep(c("treated", "untreated"), 4)), designFormula = ~genotype + treatment ) if (interactive()) shiny::runApp(app)
app <- ExploreModelMatrix( sampleData = data.frame(genotype = rep(c("A", "B"), each = 4), treatment = rep(c("treated", "untreated"), 4)), designFormula = ~genotype + treatment ) if (interactive()) shiny::runApp(app)
Given a sample table and a design formula, generate a collection of
static plots for exploring the resulting design matrix graphically.
This function is called internally by ExploreModelMatrix()
, but
can also be used directly if interactivity is not required.
VisualizeDesign( sampleData, designFormula = NULL, flipCoordFitted = FALSE, flipCoordCoocc = FALSE, textSizeFitted = 5, textSizeCoocc = 5, textSizeLabsFitted = 12, textSizeLabsCoocc = 12, lineWidthFitted = 25, addColorFitted = TRUE, colorPaletteFitted = scales::hue_pal(), dropCols = NULL, designMatrix = NULL )
VisualizeDesign( sampleData, designFormula = NULL, flipCoordFitted = FALSE, flipCoordCoocc = FALSE, textSizeFitted = 5, textSizeCoocc = 5, textSizeLabsFitted = 12, textSizeLabsCoocc = 12, lineWidthFitted = 25, addColorFitted = TRUE, colorPaletteFitted = scales::hue_pal(), dropCols = NULL, designMatrix = NULL )
sampleData |
A |
designFormula |
A |
flipCoordFitted , flipCoordCoocc
|
A |
textSizeFitted , textSizeCoocc
|
A |
textSizeLabsFitted , textSizeLabsCoocc
|
A |
lineWidthFitted |
A |
addColorFitted |
A |
colorPaletteFitted |
A |
dropCols |
A character vector with columns to drop from the design matrix, or NULL if no columns should be dropped. |
designMatrix |
A |
Note that if a design matrix is supplied (via the designMatrix
argument), caution is required in order to interpret especially the
cooccurrence plot in the situation where the provided sampleData
contains additional columns not used to generate the design matrix (or
when it does not contain all the relevant columns).
A list with the following elements:
sampledata
: A data.frame
, expanded from the input
sampleData
plotlist
: A list of plots, displaying the fitted values for
each combination of predictor values, in terms of the model coefficients.
designmatrix
: The design matrix, after removing any columns in
dropCols
pseudoinverse
: The pseudoinverse of the design matrix
vifs
: A data.frame
with calculated variance inflation
factors
colors
: A vector with colors to use for different model
coefficients
cooccurrenceplots
: A list of plots, displaying the
co-occurrence pattern for the predictors (i.e., the number of observations
for each combination of predictor values)
totnbrrows
: The total number of "rows" in the list of plots
of fiitted values. Useful for deciding the required size of the plot canvas.
Charlotte Soneson
VisualizeDesign( sampleData = data.frame(genotype = rep(c("A", "B"), each = 4), treatment = rep(c("treated", "untreated"), 4)), designFormula = ~genotype + treatment )
VisualizeDesign( sampleData = data.frame(genotype = rep(c("A", "B"), each = 4), treatment = rep(c("treated", "untreated"), 4)), designFormula = ~genotype + treatment )