View source: R/exalStaticFit_methods.R
| diagnostics.exalStaticFit | R Documentation |
exalStaticFit ObjectsDiagnostics for a fitted static quantile model. 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").
## S3 method for class 'exalStaticFit'
diagnostics(
object,
m2 = NULL,
X = NULL,
y = NULL,
ref = NULL,
plot = FALSE,
cols = c("red", "blue"),
cr.percent = 0.95,
...
)
object |
A fitted static |
m2 |
Optional second fitted static |
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. |
... |
Additional arguments (unused). |
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 returned object can be printed, summarized, or plotted
with standard methods. 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 object 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 <- diagnostics(fit_ldvb, fit_mcmc, ref = q_true)
plot(out)
plot(out, type = "coefficients")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.