plot.missoNet: Plot methods for 'missoNet' and cross-validated fits

View source: R/plot.missoNet.R

plot.missoNetR Documentation

Plot methods for missoNet and cross-validated fits

Description

Visualize 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.

Usage

## S3 method for class 'missoNet'
plot(
  x,
  type = c("heatmap", "scatter"),
  detailed.axes = TRUE,
  plt.surf = TRUE,
  ...
)

Arguments

x

A fitted object returned by missoNet or cv.missoNet.

type

Character string specifying the plot type. One of "heatmap" (default) or "scatter".

detailed.axes

Logical; if TRUE (default) show dense axis labels. If FALSE, a sparser labeling is used to avoid clutter.

plt.surf

Logical; for type = "scatter" only, draw light surface grid lines and highlight the minimum point. Ignored for heatmaps. Default TRUE.

...

Additional graphical arguments forwarded to Heatmap when type = "heatmap", or to scatterplot3d when type = "scatter".

Details

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.

Value

  • For type = "heatmap": a ComplexHeatmap Heatmap object (invisibly drawn by ComplexHeatmap).

  • For type = "scatter": a "scatterplot3d" object, returned invisibly.

What gets plotted

  • 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.

Axes and scales

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.

Color mapping

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.

Dependencies

Requires ComplexHeatmap, circlize, scatterplot3d, and grid.

Author(s)

Yixiao Zeng yixiao.zeng@mail.mcgill.ca, Celia M. T. Greenwood

See Also

missoNet, cv.missoNet, Heatmap, scatterplot3d

Examples

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)



missoNet documentation built on Sept. 9, 2025, 5:55 p.m.