plot.nmfkc.ident: Plot the identification region and intervals of an...

View source: R/nmfkc.ident.R

plot.nmfkc.identR Documentation

Plot the identification region and intervals of an nmfkc.ident object

Description

Draws how far X and C (B for a fit without covariates) can move without changing the fit. The ranges are the identification region when it was computed (Y and A given, nrow(A) == rank); otherwise they are the ranges found by the algebraic check, which are inner bounds (the region is at least this wide). Each line is the range of one entry on its own: the entries do not reach their ends together, since one remixing moves the whole matrix.

  • type = "C": one panel per entry of C, bases in rows and covariates in columns: the range (black; a dot when it is a single point), the profile-likelihood interval if computed (gray) and the estimate (red cross). Panels whose interval excludes 0 are shaded.

  • type = "X": one panel per basis, the range of every row of X (black) and the estimate (red cross). The row names are written once, left of the first panel, so that many bases fit side by side on a page; when they do not fit the height, every k-th row is named. Beyond 40 rows the row numbers are written at a few pretty() positions instead; rows draws a subset.

  • type = "B": one strip per basis, the columns of C along the horizontal axis (for a fit without covariates, C = B has one column per sample), the range of every entry (black line) and the estimate (small red point). Suited to many columns. When at is given, the horizontal axis is left undrawn so that axis(1, ...) can label it (e.g. with dates).

  • type = "C.prob", "B.prob": the same with every column of C divided by its sum, i.e. the share of each basis in a covariate, or the membership probability of a sample (B.prob of the fit) without covariates. The column sums do not change under a remixing, so these ranges are exact rescalings and lie between 0 and 1; the profile-likelihood intervals, which are for C itself, are not drawn. No "X.prob" is offered: the row sums of X change under a remixing, so its row shares do not rescale.

The estimate is the repaired fit when the region was computed, otherwise the fitted matrices. The colours named above are the defaults; col changes them, and cex and lwd the sizes of the marks and the widths of the lines.

Usage

## S3 method for class 'nmfkc.ident'
plot(
  x,
  type = NULL,
  bases = NULL,
  at = NULL,
  panel = NULL,
  col = NULL,
  cex = NULL,
  lwd = NULL,
  rows = NULL,
  ...
)

Arguments

x

An object of class "nmfkc.ident".

type

"C", "X", "B", "C.prob" or "B.prob". Default: "C" when C has at most 12 columns, otherwise "B".

bases

Bases to draw, by index or name (columns of X, rows of C). Default: all of them for "C" and "X" (a basis that cannot move shows as dots); for "B" the bases whose range exceeds move.tol of a column sum (all of them if none does).

at

For type = "B": horizontal positions of the columns (e.g. times). Default 1:ncol(C).

panel

For type = "B": optional function(q) called in each strip after drawing (e.g. to add abline(v = ...)); q is the index of the basis.

col

Colours, as a named vector with any of range (the ranges; default "black"), estimate (the estimate marks; "red3"), interval (the profile-likelihood intervals of type = "C"; "gray55") and shade (the panels whose interval excludes 0; "gray90"), e.g. col = c(estimate = "blue"). Elements not given keep their default, and NA leaves that part out. The legend below the plot names a colour given by name (e.g. "blue cross: estimate") and otherwise only the mark (e.g. "cross: estimate" for "#1f77b4").

cex

Sizes of the marks, as a named vector with any of estimate (the estimate marks) and range (the dot drawn when a range is a single point; types "C" and "X"), e.g. cex = c(estimate = 0.5). Defaults: estimate 1.6 ("C"), 0.9 ("X"), 0.5 ("B"); range 0.8 ("C"), 0.45 ("X").

lwd

Line widths, as a named vector with any of range (the range lines), interval (the profile-likelihood intervals of type = "C") and estimate (the strokes of the estimate crosses; types "C" and "X"), e.g. lwd = c(range = 2). Defaults: range 6 ("C"), 4 ("X"), par("lwd") ("B"); interval 2.5; estimate 2 ("C"), 1.5 ("X"). For col, cex and lwd, elements not given keep their default and elements that do not apply to the type are ignored.

rows

For type = "X": rows of X to draw, by index or name, in the order given from the top (e.g. rows = 1:30). Default: all of them.

...

Not used.

Value

x, invisibly. For type = "B" the graphical parameters are left as set, with the last strip active, so that axis(1, ...) can relabel the horizontal axis afterwards.

See Also

nmfkc.ident, summary.nmfkc.ident


nmfkc documentation built on Nov. 30, 2026, 1:06 a.m.