| fastglm_bootstrap | R Documentation |
Repeatedly resamples observations or independent clusters, or generates new responses from the fitted model, and refits the regression. A statistic such as a coefficient or average predicted response is then evaluated after each refit. This includes uncertainty from estimating both model components and negative-binomial size when applicable.
fastglm_bootstrap(
object,
R = 199L,
statistic = NULL,
type = c("pairs", "cluster", "parametric"),
cluster = NULL,
seed = NULL,
workers = 1L,
level = 0.95,
control = list()
)
## S3 method for class 'fastglm_bootstrap'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
object |
a converged fastglm model with its design and response retained, or a streaming model with a repeatable source. |
R |
number of bootstrap refits, at least two. |
statistic |
function of the refitted model returning a finite numeric vector. The default returns coefficients and estimated theta when present. |
type |
'"pairs"' resamples rows, '"cluster"' resamples whole independent clusters, and '"parametric"' simulates responses conditional on the design. |
cluster |
cluster identifiers for cluster resampling. For a streaming source, supply a function returning the identifiers in each chunk. |
seed |
optional random seed. Supplying it preserves the caller's random number state. Each replicate has its own seed, independent of scheduling. |
workers |
number of independent R processes. Streaming sources use one process because database connections may not be transferable. A custom statistic must capture external objects, such as new prediction data, in its function environment; worker processes do not inherit objects from the calling session's global environment. |
level |
confidence level for percentile intervals. |
control |
named list of arguments passed to each fitting function, such as 'tol', 'maxit', or 'outer.maxit'. |
x |
a 'fastglm_bootstrap' result. |
digits |
number of significant digits used for printing. |
... |
further arguments passed to 'print()'. |
Pair resampling treats rows as independent sampling units. Cluster resampling treats the supplied clusters as independent and retains all rows from each sampled cluster. The original observation weights and offsets are retained on every sampled copy. Parametric resampling assumes the fitted response distributions; it does not model unspecified within-cluster dependence. For a numeric binomial response, positive prior weights are interpreted as integer trial counts, as in 'stats::simulate()'; for a two-column response, the column sum supplies the trial count and any additional case weights are held fixed. The formula design is held fixed, including factor levels and spline bases, so data-driven preprocessing or model selection is not repeated. These procedures require regular, identifiable fits; they do not establish valid inference at separation or mixture boundaries. Streaming parametric refits regenerate responses one block at a time with fixed block seeds. Pair and cluster resampling also retain row indices or multiplicities, requiring memory proportional to the number of rows; neither procedure collects the full streaming design matrix.
Ordinal bootstrap support currently requires common slopes. For ordinal fits, pair and cluster resampling copy stored rows, including their frequency weights and grouped counts; they do not resample the individuals represented by a frequency row separately. Parametric resampling draws category counts with each row's effective integer total, then refits those counts with unit weights. The declared outcome levels, design columns, and offsets are preserved. Formula metadata is retained for statistics that predict on new data. Ordinal optimizer arguments may be changed through 'control', but the estimator, design, response, weights, and category order may not be overridden there. Stored zero-frequency rows remain sampling units in pairs and cluster resampling. Ordinal cluster identifiers may match retained rows or rows before missing-value omission, after any subset; every retained sampling row must have a cluster identifier. Ordinal results record 'rng.kind' alongside replicate seeds for reproducing the random-number stream.
Ordinal point replicates and category diagnostics are retained when a refit has empty categories or fails to converge, provided the statistic can be evaluated. For mean bias reduction with 'type = "parametric"', empty endpoint categories are allowed in the original fit and its refits because the fitted thresholds remain finite. The original fit and every refit must retain all interior categories, and every refit and statistic must succeed. An empty interior category ties adjacent thresholds and changes the fitted model, so uncertainty summaries remain unavailable. The same empty-category restriction applies to maximum likelihood and to pairs or cluster resampling. These rules also apply to custom statistics; point replicates remain available for inspection.
Every failed or nonconverged refit is recorded. If any replicate fails, standard errors and intervals are returned as missing rather than silently conditioning inference on the successful fits. Inspect 'diagnostics' and resolve the fitting problem before interpreting bootstrap uncertainty.
A 'fastglm_bootstrap' list with the original 'estimate', a matrix of 'replicates', 'std.error', percentile 'conf.int', per-refit 'diagnostics', replicate 'seeds', and resampling details.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.