| qqnorm.brma | R Documentation |
qqnorm.brma creates a normal QQ plot for a fitted brma
object. The plot displays sorted standardized residuals on the vertical axis
against the theoretical quantiles of a standard normal distribution on the
horizontal axis. Under a correctly specified model, the points should fall
approximately along the diagonal reference line.
## S3 method for class 'brma'
qqnorm(
y,
type = "rstudent",
unit = "estimate",
conditioning_depth = "marginal",
envelope = TRUE,
conf_level = 95,
bonferroni = FALSE,
reps = 1000,
smooth = TRUE,
xlim,
ylim,
xlab,
ylab,
plot_type = "base",
...
)
y |
a fitted brma object. |
type |
the type of standardized residuals to use. Options are:
|
unit |
output unit. Only |
conditioning_depth |
residual conditioning depth. Options are
|
envelope |
logical indicating whether to add a pseudo confidence
envelope to the plot. The envelope is created by simulating sets of
standard normal quantiles, providing a reference for the expected variability
under a correctly specified model. Defaults to |
conf_level |
numeric value between 0 and 100 specifying the confidence level
for the envelope bounds. Defaults to |
bonferroni |
logical indicating whether to apply Bonferroni correction
to the envelope, so it can be regarded as a simultaneous confidence region
for all |
reps |
retained for compatibility with earlier simulation-based envelopes. The current envelope is deterministic and does not use this argument. |
smooth |
logical indicating whether to smooth the envelope bounds using
Friedman's SuperSmoother ( |
xlim |
x-axis limits. If not specified, limits are computed from data. |
ylim |
y-axis limits. If not specified, limits are computed from data. |
xlab |
title for the x-axis. If not specified, defaults to
|
ylab |
title for the y-axis. If not specified, defaults to
|
plot_type |
whether to use a base plot |
... |
additional graphical arguments to customize the plot appearance:
|
The normal QQ plot is a diagnostic tool for assessing whether the
standardized residuals follow a standard normal distribution, as expected
under a correctly specified model. Each point represents one estimate,
plotted at coordinates (\Phi^{-1}(p_i), z_{(i)}) where
p_i are the plotting positions and z_{(i)} are the sorted
standardized residuals.
The default residual type is "rstudent" (LOO-PIT), which differs
from metafor::qqnorm (which defaults to "rstandard").
LOO-PIT residuals are preferred because they are available for all model
types (including GLMMs and selection models) and properly account for
estimation uncertainty via leave-one-out cross-validation.
The confidence envelope is computed in closed form from the distribution of
normal order statistics. For the i-th sorted residual,
\Phi(Z_{(i)}) follows a beta distribution with shape parameters
i and k + 1 - i. Pointwise quantile bounds are transformed back
with \Phi^{-1}. When smooth = TRUE, bounds are smoothed using
Friedman's SuperSmoother. When bonferroni = TRUE, the confidence
level is adjusted for simultaneous inference across all k comparisons.
For GLMM models, LOO-PIT residuals and the QQ plot are computed on the
approximate effect-size scale used by loo; they are not exact
count-scale PIT diagnostics.
For plot_type = "base", returns an invisible list with
components x (theoretical quantiles) and y (sorted
residuals). For plot_type = "ggplot", returns a ggplot object.
If as_data = TRUE, returns a list with all computed plot data
including: x, y, points, refline,
envelope, xlim, ylim, xlab, and ylab.
rstudent.brma(), rstandard.brma(), residuals.brma(),
funnel.brma(), radial.brma()
## Not run:
if (requireNamespace("metadat", quietly = TRUE)) {
data(dat.lehmann2018, package = "metadat")
fit <- brma(
yi = yi,
vi = vi,
data = dat.lehmann2018,
measure = "SMD",
seed = 1,
silent = TRUE
)
fit <- add_loo(fit)
qqnorm(fit)
qqnorm(fit, type = "rstandard")
qqnorm(fit, envelope = FALSE)
qqnorm(fit, plot_type = "ggplot")
qqnorm(fit, pch = 19, col = "blue", shade = "lightblue")
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.