fastglm_average: Average predictions and contrasts with delta-method...

View source: R/stream-methods.R

fastglm_averageR Documentation

Average predictions and contrasts with delta-method uncertainty

Description

Computes averages without retaining individual predictions. For a streaming fit, a contrast function can transform each design chunk before prediction. Uncertainty conditions on the supplied covariate distribution. For ordinal fits, returns an average for each category or cumulative probability. With collapsed categories, inference refers to the reduced category model and removed-category standard errors are unavailable. Nonparallel ordinal fits include the joint uncertainty of thresholds, common slopes, and threshold-specific slopes and check prediction validity at all rows with positive averaging weight.

Usage

fastglm_average(
  object,
  newdata = NULL,
  contrast = NULL,
  weights = NULL,
  vcov. = NULL,
  level = 0.95,
  type = "response"
)

Arguments

object

a fitted fastglm GLM, count, two-part, or ordinal model.

newdata

optional prediction data.

contrast

optional function transforming a design matrix. For models with two components, the function receives and returns a list with design matrices named 'count' and 'zero'. The result is the average transformed prediction minus the original prediction; offsets remain fixed.

weights

optional averaging weights; for a streaming fit, a function of chunk index. Defaults to equal weights.

vcov.

optional covariance matrix. Count models require the full joint covariance, including theta when estimated; for robust inference use 'fastglm_vcov(object, full=TRUE)'. Ordinal models require the full threshold–location covariance; supplied covariance matrices are supported only when no categories were collapsed.

level

confidence level for a normal interval.

type

prediction target: '"response"' for the marginal mean; '"count"' and '"zero"' are also available for two-component models. For ordinal fits, '"response"' or '"probability"' gives category probabilities and '"cumulative"' gives cumulative probabilities.

Value

A data frame with estimate, standard error, and confidence limits.


fastglm documentation built on Nov. 11, 2026, 5:07 p.m.