View source: R/exalStaticDiagnostics.R
| exalStaticDiagnostics | R Documentation |
Static diagnostics companion for exalStaticLDVB() and
exalStaticMCMC(). The function summarizes fitted quantiles on a
shared design matrix, reports mean check loss against observed responses when
available, and can optionally compare the fitted quantile curve against a
known reference quantile function. The returned diagnostic object also stores
posterior summaries for the static regression coefficients, which can be
plotted with plot(..., type = "coefficients").
exalStaticDiagnostics(
m1,
m2 = NULL,
X = NULL,
y = NULL,
ref = NULL,
plot = TRUE,
cols = c("red", "blue"),
cr.percent = 0.95
)
m1 |
An object of class |
m2 |
Optional second fitted static model to compare against |
X |
Optional design matrix. If omitted, the function uses |
y |
Optional response vector. If omitted, the function uses |
ref |
Optional reference quantile vector on the same rows as |
plot |
Logical; if |
cols |
Character vector of length 1 or 2 giving colors for plotted diagnostics. |
cr.percent |
Credible-interval mass used when summarizing fitted quantiles. |
Unlike exdqlmDiagnostics, which is built around one-step-ahead
dynamic forecast diagnostics, exalStaticDiagnostics() is designed for the
static regression setting. It reports fitted quantile summaries on a common
design matrix, optional mean check loss against observed responses, optional
reference-curve errors, coefficient posterior summaries, and compact
comparison plots. The ref argument is a reference conditional quantile
evaluated on the rows of X; it is distinct from the optional
beta.ref argument of plot.exalStaticDiagnostic, which is
used only to overlay known coefficient values in simulation examples.
An object of class "exalStaticDiagnostic" containing fitted-quantile
summaries, residual summaries (when y is provided), optional
reference-curve error metrics, coefficient posterior summaries, and
run-time metadata for m1 and m2 (if supplied).
set.seed(1)
x <- seq(-2, 2, length.out = 60)
X <- cbind(1, x)
y <- 0.5 * x + (1.2 + 0.35 * x) * stats::rnorm(length(x))
q_true <- 0.5 * x + (1.2 + 0.35 * x) * stats::qnorm(0.25)
fit_ldvb <- exalStaticLDVB(
y = y, X = X, p0 = 0.25,
max_iter = 60, tol = 1e-3,
verbose = FALSE
)
fit_mcmc <- exalStaticMCMC(
y = y, X = X, p0 = 0.25,
n.burn = 60, n.mcmc = 60,
mh.proposal = "slice",
verbose = FALSE
)
out <- exalStaticDiagnostics(fit_ldvb, fit_mcmc, ref = q_true, plot = FALSE)
print(out)
plot(out, type = "coefficients")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.