ggplot_gpath: Visualize the path of each g_i over all iterations

View source: R/function_gPath.R

ggplot_gpathR Documentation

Visualize the path of each g_i over all iterations

Description

With this function the regression path of each g_i over all iterations can be plotted. Notice, that if there are many genes in your model, it may be hard to distinguish between each path. As a solution the parameter "number.pics" can be set to a higher integer. Then, the visualization will be split into more pictures. In each picture all g_i get collected that end up in the same quantile range. E.g if you split into 3 pictures, the first picture includes all genes that result into the quantile range from 0% Qu to 33% Qu of all g.
There are parameters (G.TRANSFORM.FUN and ITER.TRANSFORM.FUN) to transform the g vector, and iteration number. These make the plot more understandable, e.g. if the distribution of the g vector is dominated by For an example see section "g-Path" in the package vignette 'browseVignettes("DTD")'

Usage

ggplot_gpath(
  DTD.model,
  number.pics = 3,
  G.TRANSFORM.FUN = log10p1,
  ITER.TRANSFORM.FUN = identity,
  y.lab = "log10(g+1)",
  x.lab = "iteration",
  subset = NA,
  title = "",
  show.legend = FALSE
)

Arguments

DTD.model

either a numeric vector with length of nrow(X), or a list returned by train_deconvolution_model, DTD_cv_lambda_cxx, or descent_generalized_fista.

number.pics

integer, into how many pictures should the resutlt be split

G.TRANSFORM.FUN

function, that expects a vector of numerics, and returns a vector of the same length. Will be applied on each intermediate 'g' vector. Set 'G.TRANSFORM.FUN' to identity if no transformation is required. If you change 'G.TRANSFORM.FUN' don't forget to adjust the y.lab parameter.

ITER.TRANSFORM.FUN

function, that expects a vector of numerics, and returns a vector of the same length. Will be applied on the iteration/x.axis of the plot. Set 'ITER.TRANSFORM.FUN' to identity if no transformation is required. If you change 'ITER.TRANSFORM.FUN' don't forget to adjust the x.lab parameter

y.lab

string, used as y label on the plot

x.lab

string, used as x label on the plot

subset

NA, or a vector of strings,that match the rownames of 'DTD.model$History'. Only these entries will be visualized. If set to NA, all entries are plotted

title

string, additionally title

show.legend

logical, should the legend be plotted? Notice that the legend will be plotted in a additional figure, and can be visualized via 'grid::grid.draw', or 'plot'

Value

list, with "gPath" entry. "gPath" will be a ggplot object. Depending on "show.legend" the list has a second entry named "legend". "legend" will be a grid object, which can be plotted via 'plot', or 'grid::grid.draw'.


MarianSchoen/DTD documentation built on April 29, 2022, 1:59 p.m.