Draws one of eight standard displays for a fitted model, chosen by
type. Every backend reaches the same method, and a display that needs
a slot a given engine does not populate (posterior draws on an INLA
fit, for instance) prints a message naming what
is missing and returns invisibly instead of erroring or drawing an
empty panel. The one exception is "pp_check", which raises the
refusal pp_check.flexybayes() raises, so a caller can catch it by
class.
Arguments
- x
A fitted
flexybayesobject of any backend. Aggregated and generalised-linear fits reach the same method through their own registrations.- type
A single string naming the display to draw. One of:
"diagnostics", trace plots and marginal densities per parameter (needs a sampled posterior),"residuals", residuals against fitted values beside a normal quantile-quantile plot,"effects", a forest plot of the fixed effects with their credible intervals, available on every backend that suppliescoef()andconfint()."variance", a bar chart of the variance components with credible intervals,"blups", a caterpillar plot of the random-effect predictions ordered by magnitude,"pp_check", a posterior predictive check overlaying replicated datasets on the observed response, which needs predictive draws and so refuses by name on a fit that carries none (seepp_check.flexybayes()), and"variogram", the empirical semivariance of the residuals over the design index, and"spatial_field", the posterior mean of a separable autoregressive field,random = ~ ar1(row):ar1(col), drawn on the row-by-column array of the trial on the response scale.NULL(the default) resolves to"diagnostics"on a sampled fit and"residuals"otherwise.- ...
Further arguments passed to the underlying plotting call, for example
variableto restrict which parameters a diagnostic display covers, ortypeandndrawsfor"pp_check". The spatial field takestrial, the identifier printed in its title and the only label it adds to the array's own row and column labels. On a fit with one field per trial,random = ~ id(trial):ar1(row):ar1(col), it names the level whose field is drawn.
Value
Invisibly, the object the underlying plotting call returns:
a ggplot2 object for the displays built with it, the
semivariance table for "variogram", for "spatial_field" a list
holding values (the field, one row per row level and one column per
column level), row_var, col_var, trial, title and spelling
(the field's term as written), and NULL
for those drawn on the base graphics device. A fit with no separable
field refuses "spatial_field" with
spatial_field_requires_ar1_field. Called for the plot it draws.
Details
The default display depends on what the fit carries. A sampled
posterior gets "diagnostics", because the first question about a
sampler is whether it converged. A deterministic approximation has no
chains to trace, so an INLA fit gets "residuals" instead of a
message declining to draw the display it was asked for.
See also
pp_check.flexybayes() for the posterior predictive check
type = "pp_check" draws, and the refusal it raises where a fit has
no predictive draws.