Get the diagnostics of a fit or comparison
Source:R/accessors-print.R, R/legacy-psis.R
get_diagnostics.Rdget_diagnostics() returns the diagnostics list of a fit or a method
comparison: the results of pvstackr's checks and the details of a method
that are not in the estimate table.
Usage
get_diagnostics(x, ...)
# Default S3 method
get_diagnostics(x, ...)
# S3 method for class 'pvstackr_fit'
get_diagnostics(x, ...)
# S3 method for class 'pvstackr_method_comparison'
get_diagnostics(x, ...)
# S3 method for class 'pvstackr_legacy_psis_inspection'
get_diagnostics(x, ...)Arguments
- x
A fit (class
pvstackr_fit) or a method comparison frompv_compare_methods().- ...
Ignored.
Value
A named list whose elements depend on the object:
A
stack_directfit:preflight(the check thatdata,formulaandtargetmatch),samplerandsampler_gate(the sampler diagnostics and pvstackr's check of them),stack_fitandstack_fit_warnings(records and notes from the stacked fit) andccc(the calibration diagnostics, such asdelta_c_maxandkappa_A). A blocked fit has onlypreflight,sampler,sampler_gate,redaction(what was removed) and, when the calibration check blocked it,ccc, with its values grouped ascenter,conditioning,residualandprior.A
per_pvfit:reference(a record of the per-plausible-value fits and, when kept, their draws) andpooling(their Rubin's-rules combination).A
stack_psisfit:psis(the Pareto k-hat values, the decision and the weight diagnostics),poolingandweighted(the weighted result of each plausible value and, when kept, the stacked draws and the normalized weights). A blocked fit has onlypsisandredaction.A method comparison:
reference_method,methods,statuses,blocked_methods,warning_methods,agreement,method_diagnostics,timingandtarget_overlap(seepv_compare_methods()).The inspection object that
pv_migrate_legacy_psis_fit()makes from astack_psisfit of an earlier pvstackr version:psis(the Pareto k-hat values and the decision) andredaction(what was removed).
get_diagnostics() stops with an error if the fit or comparison was
changed after it was created.
See also
pv_fit_direct() and pvstackr_object_contracts for the
elements of a fit's diagnostics; "Status and checks" in
pvstackr_object_contracts for the thresholds of the checks and their
reason codes.
Other pvstackr-accessors:
get_draws(),
get_estimates(),
get_target()
Examples
path <- system.file(
"extdata", "examples", "pisa_tiny_stack_direct.rds", package = "pvstackr"
)
if (nzchar(path)) {
fit <- readRDS(path)$fit
names(get_diagnostics(fit))
}
#> [1] "preflight" "sampler" "sampler_gate"
#> [4] "stack_fit" "stack_fit_warnings" "ccc"