Learn R Programming

capr (version 0.2.0)

plot.capr: Plot deviation diagnostics by component count

Description

For a fitted CAP regression, plots two diagnostics across the first \(K\) components: (1) the negative log-likelihood returned by capr() and (2) the log deviation-from-diagonality (DfD) for the loading matrix formed by the first \(k\) directions. Both curves help assess the gain from adding components.

Usage

# S3 method for capr
plot(x, ...)

Value

Invisibly returns the numeric vector of log deviation values (one per component).

Arguments

x

A capr object returned by capr().

...

Additional arguments passed to graphics::plot() and applied to both panels (for example, pch, col, or axis limits).

Details

The DfD criterion for the first \(k\) directions \(\Gamma^{(k)}\) is $$\text{DfD}(\Gamma^{(k)}) = \left(\prod_{i = 1}^{n} \nu\!\left(\Gamma^{(k)\top} S_i \Gamma^{(k)} / T_i\right)^{T_i} \right)^{1 / \sum_i T_i},$$ where $$ \nu(A)=\frac{\det\{\mathrm{diag}(A)\}}{\det(A)} $$ for a positive definite matrix \(A\). The curve shows \(\log \text{DfD}(\Gamma^{(k)})\). A common choice for \(k\) is the last point before a sudden jump in the negative log-likelihood or log-DfD curve.

See Also

log_deviation_from_diagonality()

Examples

Run this code
sim <- simu.capr(seed = 123L, n = 120L)
fit <- capr(S = sim$S, X = sim$X, K = 3L)
plot(fit)

Run the code above in your browser using DataLab