View source: R/plot.missoNet.R
plot.missoNet | R Documentation |
missoNet
and cross-validated fitsVisualize either the cross-validation (CV) error surface or the
goodness-of-fit (GoF) surface over the \lambda_B
–\lambda_\Theta
grid for objects returned by missoNet
or cv.missoNet
.
Two display types are supported:
a 2D heatmap (default) and a 3D scatter surface.
## S3 method for class 'missoNet'
plot(
x,
type = c("heatmap", "scatter"),
detailed.axes = TRUE,
plt.surf = TRUE,
...
)
x |
A fitted object returned by |
type |
Character string specifying the plot type.
One of |
detailed.axes |
Logical; if |
plt.surf |
Logical; for |
... |
Additional graphical arguments forwarded to
|
This S3 method detects whether x
contains cross-validation results and
chooses an appropriate plotting backend:
Heatmap: uses Heatmap
with a
viridis-like color ramp (via colorRamp2
). The
selected (\lambda_B, \lambda_\Theta)
is outlined in white; 1-SE
choices (if present) are highlighted with dashed/dotted outlines.
Scatter: uses scatterplot3d
to draw the error/GoF surface on \log_{10}
scales. When
plt.surf = TRUE
, light lattice lines are added, and the minimum is
marked.
For type = "heatmap"
: a ComplexHeatmap
Heatmap
object (invisibly drawn by ComplexHeatmap
).
For type = "scatter"
: a "scatterplot3d"
object,
returned invisibly.
CV objects (created by cv.missoNet
or any
missoNet
object that carries CV results): the color encodes the
mean CV error for each (\lambda_B, \lambda_\Theta)
pair. The
minimum-error solution is outlined; if 1-SE solutions were
computed, they are also marked (dashed/dotted outlines).
Non-CV objects (created by missoNet
without CV):
the color encodes the GoF value over the grid; the selected
minimum (best) solution is outlined.
For heatmaps, axes are the raw \lambda
values; rows are
\lambda_\Theta
and columns are \lambda_B
.
For 3D scatter plots, both \lambda
axes are shown on the
\log_{10}
scale for readability.
A viridis-like palette is used. Breaks are based on distribution quantiles of the CV error or GoF values to enhance contrast across the grid.
Requires ComplexHeatmap, circlize, scatterplot3d, and grid.
Yixiao Zeng yixiao.zeng@mail.mcgill.ca, Celia M. T. Greenwood
missoNet
, cv.missoNet
,
Heatmap
, scatterplot3d
sim <- generateData(n = 150, p = 10, q = 8, rho = 0.1, missing.type = "MCAR")
## Fit a model without CV (plots GoF surface)
fit <- missoNet(X = sim$X, Y = sim$Z, verbose = 0)
plot(fit, type = "heatmap") # GoF heatmap
plot(fit, type = "scatter", plt.surf = TRUE) # GoF 3D scatter
## Cross-validation (plots CV error surface)
cvfit <- cv.missoNet(X = sim$X, Y = sim$Z, verbose = 0)
plot(cvfit, type = "heatmap", detailed.axes = FALSE)
plot(cvfit, type = "scatter", plt.surf = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.