polyreg-methods: Methods for polyreg objects

polyreg-methodsR Documentation

Methods for polyreg objects

Description

S3 methods to extract coefficients, variance-covariance matrix, sample size, formatted summaries, and tidy/glance/augment from objects returned by polyreg().

Usage

## S3 method for class 'polyreg'
coef(object, ...)

## S3 method for class 'polyreg'
vcov(
  object,
  type = c("default", "sandwich", "bootstrap"),
  variance = NULL,
  ...
)

## S3 method for class 'polyreg'
nobs(object, ...)

## S3 method for class 'polyreg'
summary(object, ...)

## S3 method for class 'summary.polyreg'
print(x, digits = 3, ...)

effect_label.polyreg(
  x,
  event = c("event1", "event2"),
  add.time.point = TRUE,
  add.outcome = TRUE,
  add.exposure.levels = TRUE,
  add.conf = TRUE,
  add.p = TRUE,
  value.time = NULL,
  unit.time = NULL,
  digits = 2,
  p_digits = 2,
  p_cut = 0.05,
  ...
)

## S3 method for class 'polyreg'
tidy(
  x,
  event = c("event1", "event2", "both"),
  conf.int = x$conf.int,
  variance = NULL,
  exponentiate = FALSE,
  conf.level = NULL,
  ...,
  vcov = NULL,
  coef_rename = FALSE
)

## S3 method for class 'polyreg'
glance(x, event = c("event1", "event2"), ..., gof_map = NULL)

## S3 method for class 'polyreg'
augment(x, ...)

## S3 method for class 'polyreg'
tbl_regression(x, ..., event = c("event1", "event2"))

Arguments

object

A polyreg object returned by polyreg().

...

Further arguments passed to or from methods.

type

Character string; one of "default", "sandwich", or "bootstrap". When "default", the function chooses between sandwich and bootstrap variance based on the original polyreg() settings, using outcome.type, report.sandwich.conf, and report.boot.conf. (Used only by vcov.polyreg().)

variance

Explicit covariance choice, "if" or "bootstrap". NULL preserves legacy selection. Explicit choices fail if unavailable.

x

Object to be printed or summarised. Typically a "summary.polyreg" object for print.summary.polyreg(), or a "polyreg" object for tidy.polyreg(), glance.polyreg(), augment.polyreg(), and effect_label.polyreg().

digits

Number of digits to print for parameter estimates or effect measures. Used by print.summary.polyreg() and effect_label.polyreg().

event

Character string indicating which event to extract. For effect_label.polyreg() and glance.polyreg() this is one of "event1" or "event2". For tidy.polyreg() it can also be "both" to return rows for all events.

add.time.point

Logical; if TRUE, effect_label.polyreg() appends the time point to the label (e.g., “at 5 years”).

add.outcome

Logical; if TRUE, effect_label.polyreg() appends the outcome/event description (e.g., “of event 1”).

add.exposure.levels

Logical; if TRUE, effect_label.polyreg() includes the exposure level in the label (e.g., treatment group).

add.conf

Logical; if TRUE, effect_label.polyreg() includes a confidence interval in the label.

add.p

Logical; if TRUE, effect_label.polyreg() includes a p-value or thresholded p-value (e.g. p < 0.05).

value.time

Optional numeric value overriding the time point stored in the "polyreg" object when constructing labels in effect_label.polyreg().

unit.time

Optional character string giving the time unit to display in labels constructed by effect_label.polyreg(), such as "years" or "months".

p_digits

Integer; number of digits used to format p-values in effect_label.polyreg().

p_cut

Numeric threshold used by effect_label.polyreg() to decide between printing p < p_cut and an exact p-value.

conf.int

Numeric interval level for tidy.polyreg(), defaulting to the level stored in the fit. A changed level uses normal Wald intervals; stored BCa intervals require refitting to change their level. A logical value is also accepted: TRUE includes confidence limits and FALSE omits them. Use conf.level to select the level in this form.

exponentiate

Logical; exponentiate effect estimates and confidence limits for reporting. Standard errors and statistics stay on the log scale.

conf.level

Optional confidence level for the broom-compatible logical conf.int interface. Defaults to the fitted level.

vcov

Compatibility argument for modelsummary. Only NULL is supported by tidy.polyreg(). Use variance to choose the covariance estimator.

coef_rename

Compatibility argument for modelsummary. Only FALSE is supported by tidy.polyreg().

gof_map

Table formatting argument forwarded by modelsummary and ignored by glance.polyreg().

Value

  • coef.polyreg() returns a numeric vector of regression coefficients.

  • vcov.polyreg() returns a variance-covariance matrix.

  • nobs.polyreg() returns the number of observations.

  • summary.polyreg() returns a list of tidy and glance summaries by event.

  • print.summary.polyreg() is called for its side effect of printing a formatted, modelsummary-like table to the console and returns x invisibly.

  • tidy.polyreg() returns a data frame of tidy coefficients by event.

  • glance.polyreg() returns a data frame of model-level summaries by event.

  • augment.polyreg() returns an augmented data frame containing diagnostics, weights, and predicted CIFs.

See Also

polyreg() for log odds product modeling of CIFs


cifmodeling documentation built on Nov. 11, 2026, 9:06 a.m.