plot.tskrr: plot a heatmap of the predictions from a tskrr model

Description Usage Arguments Details Value See Also Examples

View source: R/plot.tskrr.R

Description

This function plots a heatmap of the fitted values in a tskrr model. The function is loosely based on heatmap, but uses a different mechanism and adds a legend by default.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## S3 method for class 'tskrr'
plot(
  x,
  dendro = c("both", "row", "col", "none"),
  which = c("fitted", "loo", "response", "residuals"),
  exclusion = c("interaction", "row", "column", "both"),
  replaceby0 = FALSE,
  nbest = 0,
  rows,
  cols,
  col = rev(heat.colors(20)),
  breaks = NULL,
  legend = TRUE,
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  labRow = NULL,
  labCol = NULL,
  margins = c(5, 5),
  ...
)

Arguments

x

a tskrr model

dendro

a character value indicating whether a dendrogram should be constructed.

which

a character value indicating whether the fitted values, the leave-one-out values, the original response values or the residuals should be plotted.

exclusion

if which = "loo", this argument is passed to loo for the exclusion settings

replaceby0

if which = "loo", this argument is passed to loo.

nbest

a single integer value indicating the amount of best values that should be selected. If 0, all data is shown.

rows

a numeric or character vector indicating which rows should be selected from the model.

cols

a numeric or character vector indicating which columns should be selected from the model.

col

a vector with colors to be used for plotting

breaks

a single value specifying the number of breaks (must be 1 more than number of colors), or a numeric vector with the breaks used for the color code. If NULL, the function tries to find evenly spaced breaks.

legend

a logical value indicating whether or not the legend should be added to the plot.

main

a character value with a title for the plot

xlab

a character label for the X axis

ylab

a character label for the Y axis

labRow

a character vector with labels to be used on the rows. Note that these labels are used as is (possibly reordered to match the dendrogram). They can replace the labels from the model. Set to NA to remove the row labels.

labCol

the same as labRow but then for the columns.

margins

a numeric vector with 2 values indicating the margins to be used for the row and column labels (cfr par("mar"))

...

currently ignored

Details

The function can select a part of the model for plotting. Either you specify rows and cols, or you specify nbest. If nbest is specified, rows and cols are ignored. The n highest values are looked up in the plotted values, and only the rows and columns related to these values are shown then. This allows for a quick selection of the highest predictions.

Dendrograms are created by converting the kernel matrices to a distance, using

d(x,y) = K(x,x)^2 + K(y,y)^2 - 2*K(x,y)

with K being the kernel function. The resulting distances are clustered using hclust and converted to a dendrogram using as.dendrogram.

Value

an invisible list with the following elements:

See Also

tskrr, tune and link{impute_tskrr} to construct tskrr models.

Examples

1
2
3
4
5
6
7
data(drugtarget)
mod <- tskrr(drugTargetInteraction, targetSim, drugSim)

plot(mod)
plot(mod, dendro = "row", legend = FALSE)
plot(mod, col = rainbow(20), dendro = "none", which = "residuals")
plot(mod, labCol = NA, labRow = NA, margins = c(0.2,0.2))

xnet documentation built on Feb. 4, 2020, 9:10 a.m.