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.
# S3 method for 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),
...
)
a tskrr model
a character value indicating whether a dendrogram should be constructed.
a character value indicating whether the fitted values, the leave-one-out values, the original response values or the residuals should be plotted.
if which = "loo"
, this argument is passed to
loo
for the exclusion settings
if which = "loo"
, this argument is passed to
loo
.
a single integer value indicating the amount of best values
that should be selected. If 0
, all data is shown.
a numeric or character vector indicating which rows should be selected from the model.
a numeric or character vector indicating which columns should be selected from the model.
a vector with colors to be used for plotting
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.
a logical value indicating whether or not the legend should be added to the plot.
a character value with a title for the plot
a character label for the X axis
a character label for the Y axis
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.
the same as labRow
but then for the columns.
a numeric vector with 2 values indicating the margins to
be used for the row and column labels (cfr par("mar")
)
currently ignored
an invisible list with the following elements:
val
: the values plotted
ddK
: if a row dendrogram was requested, the row dendrogram
ddG
: if a column dendrogram was requested,
the column dendrogram
breaks
: the breaks used for the color codes
col
: the colors used
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
.
tskrr
, tune
and
link{impute_tskrr}
to construct tskrr models.
# NOT RUN {
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))
# }
Run the code above in your browser using DataLab